@smartmemory/compose 0.2.43-beta → 0.2.45-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-DQblyoua.js +696 -0
  2. package/dist/assets/{arc-fd_r6IIl.js → arc-B4fPSjcd.js} +1 -1
  3. package/dist/assets/{architectureDiagram-3BPJPVTR-UehcfvE8.js → architectureDiagram-3BPJPVTR-SiqLJ2Dv.js} +1 -1
  4. package/dist/assets/{blockDiagram-GPEHLZMM-Dm-THFZ6.js → blockDiagram-GPEHLZMM-DgA84B2f.js} +1 -1
  5. package/dist/assets/{c4Diagram-AAUBKEIU-CIZ7QDGR.js → c4Diagram-AAUBKEIU-B-tXpPJU.js} +1 -1
  6. package/dist/assets/channel-D60Ea_Qi.js +1 -0
  7. package/dist/assets/{chunk-2J33WTMH-COBZ5eyU.js → chunk-2J33WTMH-Ch2s7Kg8.js} +1 -1
  8. package/dist/assets/{chunk-4BX2VUAB-w3bqdoNF.js → chunk-4BX2VUAB-B0CaezI4.js} +1 -1
  9. package/dist/assets/{chunk-55IACEB6-D18v8dR4.js → chunk-55IACEB6-B7bap9LR.js} +1 -1
  10. package/dist/assets/{chunk-727SXJPM-2MAwFz_9.js → chunk-727SXJPM-CMksbsjL.js} +1 -1
  11. package/dist/assets/{chunk-AQP2D5EJ-Dp_jdVPB.js → chunk-AQP2D5EJ-ChOCnmMe.js} +1 -1
  12. package/dist/assets/{chunk-FMBD7UC4-mPSIpSeS.js → chunk-FMBD7UC4-qcUlmmEN.js} +1 -1
  13. package/dist/assets/{chunk-ND2GUHAM-gkRIeuOg.js → chunk-ND2GUHAM-BWwR4JBR.js} +1 -1
  14. package/dist/assets/{chunk-QZHKN3VN-DJ7h7c2i.js → chunk-QZHKN3VN-DuRbBL0q.js} +1 -1
  15. package/dist/assets/classDiagram-4FO5ZUOK-Vt88epYI.js +1 -0
  16. package/dist/assets/classDiagram-v2-Q7XG4LA2-Vt88epYI.js +1 -0
  17. package/dist/assets/{cose-bilkent-S5V4N54A-BC5rkVLI.js → cose-bilkent-S5V4N54A-Dd3Ids4E.js} +1 -1
  18. package/dist/assets/{dagre-BM42HDAG-DBwRZbPz.js → dagre-BM42HDAG-C2fmFG1L.js} +1 -1
  19. package/dist/assets/{diagram-2AECGRRQ-CmljsTYt.js → diagram-2AECGRRQ-gZjYzjSJ.js} +1 -1
  20. package/dist/assets/{diagram-5GNKFQAL-Pcdh-Hev.js → diagram-5GNKFQAL-uxJ9zL35.js} +1 -1
  21. package/dist/assets/{diagram-KO2AKTUF-CrEqfa_s.js → diagram-KO2AKTUF--9DBGjk3.js} +1 -1
  22. package/dist/assets/{diagram-LMA3HP47-pmYhkUAj.js → diagram-LMA3HP47-DkhUcRJZ.js} +1 -1
  23. package/dist/assets/{diagram-OG6HWLK6-1mWNdTnP.js → diagram-OG6HWLK6-BaJ__gNW.js} +1 -1
  24. package/dist/assets/{erDiagram-TEJ5UH35-BuNJLn2I.js → erDiagram-TEJ5UH35-DWszA5vM.js} +1 -1
  25. package/dist/assets/{flowDiagram-I6XJVG4X-D84i8zUb.js → flowDiagram-I6XJVG4X-DKGbnIHA.js} +1 -1
  26. package/dist/assets/{ganttDiagram-6RSMTGT7-DW_1tH7v.js → ganttDiagram-6RSMTGT7-D5CoNr7u.js} +1 -1
  27. package/dist/assets/{gitGraphDiagram-PVQCEYII-Mo99IrfD.js → gitGraphDiagram-PVQCEYII-wraCb0iO.js} +1 -1
  28. package/dist/assets/{graph-BqpC5g-G.js → graph-BlEwG9Ro.js} +1 -1
  29. package/dist/assets/{index-DfocQEE0.js → index-CE1ehTQn.js} +3 -3
  30. package/dist/assets/index-D9M5IzwO.css +1 -0
  31. package/dist/assets/{infoDiagram-5YYISTIA-BJvJda4j.js → infoDiagram-5YYISTIA-CLT2YJ_w.js} +1 -1
  32. package/dist/assets/{ishikawaDiagram-YF4QCWOH-Dl7ib9vb.js → ishikawaDiagram-YF4QCWOH-1WQ5ViOx.js} +1 -1
  33. package/dist/assets/{journeyDiagram-JHISSGLW-DmgxLRyA.js → journeyDiagram-JHISSGLW-CbYKANnV.js} +1 -1
  34. package/dist/assets/{kanban-definition-UN3LZRKU-DV6cN2Fc.js → kanban-definition-UN3LZRKU-CYNaaEmw.js} +1 -1
  35. package/dist/assets/{linear-ChPnBFTg.js → linear-C6l6Hee2.js} +1 -1
  36. package/dist/assets/{mindmap-definition-RKZ34NQL-C0dgdrrD.js → mindmap-definition-RKZ34NQL-DzXKDTRa.js} +1 -1
  37. package/dist/assets/mobile-4lQex-UI.js +17 -0
  38. package/dist/assets/mobile-D8UQvJ1i.css +1 -0
  39. package/dist/assets/{pieDiagram-4H26LBE5-N-HzAPPi.js → pieDiagram-4H26LBE5-CppszhAX.js} +1 -1
  40. package/dist/assets/{quadrantDiagram-W4KKPZXB-YEX6PyFG.js → quadrantDiagram-W4KKPZXB-jpp555QD.js} +1 -1
  41. package/dist/assets/{requirementDiagram-4Y6WPE33-CCpgQqwO.js → requirementDiagram-4Y6WPE33-nKJCyHfW.js} +1 -1
  42. package/dist/assets/{sankeyDiagram-5OEKKPKP-BSUvtggj.js → sankeyDiagram-5OEKKPKP-D-oX8o5g.js} +1 -1
  43. package/dist/assets/{sequenceDiagram-3UESZ5HK-Dh8UHRBI.js → sequenceDiagram-3UESZ5HK-CcOMecR8.js} +1 -1
  44. package/dist/assets/{stateDiagram-AJRCARHV-DKvZ4fLX.js → stateDiagram-AJRCARHV-D0yHv9PM.js} +1 -1
  45. package/dist/assets/stateDiagram-v2-BHNVJYJU-CFwFamMD.js +1 -0
  46. package/dist/assets/{timeline-definition-PNZ67QCA-qunNDnlH.js → timeline-definition-PNZ67QCA-hsR-T0Te.js} +1 -1
  47. package/dist/assets/{vennDiagram-CIIHVFJN-D5a-gmIU.js → vennDiagram-CIIHVFJN-C9b10oqu.js} +1 -1
  48. package/dist/assets/{wardley-L42UT6IY-akIUfw-F.js → wardley-L42UT6IY-BHnzDf0e.js} +1 -1
  49. package/dist/assets/{wardleyDiagram-YWT4CUSO-R1zmVC27.js → wardleyDiagram-YWT4CUSO-DReamCcN.js} +1 -1
  50. package/dist/assets/{xychartDiagram-2RQKCTM6-Do2YVGeZ.js → xychartDiagram-2RQKCTM6-CrSsH0ZL.js} +1 -1
  51. package/dist/index.html +4 -4
  52. package/package.json +1 -1
  53. package/server/graph-export.js +8 -3
  54. package/server/journal-routes.js +130 -0
  55. package/server/vision-routes.js +2 -66
  56. package/server/vision-server.js +9 -2
  57. package/dist/assets/App-BD4lfyhF.js +0 -686
  58. package/dist/assets/channel-C0cFeemU.js +0 -1
  59. package/dist/assets/classDiagram-4FO5ZUOK-7kNnlTD1.js +0 -1
  60. package/dist/assets/classDiagram-v2-Q7XG4LA2-7kNnlTD1.js +0 -1
  61. package/dist/assets/index-vDKys15R.css +0 -1
  62. package/dist/assets/mobile-5PV1E6OC.css +0 -1
  63. package/dist/assets/mobile-DAxPPzok.js +0 -17
  64. package/dist/assets/stateDiagram-v2-BHNVJYJU-DF_adEfb.js +0 -1
@@ -1,686 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-BM42HDAG-DBwRZbPz.js","assets/graph-CAnANduQ.js","assets/layout-DGIYPm2g.js","assets/mobile-DAxPPzok.js","assets/mobile-5PV1E6OC.css","assets/index-DfocQEE0.js","assets/index-vDKys15R.css","assets/graph-BqpC5g-G.js","assets/cose-bilkent-S5V4N54A-BC5rkVLI.js","assets/c4Diagram-AAUBKEIU-CIZ7QDGR.js","assets/chunk-ND2GUHAM-gkRIeuOg.js","assets/flowDiagram-I6XJVG4X-D84i8zUb.js","assets/chunk-FMBD7UC4-mPSIpSeS.js","assets/chunk-55IACEB6-D18v8dR4.js","assets/chunk-2J33WTMH-COBZ5eyU.js","assets/channel-C0cFeemU.js","assets/erDiagram-TEJ5UH35-BuNJLn2I.js","assets/gitGraphDiagram-PVQCEYII-Mo99IrfD.js","assets/chunk-4BX2VUAB-w3bqdoNF.js","assets/chunk-QZHKN3VN-DJ7h7c2i.js","assets/wardley-L42UT6IY-akIUfw-F.js","assets/ganttDiagram-6RSMTGT7-DW_1tH7v.js","assets/linear-ChPnBFTg.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-5YYISTIA-BJvJda4j.js","assets/pieDiagram-4H26LBE5-N-HzAPPi.js","assets/arc-fd_r6IIl.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-W4KKPZXB-YEX6PyFG.js","assets/xychartDiagram-2RQKCTM6-Do2YVGeZ.js","assets/requirementDiagram-4Y6WPE33-CCpgQqwO.js","assets/sequenceDiagram-3UESZ5HK-Dh8UHRBI.js","assets/classDiagram-4FO5ZUOK-7kNnlTD1.js","assets/chunk-727SXJPM-2MAwFz_9.js","assets/classDiagram-v2-Q7XG4LA2-7kNnlTD1.js","assets/stateDiagram-AJRCARHV-DKvZ4fLX.js","assets/chunk-AQP2D5EJ-Dp_jdVPB.js","assets/stateDiagram-v2-BHNVJYJU-DF_adEfb.js","assets/journeyDiagram-JHISSGLW-DmgxLRyA.js","assets/timeline-definition-PNZ67QCA-qunNDnlH.js","assets/mindmap-definition-RKZ34NQL-C0dgdrrD.js","assets/kanban-definition-UN3LZRKU-DV6cN2Fc.js","assets/sankeyDiagram-5OEKKPKP-BSUvtggj.js","assets/diagram-LMA3HP47-pmYhkUAj.js","assets/diagram-2AECGRRQ-CmljsTYt.js","assets/blockDiagram-GPEHLZMM-Dm-THFZ6.js","assets/diagram-5GNKFQAL-Pcdh-Hev.js","assets/architectureDiagram-3BPJPVTR-UehcfvE8.js","assets/diagram-KO2AKTUF-CrEqfa_s.js","assets/ishikawaDiagram-YF4QCWOH-Dl7ib9vb.js","assets/vennDiagram-CIIHVFJN-D5a-gmIU.js","assets/diagram-OG6HWLK6-1mWNdTnP.js","assets/wardleyDiagram-YWT4CUSO-R1zmVC27.js"])))=>i.map(i=>d[i]);
2
- var nS=Object.defineProperty;var iS=(t,e,r)=>e in t?nS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Jt=(t,e,r)=>iS(t,typeof e!="symbol"?e+"":e,r);import{a as k,j as c,b as qt,d as sS,g as xd,w as Mt,e as oS,f as Ki,h as aS}from"./mobile-DAxPPzok.js";import{c as jt,a as st,b as lS,u as js,P as Ns,d as ic,e as cS,f as ci,g as ii,h as hS,I as yd,B as Pt,X as yn,_ as Yt,i as Yx,D as bd,j as Cd,k as kd,l as vd,m as Gx,r as uS,n as dS,o as Vx,p as pS}from"./index-DfocQEE0.js";import{c as Ko,b as Xx,f as fS}from"./graph-BqpC5g-G.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 mS=[["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"}]],wd=jt("activity",mS);/**
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 gS=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],xS=jt("arrow-down-to-line",gS);/**
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 yS=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],bS=jt("arrow-left",yS);/**
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 CS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Kx=jt("arrow-right",CS);/**
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 kS=[["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"}]],vS=jt("bell",kS);/**
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 wS=[["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=jt("bot",wS);/**
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 SS=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],TS=jt("chart-no-axes-column",SS);/**
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 _S=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Qo=jt("check",_S);/**
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 jS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Es=jt("chevron-down",jS);/**
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 NS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Qx=jt("chevron-left",NS);/**
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 ES=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pi=jt("chevron-right",ES);/**
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 BS=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Zx=jt("chevron-up",BS);/**
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 LS=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],AS=jt("circle-check-big",LS);/**
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 MS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Jx=jt("circle-check",MS);/**
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 IS=[["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"}]],FS=jt("circle-x",IS);/**
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 DS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],PS=jt("circle",DS);/**
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 OS=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],t0=jt("clock",OS);/**
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 $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"}]],Sd=jt("cpu",$S);/**
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 RS=[["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"}]],e0=jt("eye",RS);/**
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 zS=[["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"}]],wi=jt("file-text",zS);/**
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 WS=[["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"}]],qS=jt("folder-open",WS);/**
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 HS=[["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"}]],Td=jt("folder",HS);/**
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 US=[["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"}]],YS=jt("funnel",US);/**
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 GS=[["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"}]],r0=jt("git-branch",GS);/**
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 VS=[["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"}]],Gh=jt("history",VS);/**
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 XS=[["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"}]],KS=jt("inbox",XS);/**
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 QS=[["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"}]],ZS=jt("layers",QS);/**
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 JS=[["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"}]],tT=jt("layout-dashboard",JS);/**
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 eT=[["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"}]],fi=jt("lightbulb",eT);/**
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 rT=[["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"}]],nT=jt("link-2",rT);/**
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 iT=[["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"}]],sT=jt("list",iT);/**
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 oT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],n0=jt("loader-circle",oT);/**
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 aT=[["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"}]],sc=jt("message-square",aT);/**
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 lT=[["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"}]],cT=jt("moon",lT);/**
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 hT=[["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"}]],uT=jt("network",hT);/**
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 dT=[["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"}]],i0=jt("pencil",dT);/**
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 pT=[["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"}]],fT=jt("play",pT);/**
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 mT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Vh=jt("plus",mT);/**
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 gT=[["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"}]],hl=jt("refresh-cw",gT);/**
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 xT=[["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"}]],yT=jt("save",xT);/**
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 bT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],bn=jt("search",bT);/**
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 CT=[["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"}]],_d=jt("send",CT);/**
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 kT=[["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"}]],Bs=jt("shield-check",kT);/**
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 vT=[["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"}]],wT=jt("shield",vT);/**
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 ST=[["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"}]],s0=jt("skip-forward",ST);/**
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 TT=[["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"}]],af=jt("sparkles",TT);/**
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 _T=[["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"}]],jT=jt("star",_T);/**
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 NT=[["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"}]],ET=jt("sun",NT);/**
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 BT=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],LT=jt("terminal",BT);/**
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 AT=[["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"}]],lf=jt("trash-2",AT);/**
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 MT=[["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"}]],oc=jt("triangle-alert",MT);/**
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 IT=[["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"}]],jd=jt("user",IT);/**
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 FT=[["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"}]],DT=jt("workflow",FT);/**
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 PT=[["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"}]],ul=jt("zap",PT),mr={feature:"#3b82f6",bug:"#ef4444",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},On={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b",superseded:"#6b5b8a"},OT=["planned","ready","in_progress","review","complete","blocked","parked","killed","superseded"],o0=["vision","specification","planning","implementation","verification","release"],dl={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},Nd=["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"},a0={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},l0=["claude","codex","gemini","human","unassigned"],cf={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"},Oc=[{id:"explore_design",name:"Explore Design",agent:"claude",phase:"design",hasGate:!1},{id:"design_review",name:"Design Review",agent:"codex",phase:"design",hasGate:!1},{id:"design_gate",name:"Design Gate",agent:"human",phase:"design",hasGate:!0},{id:"prd",name:"PRD",agent:"claude",phase:"design",hasGate:!1},{id:"prd_review",name:"PRD Review",agent:"codex",phase:"design",hasGate:!1},{id:"prd_gate",name:"PRD Gate",agent:"human",phase:"design",hasGate:!0},{id:"architecture",name:"Architecture",agent:"claude",phase:"design",hasGate:!1},{id:"architecture_review",name:"Arch Review",agent:"codex",phase:"design",hasGate:!1},{id:"architecture_gate",name:"Arch Gate",agent:"human",phase:"design",hasGate:!0},{id:"blueprint",name:"Blueprint",agent:"claude",phase:"blueprint",hasGate:!1},{id:"verification",name:"Verification",agent:"claude",phase:"blueprint",hasGate:!1},{id:"blueprint_review",name:"BP Review",agent:"codex",phase:"blueprint",hasGate:!1},{id:"plan",name:"Plan",agent:"claude",phase:"implementation",hasGate:!1},{id:"plan_review",name:"Plan Review",agent:"codex",phase:"implementation",hasGate:!1},{id:"plan_gate",name:"Plan Gate",agent:"human",phase:"implementation",hasGate:!0},{id:"execute",name:"Execute",agent:"claude",phase:"implementation",hasGate:!1},{id:"review",name:"Review Loop",agent:"codex",phase:"implementation",hasGate:!1},{id:"coverage",name:"Coverage Sweep",agent:"claude",phase:"implementation",hasGate:!1},{id:"report",name:"Report",agent:"claude",phase:"ship",hasGate:!1},{id:"report_review",name:"Report Review",agent:"codex",phase:"ship",hasGate:!1},{id:"report_gate",name:"Report Gate",agent:"human",phase:"ship",hasGate:!0},{id:"docs",name:"Docs",agent:"claude",phase:"ship",hasGate:!1},{id:"ship",name:"Ship",agent:"claude",phase:"ship",hasGate:!1},{id:"ship_gate",name:"Ship Gate",agent:"human",phase:"ship",hasGate:!0}],mn={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 Io(t,e){const r=mn[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 hf={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"}},$T={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%)"},uf={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},RT={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"},zT={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"}},WT={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},df=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],qT={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},HT={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},UT={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},pf={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))"},c0={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 YT(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function GT(t){return`violations (${Array.isArray(t)?t.length:0})`}function VT(t){return t?"▾":"▸"}function XT({violations:t=[],expanded:e,onToggle:r}){const[n,i]=k.useState(!1),s=e!==void 0,o=s?e:n,a=YT(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const h=VT(o),u=GT(t);return c.jsxs("div",{style:{background:"hsl(38 90% 50% / 0.06)",borderLeft:"2px solid hsl(38 90% 50% / 0.3)",borderRadius:"3px",marginTop:"4px"},children:[c.jsxs("div",{onClick:l,style:{display:"flex",alignItems:"center",gap:"4px",padding:"3px 8px",cursor:"pointer",color:"hsl(38 90% 70%)",fontSize:"10px",fontFamily:"monospace",userSelect:"none"},children:[c.jsx("span",{style:{opacity:.7},children:h}),c.jsx("span",{children:u})]}),a==="expanded"&&c.jsx("ul",{style:{listStyle:"none",margin:0,padding:"0 8px 6px 16px"},children:t.map((d,f)=>c.jsx("li",{style:{color:"hsl(38 50% 60%)",fontSize:"10px",fontFamily:"monospace",lineHeight:"1.5"},children:d},f))})]})}function KT({msg:t,mode:e="stream"}){const[r,n]=k.useState(!1),i=t.retries??0,s=t.violations??[],o=s.length>0;return e==="strip"?i===0?null:c.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:i}):c.jsxs("div",{className:"text-[10px] py-0.5",children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsxs("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.7},children:["step complete -- ",t.stepId]}),i>0&&c.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?c.jsxs("span",{onClick:()=>n(a=>!a),style:{color:"hsl(38 90% 60%)",fontSize:"10px",cursor:"pointer"},children:[s.length," ",s.length===1?"violation":"violations"]}):c.jsx("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.4,fontSize:"10px"},children:"✓ checks passed"})]}),r&&o&&c.jsx(XT,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const QT=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,ff=20;function ZT({summary:t,output:e}){const[r,n]=k.useState(!1),[i,s]=k.useState(!1),o=e?QT.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
273
- `):[],h=l.length>ff,u=r&&!i&&h?l.slice(0,ff):l,d=o?"hsl(var(--destructive, 0 84% 60%))":"hsl(215 20% 20%)";return a?c.jsxs("div",{style:{marginLeft:8,borderLeft:`1px solid ${d}`,paddingLeft:8,marginTop:2},children:[c.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:[c.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),t]}),r&&c.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(`
274
- `),!i&&h&&c.jsxs(c.Fragment,{children:[`
275
- `,c.jsxs("span",{onClick:f=>{f.stopPropagation(),s(!0)},style:{color:"hsl(var(--accent))",cursor:"pointer",textDecoration:"underline",fontSize:"10px"},children:["Show all (",l.length," lines)"]})]})]})]}):c.jsx("div",{style:{marginLeft:8,opacity:.6,fontSize:"10px",padding:"2px 0",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:t})}const JT={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 t_(t){return $T[JT[t]||"thinking"]}function e_(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function r_(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function n_({input:t}){const[e,r]=k.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 c.jsxs("div",{className:"mt-1",children:[c.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:[c.jsx("span",{style:{opacity:.6},children:e?"▾":"▸"}),!e&&c.jsxs("span",{style:{opacity:.6},children:[n,": ",s]}),e&&c.jsx("span",{style:{opacity:.6},children:"collapse"})]}),e&&c.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 i_({block:t}){const e=t_(t.name);return c.jsxs("div",{className:"rounded px-2 py-1.5 my-1",style:{background:"hsl(var(--muted) / 0.3)",borderLeft:`2px solid ${e}`},children:[c.jsx("div",{className:"flex items-center gap-1.5",children:c.jsx("span",{className:"text-[11px] font-semibold font-mono",style:{color:e},children:t.name})}),c.jsx(n_,{input:t.input})]})}function s_({msg:t}){var r;const e=((r=t.message)==null?void 0:r.content)??[];return c.jsx("div",{className:"flex flex-col gap-1 py-1",children:e.map((n,i)=>{if(n.type==="text")return c.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 c.jsxs(qt.Fragment,{children:[c.jsx(i_,{block:n}),s&&t._toolResult&&c.jsx(ZT,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function o_({msg:t}){const e=t.subtype!=="success",r=e?"hsl(var(--destructive))":"hsl(var(--success, 142 60% 50%))";return c.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:[c.jsx("span",{children:e?"✗ error":"✓ done"}),!e&&t.num_turns!=null&&c.jsxs("span",{style:{color:"hsl(var(--muted-foreground))"},children:[t.num_turns," turn",t.num_turns!==1?"s":""]}),t.duration_ms!=null&&c.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:e_(t.duration_ms)}),t.total_cost_usd!=null&&c.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:r_(t.total_cost_usd)}),e&&t.errors&&c.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function a_({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:c.jsx("div",{className:"flex justify-end py-1",children:c.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 l_({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 c.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:[c.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 c.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-3 flex-wrap",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:[c.jsxs("span",{children:["session ",(e=t.session_id)==null?void 0:e.slice(0,8)]}),c.jsx("span",{children:t.model}),c.jsx("span",{children:t.permissionMode})]});if(t.type==="system"&&t.subtype==="connected")return c.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 c.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 c.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-2",style:{color:"hsl(var(--muted-foreground))"},children:[c.jsxs("span",{children:["step ",t.stepNum,"/",t.totalSteps]}),c.jsx("span",{className:"font-mono",children:t.stepId}),c.jsx("span",{style:{opacity:.5},children:t.agent})]});if(t.type==="system"&&t.subtype==="build_step_done")return c.jsx(KT,{msg:t,mode:"stream"});if(t.type==="system"&&t.subtype==="build_gate")return c.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 c.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 c.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:n},children:["build ",t.status," -- ",t.featureCode]})}return t.type==="assistant"?c.jsx(s_,{msg:t}):t.type==="user"?c.jsx(a_,{msg:t}):t.type==="result"?c.jsx(o_,{msg:t}):t.type==="error"?c.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 c_({onSend:t,disabled:e=!1,placeholder:r="Message Claude…"}){const n=k.useRef(null);k.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 l=a.value.trim();l&&(t(l),a.value="",i())}return c.jsxs("div",{className:"flex items-end gap-2 px-3 py-2",style:{borderTop:"1px solid hsl(var(--border))"},children:[c.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"}}),c.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 h0="compose:verboseStream",pl={verboseStream:!1};function u0(){return pl.verboseStream}function h_(t,e){pl.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(h0,String(pl.verboseStream))}catch{}}function u_(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(h0);r!==null&&(pl.verboseStream=r==="true")}catch{}}function d_(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 p_(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")),l=o&&(o.type==="tool_use_summary"||o.type==="assistant"&&o.subtype==="tool_use_summary");a&&l?(e.push({...s,_toolResult:o}),i++):e.push(s)}return e}const d0=parseInt("4002",10),f_="compose-agent-session",mf=500,m_=8,g_=2e3,p0=3e4,gf={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"},x_={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};u_();const J={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 y_(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=gf[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=gf[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 $c(t,e,r){const n=Date.now(),i=J.agentStatus,s=J.agentTool;if(J._idleTimer&&(clearTimeout(J._idleTimer),J._idleTimer=null),i==="working"&&(t==="idle"||e!==s)){const a=J.currentActivity;a&&(a.endTime=n,a.duration=n-a.startTime,J.activityLog.push(a),J.activityLog.length>m_&&J.activityLog.shift())}t==="working"&&e!==s?J.currentActivity={tool:e,category:r,startTime:n,endTime:null,duration:null}:t==="idle"&&(J.currentActivity=null),J.agentStatus=t,J.agentTool=e,J.agentCategory=r;const o={status:t,tool:e,category:r,activityLog:J.activityLog,currentActivity:J.currentActivity,parallelTasks:J.parallelTasks};J.onAgentStatusChange&&J.onAgentStatusChange({...o}),window.dispatchEvent(new CustomEvent("compose:agent-status",{detail:o}))}function xf(){const t=J.sourceStatus.build,e=J.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?$c(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?$c(t.status,t.tool,t.category):J._idleTimer=setTimeout(()=>{J._idleTimer=null,$c("idle",null,null)},g_)}function Xh(t){var i,s,o,a,l,h;t._source==="build"&&t.type==="system"&&t.parallel&&(t.subtype==="build_step"&&((i=t.stepNum)!=null&&i.toString().startsWith("∥"))?(J.parallelTasks||(J.parallelTasks={total:0,completed:0,failed:0,active:0,tasks:{}}),J.parallelTasks.total++,J.parallelTasks.active++,J.parallelTasks.tasks[t.stepId]="working"):t.subtype==="build_step_done"&&((o=(s=J.parallelTasks)==null?void 0:s.tasks)!=null&&o[t.stepId])?(J.parallelTasks.active=Math.max(0,J.parallelTasks.active-1),J.parallelTasks.completed++,J.parallelTasks.tasks[t.stepId]="complete"):t.subtype==="build_step_done"&&J.parallelTasks&&!((a=t.stepNum)!=null&&a.toString().startsWith("∥"))&&(J.parallelTasks=null)),t._source==="build"&&t.type==="error"&&((h=(l=J.parallelTasks)==null?void 0:l.tasks)!=null&&h[t.stepId])&&(J.parallelTasks.active=Math.max(0,J.parallelTasks.active-1),J.parallelTasks.failed++,J.parallelTasks.tasks[t.stepId]="failed");const e=y_(t);if(e){const u=e._source==="build"?"build":"interactive";J.sourceStatus[u]=e,e.status==="idle"?(J.parallelTasks=null,xf()):(J._idleTimer&&(clearTimeout(J._idleTimer),J._idleTimer=null),xf())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(J.sessionId=t.session_id,sessionStorage.setItem(f_,t.session_id));const{include:r,msg:n}=d_(t,u0());r&&(J.messages=[...J.messages,n],J.messages.length>mf&&(J.messages=J.messages.slice(-mf)),J.onMessagesChange&&J.onMessagesChange(J.messages))}function Rc(){if(J.es)return;const t=`${window.location.protocol}//${window.location.hostname}:${d0}/api/agent/stream`,e=sS({url:t,namedEvents:["hydrate"],onOpen:()=>{J.connected=!0,J.streamError=null,J.retryInfo=null,J.stalled=!1,J.sourceStatus.build=null,J.onConnectedChange&&J.onConnectedChange(!0),J.onStreamErrorChange&&J.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})},onClose:()=>{J.connected=!1,J.onConnectedChange&&J.onConnectedChange(!1)},onError:r=>{J.streamError=(r==null?void 0:r.message)||"Connection error",J.onStreamErrorChange&&J.onStreamErrorChange({error:J.streamError,retryInfo:J.retryInfo,stalled:J.stalled})},onRetry:r=>{J.retryInfo=r,J.onStreamErrorChange&&J.onStreamErrorChange({error:J.streamError,retryInfo:r,stalled:J.stalled})},onStall:()=>{J.stalled=!0,J.onStreamErrorChange&&J.onStreamErrorChange({error:J.streamError,retryInfo:J.retryInfo,stalled:!0})},onExhausted:()=>{J.es=null,J.retryInfo=null,J.onStreamErrorChange&&J.onStreamErrorChange({error:J.streamError,retryInfo:null,stalled:J.stalled})},onEvent:(r,n)=>{if((J.stalled||J.streamError)&&(J.stalled=!1,J.streamError=null,J.retryInfo=null,J.onStreamErrorChange&&J.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})),n==="hydrate"){if(Array.isArray(r))for(const i of r)Xh(i);return}Xh(r)},maxBackoffMs:8e3,maxRetries:5,stallTimeoutMs:p0});J.es=e}async function zc(t,e){const r=await fetch(`${window.location.protocol}//${window.location.hostname}:${d0}${t}`,{method:"POST",headers:{"Content-Type":"application/json","x-compose-token":""},body:JSON.stringify(e)});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||r.statusText)}return r.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 f0(){var A;const[t,e]=k.useState(J.connected),[r,n]=k.useState(J.messages),[i,s]=k.useState({status:J.agentStatus,tool:J.agentTool,category:J.agentCategory,activityLog:J.activityLog,currentActivity:J.currentActivity}),[o,a]=k.useState(!1),[l,h]=k.useState(null),[u,d]=k.useState({error:J.streamError,retryInfo:J.retryInfo,stalled:J.stalled}),f=k.useRef(null),p=k.useRef(null),m=k.useRef(!1),x=r.length===0||r.every(L=>L.type==="system"&&(L.subtype==="init"||L.subtype==="connected"));k.useEffect(()=>(J.onConnectedChange=e,J.onMessagesChange=n,J.onAgentStatusChange=s,J.onStreamErrorChange=d,()=>{J.onConnectedChange=null,J.onMessagesChange=null,J.onAgentStatusChange=null,J.onStreamErrorChange=null}),[]),k.useEffect(()=>{Rc()},[]);const g=k.useCallback(()=>{const L=p.current;if(!L)return;const j=L.scrollHeight-L.scrollTop-L.clientHeight<48;m.current=!j},[]);k.useEffect(()=>{var L;m.current||(L=f.current)==null||L.scrollIntoView({behavior:"smooth"})},[r.length]),k.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){h(null);return}const L=i.currentActivity.startTime,j=()=>h(Date.now()-L);j();const F=setInterval(j,1e3);return()=>clearInterval(F)},[i.status,(A=i.currentActivity)==null?void 0:A.startTime]);const y=k.useCallback(async L=>{a(!0);const j=L.match(/[A-Z]+-\d+/);j&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:j[0]}}));try{x||!J.sessionId?await zc("/api/agent/session",{prompt:L}):await zc("/api/agent/message",{prompt:L})}catch(F){Xh({type:"error",message:`Failed to send: ${F.message}`})}finally{a(!1)}},[x]),C=k.useCallback(async()=>{try{await zc("/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?x_[i.category]:null,S=t?b?_||"working":"ready":"offline",N=i.activityLog||[];return c.jsxs("div",{className:"relative w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[c.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:[c.jsx("div",{className:"flex items-center gap-0.5",children:t&&N.length>0&&N.slice(-5).map((L,j)=>c.jsx("div",{className:"h-1 rounded-full",title:`${L.tool||"thinking"} — ${yf(L.duration)}`,style:{width:Math.max(6,Math.min(20,(L.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+j/5*.5}},j))}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[b&&c.jsx("button",{onClick:C,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"}),c.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"}}),c.jsx("span",{className:"text-[10px] uppercase tracking-wider",style:{color:b?"#fbbf24":"hsl(var(--muted-foreground))"},children:S}),b&&i.tool&&c.jsx("span",{className:"text-[10px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:i.tool}),b&&l!=null&&c.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:yf(l)})]})]}),c.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&&c.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 opacity-40",children:[c.jsx("span",{className:"text-2xl",children:"⬡"}),c.jsx("span",{className:"text-xs uppercase tracking-widest",style:{color:"hsl(var(--muted-foreground))"},children:t?"ready":"connecting…"})]}),p_(r).map((L,j)=>c.jsx(l_,{msg:L},L.uuid||j)),c.jsx("div",{ref:f})]}),!t&&c.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:c.jsxs("div",{className:"flex flex-col items-center gap-3",role:"status","aria-live":"polite",children:[c.jsx("div",{className:"w-5 h-5 rounded-full animate-spin",style:{border:"2px solid hsl(var(--accent) / 0.2)",borderTopColor:"hsl(var(--accent))"}}),c.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&&c.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--destructive))"},children:u.error}),!J.es&&u.error&&c.jsx("button",{onClick:()=>{J.streamError=null,J.retryInfo=null,J.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),Rc()},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)&&c.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?c.jsxs(c.Fragment,{children:[c.jsxs("span",{children:["No data received for ",p0/1e3,"s — connection may be stalled."]}),c.jsx("button",{onClick:()=>{J.es&&(J.es.close(),J.es=null),J.connected=!1,J.onConnectedChange&&J.onConnectedChange(!1),J.streamError=null,J.retryInfo=null,J.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),Rc()},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"})]}):c.jsx("span",{children:u.error})}),c.jsx(c_,{onSend:y,disabled:b||!t,placeholder:b?"Working…":"Message Claude…"})]})}function b_(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const C_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,k_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,v_={};function bf(t,e){return(v_.jsx?k_:C_).test(t)}const w_=/[ \t\n\f\r]/g;function S_(t){return typeof t=="object"?t.type==="text"?Cf(t.value):!1:Cf(t)}function Cf(t){return t.replace(w_,"")===""}class Zo{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}Zo.prototype.normal={};Zo.prototype.property={};Zo.prototype.space=void 0;function m0(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new Zo(r,n,e)}function Kh(t){return t.toLowerCase()}class gr{constructor(e,r){this.attribute=r,this.property=e}}gr.prototype.attribute="";gr.prototype.booleanish=!1;gr.prototype.boolean=!1;gr.prototype.commaOrSpaceSeparated=!1;gr.prototype.commaSeparated=!1;gr.prototype.defined=!1;gr.prototype.mustUseProperty=!1;gr.prototype.number=!1;gr.prototype.overloadedBoolean=!1;gr.prototype.property="";gr.prototype.spaceSeparated=!1;gr.prototype.space=void 0;let T_=0;const Dt=Si(),Se=Si(),Qh=Si(),at=Si(),se=Si(),hi=Si(),br=Si();function Si(){return 2**++T_}const Zh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dt,booleanish:Se,commaOrSpaceSeparated:br,commaSeparated:hi,number:at,overloadedBoolean:Qh,spaceSeparated:se},Symbol.toStringTag,{value:"Module"})),Wc=Object.keys(Zh);class Ed extends gr{constructor(e,r,n,i){let s=-1;if(super(e,r),kf(this,"space",i),typeof n=="number")for(;++s<Wc.length;){const o=Wc[s];kf(this,Wc[s],(n&Zh[o])===Zh[o])}}}Ed.prototype.defined=!0;function kf(t,e,r){r&&(t[e]=r)}function Ls(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new Ed(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Kh(n)]=n,r[Kh(s.attribute)]=n}return new Zo(e,r,t.space)}const g0=Ls({properties:{ariaActiveDescendant:null,ariaAtomic:Se,ariaAutoComplete:null,ariaBusy:Se,ariaChecked:Se,ariaColCount:at,ariaColIndex:at,ariaColSpan:at,ariaControls:se,ariaCurrent:null,ariaDescribedBy:se,ariaDetails:null,ariaDisabled:Se,ariaDropEffect:se,ariaErrorMessage:null,ariaExpanded:Se,ariaFlowTo:se,ariaGrabbed:Se,ariaHasPopup:null,ariaHidden:Se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:se,ariaLevel:at,ariaLive:null,ariaModal:Se,ariaMultiLine:Se,ariaMultiSelectable:Se,ariaOrientation:null,ariaOwns:se,ariaPlaceholder:null,ariaPosInSet:at,ariaPressed:Se,ariaReadOnly:Se,ariaRelevant:null,ariaRequired:Se,ariaRoleDescription:se,ariaRowCount:at,ariaRowIndex:at,ariaRowSpan:at,ariaSelected:Se,ariaSetSize:at,ariaSort:null,ariaValueMax:at,ariaValueMin:at,ariaValueNow:at,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function x0(t,e){return e in t?t[e]:e}function y0(t,e){return x0(t,e.toLowerCase())}const __=Ls({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:hi,acceptCharset:se,accessKey:se,action:null,allow:null,allowFullScreen:Dt,allowPaymentRequest:Dt,allowUserMedia:Dt,alpha:Dt,alt:null,as:null,async:Dt,autoCapitalize:null,autoComplete:se,autoFocus:Dt,autoPlay:Dt,blocking:se,capture:null,charSet:null,checked:Dt,cite:null,className:se,closedBy:null,colorSpace:null,cols:at,colSpan:at,command:null,commandFor:null,content:null,contentEditable:Se,controls:Dt,controlsList:se,coords:at|hi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dt,defer:Dt,dir:null,dirName:null,disabled:Dt,download:Qh,draggable:Se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dt,formTarget:null,headers:se,height:at,hidden:Qh,high:at,href:null,hrefLang:null,htmlFor:se,httpEquiv:se,id:null,imageSizes:null,imageSrcSet:null,inert:Dt,inputMode:null,integrity:null,is:null,isMap:Dt,itemId:null,itemProp:se,itemRef:se,itemScope:Dt,itemType:se,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dt,low:at,manifest:null,max:null,maxLength:at,media:null,method:null,min:null,minLength:at,multiple:Dt,muted:Dt,name:null,nonce:null,noModule:Dt,noValidate:Dt,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:Dt,optimum:at,pattern:null,ping:se,placeholder:null,playsInline:Dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dt,referrerPolicy:null,rel:se,required:Dt,reversed:Dt,rows:at,rowSpan:at,sandbox:se,scope:null,scoped:Dt,seamless:Dt,selected:Dt,shadowRootClonable:Dt,shadowRootCustomElementRegistry:Dt,shadowRootDelegatesFocus:Dt,shadowRootMode:null,shadowRootSerializable:Dt,shape:null,size:at,sizes:null,slot:null,span:at,spellCheck:Se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:at,step:null,style:null,tabIndex:at,target:null,title:null,translate:null,type:null,typeMustMatch:Dt,useMap:null,value:Se,width:at,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:se,axis:null,background:null,bgColor:null,border:at,borderColor:null,bottomMargin:at,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dt,declare:Dt,event:null,face:null,frame:null,frameBorder:null,hSpace:at,leftMargin:at,link:null,longDesc:null,lowSrc:null,marginHeight:at,marginWidth:at,noResize:Dt,noHref:Dt,noShade:Dt,noWrap:Dt,object:null,profile:null,prompt:null,rev:null,rightMargin:at,rules:null,scheme:null,scrolling:Se,standby:null,summary:null,text:null,topMargin:at,valueType:null,version:null,vAlign:null,vLink:null,vSpace:at,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Dt,disablePictureInPicture:Dt,disableRemotePlayback:Dt,exportParts:hi,part:se,prefix:null,property:null,results:at,security:null,unselectable:null},space:"html",transform:y0}),j_=Ls({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",maskType:"mask-type",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:br,accentHeight:at,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:at,amplitude:at,arabicForm:null,ascent:at,attributeName:null,attributeType:null,azimuth:at,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:at,by:null,calcMode:null,capHeight:at,className:se,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:at,diffuseConstant:at,direction:null,display:null,dur:null,divisor:at,dominantBaseline:null,download:Dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:at,enableBackground:null,end:null,event:null,exponent:at,externalResourcesRequired:null,fill:null,fillOpacity:at,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:hi,g2:hi,glyphName:hi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:at,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:at,horizOriginX:at,horizOriginY:at,id:null,ideographic:at,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:at,k:at,k1:at,k2:at,k3:at,k4:at,kernelMatrix:br,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:at,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:at,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:at,overlineThickness:at,paintOrder:null,panose1:null,path:null,pathLength:at,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:se,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:at,pointsAtY:at,pointsAtZ:at,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:br,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:br,rev:br,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:br,requiredFeatures:br,requiredFonts:br,requiredFormats:br,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:at,specularExponent:at,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:at,strikethroughThickness:at,string:null,stroke:null,strokeDashArray:br,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:at,strokeOpacity:at,strokeWidth:null,style:null,surfaceScale:at,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:br,tabIndex:at,tableValues:null,target:null,targetX:at,targetY:at,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:br,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:at,underlineThickness:at,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:at,values:null,vAlphabetic:at,vMathematical:at,vectorEffect:null,vHanging:at,vIdeographic:at,version:null,vertAdvY:at,vertOriginX:at,vertOriginY:at,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:at,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:x0}),b0=Ls({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()}}),C0=Ls({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:y0}),k0=Ls({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),N_={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"},E_=/[A-Z]/g,vf=/-[a-z]/g,B_=/^data[-\w.:]+$/i;function L_(t,e){const r=Kh(e);let n=e,i=gr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&B_.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(vf,M_);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!vf.test(s)){let o=s.replace(E_,A_);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Ed}return new i(n,e)}function A_(t){return"-"+t.toLowerCase()}function M_(t){return t.charAt(1).toUpperCase()}const I_=m0([g0,__,b0,C0,k0],"html"),Bd=m0([g0,j_,b0,C0,k0],"svg");function F_(t){return t.join(" ").trim()}var Bi={},qc,wf;function D_(){if(wf)return qc;wf=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
276
- `,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 C=1,b=1;function w(P){var I=P.match(e);I&&(C+=I.length);var M=P.lastIndexOf(l);b=~M?P.length-M:b+P.length}function _(){var P={line:C,column:b};return function(I){return I.position=new S(P),L(),I}}function S(P){this.start=P,this.end={line:C,column:b},this.source=y.source}S.prototype.content=g;function N(P){var I=new Error(y.source+":"+C+":"+b+": "+P);if(I.reason=P,I.filename=y.source,I.line=C,I.column=b,I.source=g,!y.silent)throw I}function A(P){var I=P.exec(g);if(I){var M=I[0];return w(M),g=g.slice(M.length),I}}function L(){A(r)}function j(P){var I;for(P=P||[];I=F();)I!==!1&&P.push(I);return P}function F(){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 N("End of comment missing");var M=g.slice(2,I-2);return b+=2,w(M),g=g.slice(I),b+=2,P({type:f,comment:M})}}function z(){var P=_(),I=A(n);if(I){if(F(),!A(i))return N("property missing ':'");var M=A(s),O=P({type:p,property:x(I[0].replace(t,d)),value:M?x(M[0].replace(t,d)):d});return A(o),O}}function W(){var P=[];j(P);for(var I;I=z();)I!==!1&&(P.push(I),j(P));return P}return L(),W()}function x(g){return g?g.replace(a,d):d}return qc=m,qc}var Sf;function P_(){if(Sf)return Bi;Sf=1;var t=Bi&&Bi.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.default=r;const e=t(D_());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(l=>{if(l.type!=="declaration")return;const{property:h,value:u}=l;a?i(h,u,l):u&&(s=s||{},s[h]=u)}),s}return Bi}var Ys={},Tf;function O_(){if(Tf)return Ys;Tf=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.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,"-")},l=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 Ys.camelCase=l,Ys}var Gs,_f;function $_(){if(_f)return Gs;_f=1;var t=Gs&&Gs.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(P_()),r=O_();function n(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,l){a&&l&&(o[(0,r.camelCase)(a,s)]=l)}),o}return n.default=n,Gs=n,Gs}var R_=$_();const z_=xd(R_),v0=w0("end"),Ld=w0("start");function w0(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 W_(t){const e=Ld(t),r=v0(t);if(e&&r)return{start:e,end:r}}function vo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?jf(t.position):"start"in t||"end"in t?jf(t):"line"in t||"column"in t?Jh(t):""}function Jh(t){return Nf(t&&t.line)+":"+Nf(t&&t.column)}function jf(t){return Jh(t&&t.start)+"-"+Jh(t&&t.end)}function Nf(t){return t&&typeof t=="number"?t:1}class Ge 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 l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.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=vo(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}}Ge.prototype.file="";Ge.prototype.name="";Ge.prototype.reason="";Ge.prototype.message="";Ge.prototype.stack="";Ge.prototype.column=void 0;Ge.prototype.line=void 0;Ge.prototype.ancestors=void 0;Ge.prototype.cause=void 0;Ge.prototype.fatal=void 0;Ge.prototype.place=void 0;Ge.prototype.ruleId=void 0;Ge.prototype.source=void 0;const Ad={}.hasOwnProperty,q_=new Map,H_=/[A-Z]/g,U_=new Set(["table","tbody","thead","tfoot","tr"]),Y_=new Set(["td","th"]),S0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function G_(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=ej(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=tj(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"?Bd:I_,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=T0(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function T0(t,e,r){if(e.type==="element")return V_(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return X_(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Q_(t,e,r);if(e.type==="mdxjsEsm")return K_(t,e);if(e.type==="root")return Z_(t,e,r);if(e.type==="text")return J_(t,e)}function V_(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=Bd,t.schema=i),t.ancestors.push(e);const s=j0(t,e.tagName,!1),o=rj(t,e);let a=Id(t,e);return U_.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!S_(l):!0})),_0(t,o,s,e),Md(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function X_(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)}Fo(t,e.position)}function K_(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Fo(t,e.position)}function Q_(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=Bd,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:j0(t,e.name,!0),o=nj(t,e),a=Id(t,e);return _0(t,o,s,e),Md(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function Z_(t,e,r){const n={};return Md(n,Id(t,e)),t.create(e,t.Fragment,n,r)}function J_(t,e){return e.value}function _0(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function Md(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function tj(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 ej(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=Ld(n);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function rj(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&Ad.call(e.properties,i)){const s=ij(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Y_.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 nj(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 Fo(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 Fo(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Id(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:q_;for(;++n<e.children.length;){const s=e.children[n];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const h=i.get(l)||0;o=l+"-"+h,i.set(l,h+1)}}const a=T0(t,s,o);a!==void 0&&r.push(a)}return r}function ij(t,e,r){const n=L_(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?b_(r):F_(r)),n.property==="style"){let i=typeof r=="object"?r:sj(t,String(r));return t.stylePropertyNameCase==="css"&&(i=oj(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?N_[n.property]||n.property:n.attribute,r]}}function sj(t,e){try{return z_(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Ge("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=S0+"#cannot-parse-style-attribute",i}}function j0(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=bf(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=bf(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return Ad.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Fo(t)}function Fo(t,e){const r=new Ge("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=S0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function oj(t){const e={};let r;for(r in t)Ad.call(t,r)&&(e[aj(r)]=t[r]);return e}function aj(t){let e=t.replace(H_,lj);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function lj(t){return"-"+t.toLowerCase()}const Hc={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"]},cj={};function Fd(t,e){const r=cj,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return N0(t,n,i)}function N0(t,e,r){if(hj(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 Ef(t.children,e,r)}return Array.isArray(t)?Ef(t,e,r):""}function Ef(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=N0(t[i],e,r);return n.join("")}function hj(t){return!!(t&&typeof t=="object")}const Bf=document.createElement("i");function Dd(t){const e="&"+t+";";Bf.innerHTML=e;const r=Bf.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function Cr(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 _r(t,e){return t.length>0?(Cr(t,t.length,0,e),t):e}const Lf={}.hasOwnProperty;function E0(t){const e={};let r=-1;for(;++r<t.length;)uj(e,t[r]);return e}function uj(t,e){let r;for(r in e){const i=(Lf.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Lf.call(i,o)||(i[o]=[]);const a=s[o];dj(i[o],Array.isArray(a)?a:a?[a]:[])}}}function dj(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);Cr(t,0,0,n)}function B0(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 Or(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Je=Un(/[A-Za-z]/),Ue=Un(/[\dA-Za-z]/),pj=Un(/[#-'*+\--9=?A-Z^-~]/);function fl(t){return t!==null&&(t<32||t===127)}const tu=Un(/\d/),fj=Un(/[\dA-Fa-f]/),mj=Un(/[!-/:-@[-`{-~]/);function Nt(t){return t!==null&&t<-2}function ae(t){return t!==null&&(t<0||t===32)}function Ht(t){return t===-2||t===-1||t===32}const ac=Un(new RegExp("\\p{P}|\\p{S}","u")),mi=Un(/\s/);function Un(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function As(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&Ue(t.charCodeAt(r+1))&&Ue(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 Vt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ht(l)?(t.enter(r),a(l)):e(l)}function a(l){return Ht(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const gj={tokenize:xj};function xj(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"),Vt(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=l),r=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return Nt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const yj={tokenize:bj},Af={tokenize:Cj};function bj(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,l,h)(b)}return h(b)}function l(b){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&C();const w=e.events.length;let _=w,S;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){S=e.events[_][1].end;break}y(n);let N=w;for(;N<e.events.length;)e.events[N][1].end={...S},N++;return Cr(e.events,_+1,0,e.events.slice(w)),e.events.length=N,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(Af,u,d)(b)}function u(b){return i&&C(),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(Af,p,m)(b)}function p(b){return n++,r.push([e.currentConstruct,e.containerState]),f(b)}function m(b){if(b===null){i&&C(),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 Nt(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 S=i.events.length;for(;S--;)if(i.events[S][1].start.offset<o&&(!i.events[S][1].end||i.events[S][1].end.offset>o))return;const N=e.events.length;let A=N,L,j;for(;A--;)if(e.events[A][0]==="exit"&&e.events[A][1].type==="chunkFlow"){if(L){j=e.events[A][1].end;break}L=!0}for(y(n),S=N;S<e.events.length;)e.events[S][1].end={...j},S++;Cr(e.events,A+1,0,e.events.slice(N)),e.events.length=S}}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 C(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Cj(t,e,r){return Vt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function gs(t){if(t===null||ae(t)||mi(t))return 1;if(ac(t))return 2}function lc(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 eu={name:"attention",resolveAll:kj,tokenize:vj};function kj(t,e){let r=-1,n,i,s,o,a,l,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;l=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};Mf(d,-l),Mf(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...t[n][1].end},end:{...t[r][1].start}},i={type:l>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=_r(h,[["enter",t[n][1],e],["exit",t[n][1],e]])),h=_r(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=_r(h,lc(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),h=_r(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=_r(h,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,Cr(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 vj(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=gs(n);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const h=t.exit("attentionSequence"),u=gs(l),d=!u||u===2&&i||r.includes(l),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(l)}}function Mf(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const wj={name:"autolink",tokenize:Sj};function Sj(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 Je(p)?(t.consume(p),o):p===64?r(p):h(p)}function o(p){return p===43||p===45||p===46||Ue(p)?(n=1,a(p)):h(p)}function a(p){return p===58?(t.consume(p),n=0,l):(p===43||p===45||p===46||Ue(p))&&n++<32?(t.consume(p),a):(n=0,h(p))}function l(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||fl(p)?r(p):(t.consume(p),l)}function h(p){return p===64?(t.consume(p),u):pj(p)?(t.consume(p),h):r(p)}function u(p){return Ue(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||Ue(p))&&n++<63){const m=p===45?f:d;return t.consume(p),m}return r(p)}}const Jo={partial:!0,tokenize:Tj};function Tj(t,e,r){return n;function n(s){return Ht(s)?Vt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Nt(s)?e(s):r(s)}}const L0={continuation:{tokenize:jj},exit:Nj,name:"blockQuote",tokenize:_j};function _j(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 Ht(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function jj(t,e,r){const n=this;return i;function i(o){return Ht(o)?Vt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(L0,e,r)(o)}}function Nj(t){t.exit("blockQuote")}const A0={name:"characterEscape",tokenize:Ej};function Ej(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 mj(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const M0={name:"characterReference",tokenize:Bj};function Bj(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"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),h):(t.enter("characterReferenceValue"),s=31,o=Ue,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=fj,u):(t.enter("characterReferenceValue"),s=7,o=tu,u(d))}function u(d){if(d===59&&i){const f=t.exit("characterReferenceValue");return o===Ue&&!Dd(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 If={partial:!0,tokenize:Aj},Ff={concrete:!0,name:"codeFenced",tokenize:Lj};function Lj(t,e,r){const n=this,i={partial:!0,tokenize:_};let s=0,o=0,a;return l;function l(S){return h(S)}function h(S){const N=n.events[n.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=S,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(S)}function u(S){return S===a?(o++,t.consume(S),u):o<3?r(S):(t.exit("codeFencedFenceSequence"),Ht(S)?Vt(t,d,"whitespace")(S):d(S))}function d(S){return S===null||Nt(S)?(t.exit("codeFencedFence"),n.interrupt?e(S):t.check(If,x,w)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(S))}function f(S){return S===null||Nt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(S)):Ht(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Vt(t,p,"whitespace")(S)):S===96&&S===a?r(S):(t.consume(S),f)}function p(S){return S===null||Nt(S)?d(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||Nt(S)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(S)):S===96&&S===a?r(S):(t.consume(S),m)}function x(S){return t.attempt(i,w,g)(S)}function g(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),y}function y(S){return s>0&&Ht(S)?Vt(t,C,"linePrefix",s+1)(S):C(S)}function C(S){return S===null||Nt(S)?t.check(If,x,w)(S):(t.enter("codeFlowValue"),b(S))}function b(S){return S===null||Nt(S)?(t.exit("codeFlowValue"),C(S)):(t.consume(S),b)}function w(S){return t.exit("codeFenced"),e(S)}function _(S,N,A){let L=0;return j;function j(I){return S.enter("lineEnding"),S.consume(I),S.exit("lineEnding"),F}function F(I){return S.enter("codeFencedFence"),Ht(I)?Vt(S,z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):z(I)}function z(I){return I===a?(S.enter("codeFencedFenceSequence"),W(I)):A(I)}function W(I){return I===a?(L++,S.consume(I),W):L>=o?(S.exit("codeFencedFenceSequence"),Ht(I)?Vt(S,P,"whitespace")(I):P(I)):A(I)}function P(I){return I===null||Nt(I)?(S.exit("codeFencedFence"),N(I)):A(I)}}}function Aj(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 Uc={name:"codeIndented",tokenize:Ij},Mj={partial:!0,tokenize:Fj};function Ij(t,e,r){const n=this;return i;function i(h){return t.enter("codeIndented"),Vt(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?l(h):Nt(h)?t.attempt(Mj,o,l)(h):(t.enter("codeFlowValue"),a(h))}function a(h){return h===null||Nt(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),a)}function l(h){return t.exit("codeIndented"),e(h)}}function Fj(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Nt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Vt(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):Nt(o)?i(o):r(o)}}const Dj={name:"codeText",previous:Oj,resolve:Pj,tokenize:$j};function Pj(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 Oj(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function $j(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"),l(d))}function l(d){return d===null?r(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,u(d)):Nt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),h(d))}function h(d){return d===null||d===32||d===96||Nt(d)?(t.exit("codeTextData"),l(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 Rj{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&&Vs(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),Vs(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Vs(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);Vs(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Vs(this.left,r.reverse())}}}function Vs(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 I0(t){const e={};let r=-1,n,i,s,o,a,l,h;const u=new Rj(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"&&(l=n[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,zj(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 Cr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!h}function zj(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,l=[],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]),C=s.pop();l.push([C,C+y.length-1]),t.splice(C,2,y)}for(l.reverse(),f=-1;++f<l.length;)h[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return h}const Wj={resolve:Hj,tokenize:Uj},qj={partial:!0,tokenize:Yj};function Hj(t){return I0(t),t}function Uj(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):Nt(a)?t.check(qj,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 Yj(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Vt(t,s,"linePrefix")}function s(o){if(o===null||Nt(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 F0(t,e,r,n,i,s,o,a,l){const h=l||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||fl(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||Nt(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||fl(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 D0(t,e,r,n,i,s){const o=this;let a=0,l;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&&!l||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):Nt(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||Nt(p)||a++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!Ht(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(t.consume(p),a++,d):d(p)}}function P0(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,l):r(f)}function l(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),l(o)):f===null?r(f):Nt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Vt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||Nt(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 wo(t,e){let r;return n;function n(i){return Nt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Ht(i)?Vt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const Gj={name:"definition",tokenize:Xj},Vj={partial:!0,tokenize:Kj};function Xj(t,e,r){const n=this;let i;return s;function s(p){return t.enter("definition"),o(p)}function o(p){return D0.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Or(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):r(p)}function l(p){return ae(p)?wo(t,h)(p):h(p)}function h(p){return F0(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(Vj,d,d)(p)}function d(p){return Ht(p)?Vt(t,f,"whitespace")(p):f(p)}function f(p){return p===null||Nt(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function Kj(t,e,r){return n;function n(a){return ae(a)?wo(t,i)(a):r(a)}function i(a){return P0(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ht(a)?Vt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Nt(a)?e(a):r(a)}}const Qj={name:"hardBreakEscape",tokenize:Zj};function Zj(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Nt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const Jj={name:"headingAtx",resolve:t5,tokenize:e5};function t5(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"},Cr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function e5(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"),l(u)):u===null||Nt(u)?(t.exit("atxHeading"),e(u)):Ht(u)?Vt(t,a,"whitespace")(u):(t.enter("atxHeadingText"),h(u))}function l(u){return u===35?(t.consume(u),l):(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 r5=["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"],Df=["pre","script","style","textarea"],n5={concrete:!0,name:"htmlFlow",resolveTo:o5,tokenize:a5},i5={partial:!0,tokenize:c5},s5={partial:!0,tokenize:l5};function o5(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 a5(t,e,r){const n=this;let i,s,o,a,l;return h;function h(D){return u(D)}function u(D){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(D),d}function d(D){return D===33?(t.consume(D),f):D===47?(t.consume(D),s=!0,x):D===63?(t.consume(D),i=3,n.interrupt?e:T):Je(D)?(t.consume(D),o=String.fromCharCode(D),g):r(D)}function f(D){return D===45?(t.consume(D),i=2,p):D===91?(t.consume(D),i=5,a=0,m):Je(D)?(t.consume(D),i=4,n.interrupt?e:T):r(D)}function p(D){return D===45?(t.consume(D),n.interrupt?e:T):r(D)}function m(D){const V="CDATA[";return D===V.charCodeAt(a++)?(t.consume(D),a===V.length?n.interrupt?e:z:m):r(D)}function x(D){return Je(D)?(t.consume(D),o=String.fromCharCode(D),g):r(D)}function g(D){if(D===null||D===47||D===62||ae(D)){const V=D===47,ht=o.toLowerCase();return!V&&!s&&Df.includes(ht)?(i=1,n.interrupt?e(D):z(D)):r5.includes(o.toLowerCase())?(i=6,V?(t.consume(D),y):n.interrupt?e(D):z(D)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(D):s?C(D):b(D))}return D===45||Ue(D)?(t.consume(D),o+=String.fromCharCode(D),g):r(D)}function y(D){return D===62?(t.consume(D),n.interrupt?e:z):r(D)}function C(D){return Ht(D)?(t.consume(D),C):j(D)}function b(D){return D===47?(t.consume(D),j):D===58||D===95||Je(D)?(t.consume(D),w):Ht(D)?(t.consume(D),b):j(D)}function w(D){return D===45||D===46||D===58||D===95||Ue(D)?(t.consume(D),w):_(D)}function _(D){return D===61?(t.consume(D),S):Ht(D)?(t.consume(D),_):b(D)}function S(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(t.consume(D),l=D,N):Ht(D)?(t.consume(D),S):A(D)}function N(D){return D===l?(t.consume(D),l=null,L):D===null||Nt(D)?r(D):(t.consume(D),N)}function A(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||ae(D)?_(D):(t.consume(D),A)}function L(D){return D===47||D===62||Ht(D)?b(D):r(D)}function j(D){return D===62?(t.consume(D),F):r(D)}function F(D){return D===null||Nt(D)?z(D):Ht(D)?(t.consume(D),F):r(D)}function z(D){return D===45&&i===2?(t.consume(D),M):D===60&&i===1?(t.consume(D),O):D===62&&i===4?(t.consume(D),G):D===63&&i===3?(t.consume(D),T):D===93&&i===5?(t.consume(D),B):Nt(D)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(i5,tt,W)(D)):D===null||Nt(D)?(t.exit("htmlFlowData"),W(D)):(t.consume(D),z)}function W(D){return t.check(s5,P,tt)(D)}function P(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),I}function I(D){return D===null||Nt(D)?W(D):(t.enter("htmlFlowData"),z(D))}function M(D){return D===45?(t.consume(D),T):z(D)}function O(D){return D===47?(t.consume(D),o="",$):z(D)}function $(D){if(D===62){const V=o.toLowerCase();return Df.includes(V)?(t.consume(D),G):z(D)}return Je(D)&&o.length<8?(t.consume(D),o+=String.fromCharCode(D),$):z(D)}function B(D){return D===93?(t.consume(D),T):z(D)}function T(D){return D===62?(t.consume(D),G):D===45&&i===2?(t.consume(D),T):z(D)}function G(D){return D===null||Nt(D)?(t.exit("htmlFlowData"),tt(D)):(t.consume(D),G)}function tt(D){return t.exit("htmlFlow"),e(D)}}function l5(t,e,r){const n=this;return i;function i(o){return Nt(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 c5(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Jo,e,r)}}const h5={name:"htmlText",tokenize:u5};function u5(t,e,r){const n=this;let i,s,o;return a;function a(T){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(T),l}function l(T){return T===33?(t.consume(T),h):T===47?(t.consume(T),_):T===63?(t.consume(T),b):Je(T)?(t.consume(T),A):r(T)}function h(T){return T===45?(t.consume(T),u):T===91?(t.consume(T),s=0,m):Je(T)?(t.consume(T),C):r(T)}function u(T){return T===45?(t.consume(T),p):r(T)}function d(T){return T===null?r(T):T===45?(t.consume(T),f):Nt(T)?(o=d,O(T)):(t.consume(T),d)}function f(T){return T===45?(t.consume(T),p):d(T)}function p(T){return T===62?M(T):T===45?f(T):d(T)}function m(T){const G="CDATA[";return T===G.charCodeAt(s++)?(t.consume(T),s===G.length?x:m):r(T)}function x(T){return T===null?r(T):T===93?(t.consume(T),g):Nt(T)?(o=x,O(T)):(t.consume(T),x)}function g(T){return T===93?(t.consume(T),y):x(T)}function y(T){return T===62?M(T):T===93?(t.consume(T),y):x(T)}function C(T){return T===null||T===62?M(T):Nt(T)?(o=C,O(T)):(t.consume(T),C)}function b(T){return T===null?r(T):T===63?(t.consume(T),w):Nt(T)?(o=b,O(T)):(t.consume(T),b)}function w(T){return T===62?M(T):b(T)}function _(T){return Je(T)?(t.consume(T),S):r(T)}function S(T){return T===45||Ue(T)?(t.consume(T),S):N(T)}function N(T){return Nt(T)?(o=N,O(T)):Ht(T)?(t.consume(T),N):M(T)}function A(T){return T===45||Ue(T)?(t.consume(T),A):T===47||T===62||ae(T)?L(T):r(T)}function L(T){return T===47?(t.consume(T),M):T===58||T===95||Je(T)?(t.consume(T),j):Nt(T)?(o=L,O(T)):Ht(T)?(t.consume(T),L):M(T)}function j(T){return T===45||T===46||T===58||T===95||Ue(T)?(t.consume(T),j):F(T)}function F(T){return T===61?(t.consume(T),z):Nt(T)?(o=F,O(T)):Ht(T)?(t.consume(T),F):L(T)}function z(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(t.consume(T),i=T,W):Nt(T)?(o=z,O(T)):Ht(T)?(t.consume(T),z):(t.consume(T),P)}function W(T){return T===i?(t.consume(T),i=void 0,I):T===null?r(T):Nt(T)?(o=W,O(T)):(t.consume(T),W)}function P(T){return T===null||T===34||T===39||T===60||T===61||T===96?r(T):T===47||T===62||ae(T)?L(T):(t.consume(T),P)}function I(T){return T===47||T===62||ae(T)?L(T):r(T)}function M(T){return T===62?(t.consume(T),t.exit("htmlTextData"),t.exit("htmlText"),e):r(T)}function O(T){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),$}function $(T){return Ht(T)?Vt(t,B,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):B(T)}function B(T){return t.enter("htmlTextData"),o(T)}}const Pd={name:"labelEnd",resolveAll:m5,resolveTo:g5,tokenize:x5},d5={tokenize:y5},p5={tokenize:b5},f5={tokenize:C5};function m5(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&&Cr(t,0,t.length,r),t}function g5(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 l={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",l,e],["enter",h,e]],a=_r(a,t.slice(s+1,s+n+3)),a=_r(a,[["enter",u,e]]),a=_r(a,lc(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=_r(a,[["exit",u,e],t[o-2],t[o-1],["exit",h,e]]),a=_r(a,t.slice(o+1)),a=_r(a,[["exit",l,e]]),Cr(t,s,t.length,a),t}function x5(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(Or(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),l):r(f)}function l(f){return f===40?t.attempt(d5,u,o?u:d)(f):f===91?t.attempt(p5,u,o?h:d)(f):o?u(f):d(f)}function h(f){return t.attempt(f5,u,d)(f)}function u(f){return e(f)}function d(f){return s._balanced=!0,r(f)}}function y5(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)?wo(t,s)(d):s(d)}function s(d){return d===41?u(d):F0(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ae(d)?wo(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?P0(t,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function h(d){return ae(d)?wo(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 b5(t,e,r){const n=this;return i;function i(a){return D0.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(Or(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function C5(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 k5={name:"labelStartImage",resolveAll:Pd.resolveAll,tokenize:v5};function v5(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 w5={name:"labelStartLink",resolveAll:Pd.resolveAll,tokenize:S5};function S5(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 Yc={name:"lineEnding",tokenize:T5};function T5(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Vt(t,e,"linePrefix")}}const Va={name:"thematicBreak",tokenize:_5};function _5(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"),l(h)):n>=3&&(h===null||Nt(h))?(t.exit("thematicBreak"),e(h)):r(h)}function l(h){return h===i?(t.consume(h),n++,l):(t.exit("thematicBreakSequence"),Ht(h)?Vt(t,a,"whitespace")(h):a(h))}}const hr={continuation:{tokenize:B5},exit:A5,name:"list",tokenize:E5},j5={partial:!0,tokenize:M5},N5={partial:!0,tokenize:L5};function E5(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:tu(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(Va,r,h)(p):h(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return r(p)}function l(p){return tu(p)&&++o<10?(t.consume(p),l):(!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(Jo,n.interrupt?r:u,t.attempt(j5,f,d))}function u(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Ht(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 B5(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(Jo,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Vt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Ht(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(N5,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Vt(t,t.attempt(hr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function L5(t,e,r){const n=this;return Vt(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 A5(t){t.exit(this.containerState.type)}function M5(t,e,r){const n=this;return Vt(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!Ht(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const Pf={name:"setextUnderline",resolveTo:I5,tokenize:F5};function I5(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 F5(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"),Ht(h)?Vt(t,l,"lineSuffix")(h):l(h))}function l(h){return h===null||Nt(h)?(t.exit("setextHeadingLine"),e(h)):r(h)}}const D5={tokenize:P5};function P5(t){const e=this,r=t.attempt(Jo,n,t.attempt(this.parser.constructs.flowInitial,i,Vt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Wj,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 O5={resolveAll:$0()},$5=O0("string"),R5=O0("text");function O0(t){return{resolveAll:$0(t==="text"?z5: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),l}function l(u){return h(u)?(r.exit("data"),s(u)):(r.consume(u),l)}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 $0(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 z5(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,l;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)l=!0,a++;else if(h!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const h={type:r===t.length||l||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 W5={42:hr,43:hr,45:hr,48:hr,49:hr,50:hr,51:hr,52:hr,53:hr,54:hr,55:hr,56:hr,57:hr,62:L0},q5={91:Gj},H5={[-2]:Uc,[-1]:Uc,32:Uc},U5={35:Jj,42:Va,45:[Pf,Va],60:n5,61:Pf,95:Va,96:Ff,126:Ff},Y5={38:M0,92:A0},G5={[-5]:Yc,[-4]:Yc,[-3]:Yc,33:k5,38:M0,42:eu,60:[wj,h5],91:w5,92:[Qj,A0],93:Pd,95:eu,96:Dj},V5={null:[eu,O5]},X5={null:[42,95]},K5={null:[]},Q5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:X5,contentInitial:q5,disable:K5,document:W5,flow:U5,flowInitial:H5,insideSpan:V5,string:Y5,text:G5},Symbol.toStringTag,{value:"Module"}));function Z5(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 l={attempt:N(_),check:N(S),consume:C,enter:b,exit:w,interrupt:N(S,{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,l);return e.resolveAll&&s.push(e),h;function d(F){return o=_r(o,F),g(),o[o.length-1]!==null?[]:(A(e,0),h.events=lc(s,h.events,h),h.events)}function f(F,z){return tN(p(F),z)}function p(F){return J5(o,F)}function m(){const{_bufferIndex:F,_index:z,line:W,column:P,offset:I}=n;return{_bufferIndex:F,_index:z,line:W,column:P,offset:I}}function x(F){i[F.line]=F.column,j()}function g(){let F;for(;n._index<o.length;){const z=o[n._index];if(typeof z=="string")for(F=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===F&&n._bufferIndex<z.length;)y(z.charCodeAt(n._bufferIndex));else y(z)}}function y(F){u=u(F)}function C(F){Nt(F)?(n.line++,n.column=1,n.offset+=F===-3?2:1,j()):F!==-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=F}function b(F,z){const W=z||{};return W.type=F,W.start=m(),h.events.push(["enter",W,h]),a.push(W),W}function w(F){const z=a.pop();return z.end=m(),h.events.push(["exit",z,h]),z}function _(F,z){A(F,z.from)}function S(F,z){z.restore()}function N(F,z){return W;function W(P,I,M){let O,$,B,T;return Array.isArray(P)?tt(P):"tokenize"in P?tt([P]):G(P);function G(ct){return Ft;function Ft(_t){const lt=_t!==null&&ct[_t],Y=_t!==null&&ct.null,ot=[...Array.isArray(lt)?lt:lt?[lt]:[],...Array.isArray(Y)?Y:Y?[Y]:[]];return tt(ot)(_t)}}function tt(ct){return O=ct,$=0,ct.length===0?M:D(ct[$])}function D(ct){return Ft;function Ft(_t){return T=L(),B=ct,ct.partial||(h.currentConstruct=ct),ct.name&&h.parser.constructs.disable.null.includes(ct.name)?ht():ct.tokenize.call(z?Object.assign(Object.create(h),z):h,l,V,ht)(_t)}}function V(ct){return F(B,T),I}function ht(ct){return T.restore(),++$<O.length?D(O[$]):M}}}function A(F,z){F.resolveAll&&!s.includes(F)&&s.push(F),F.resolve&&Cr(h.events,z,h.events.length-z,F.resolve(h.events.slice(z),h)),F.resolveTo&&(h.events=F.resolveTo(h.events,h))}function L(){const F=m(),z=h.previous,W=h.currentConstruct,P=h.events.length,I=Array.from(a);return{from:P,restore:M};function M(){n=F,h.previous=z,h.currentConstruct=W,h.events.length=P,a=I,j()}}function j(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function J5(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 tN(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=`
277
- `;break}case-3:{o=`\r
278
- `;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 eN(t){const n={constructs:E0([Q5,...(t||{}).extensions||[]]),content:i(gj),defined:[],document:i(yj),flow:i(D5),lazy:{},string:i($5),text:i(R5)};return n;function i(s){return o;function o(a){return Z5(n,s,a)}}}function rN(t){for(;!I0(t););return t}const Of=/[\0\t\n\r]/g;function nN(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];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(Of.lastIndex=d,h=Of.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)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<f&&(l.push(s.slice(d,f)),t+=f-d),p){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:n=!0,t=1}d=f+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const iN=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sN(t){return t.replace(iN,oN)}function oN(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return B0(r.slice(s?2:1),s?16:10)}return Dd(r)||t}const R0={}.hasOwnProperty;function aN(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),lN(r)(rN(eN(r).document().write(nN()(t,e,!0))))}function lN(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Re),autolinkProtocol:L,autolinkEmail:L,atxHeading:s(le),blockQuote:s(Y),characterEscape:L,characterReference:L,codeFenced:s(ot),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ot,o),codeText:s(kt,o),codeTextData:L,data:L,codeFlowValue:L,definition:s(Tt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(ee),hardBreakEscape:s(Zt),hardBreakTrailing:s(Zt),htmlFlow:s($e,o),htmlFlowData:L,htmlText:s($e,o),htmlTextData:L,image:s(Xt),label:o,link:s(Re),listItem:s(Ae),listItemValue:f,listOrdered:s(re,d),listUnordered:s(re),paragraph:s(X),reference:D,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(le),strong:s(nt),thematicBreak:s(dt)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:lt,autolinkProtocol:_t,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:ht,characterReferenceMarkerNumeric:ht,characterReferenceValue:ct,characterReference:Ft,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:j,codeIndented:l(y),codeText:l(I),codeTextData:j,data:j,definition:l(),definitionDestinationString:w,definitionLabelString:C,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(z),hardBreakTrailing:l(z),htmlFlow:l(W),htmlFlowData:j,htmlText:l(P),htmlTextData:j,image:l(O),label:B,labelText:$,lineEnding:F,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:V,resourceDestinationString:T,resourceTitleString:G,resource:tt,setextHeading:l(A),setextHeadingLineSequence:N,setextHeadingText:S,strong:l(),thematicBreak:l()}};z0(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(H){let rt={type:"root",children:[]};const ft={stack:[rt],tokenStack:[],config:e,enter:a,exit:h,buffer:o,resume:u,data:r},wt=[];let Ot=-1;for(;++Ot<H.length;)if(H[Ot][1].type==="listOrdered"||H[Ot][1].type==="listUnordered")if(H[Ot][0]==="enter")wt.push(Ot);else{const pe=wt.pop();Ot=i(H,pe,Ot)}for(Ot=-1;++Ot<H.length;){const pe=e[H[Ot][0]];R0.call(pe,H[Ot][1].type)&&pe[H[Ot][1].type].call(Object.assign({sliceSerialize:H[Ot][2].sliceSerialize},ft),H[Ot][1])}if(ft.tokenStack.length>0){const pe=ft.tokenStack[ft.tokenStack.length-1];(pe[1]||$f).call(ft,void 0,pe[0])}for(rt.position={start:jn(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:jn(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ot=-1;++Ot<e.transforms.length;)rt=e.transforms[Ot](rt)||rt;return rt}function i(H,rt,ft){let wt=rt-1,Ot=-1,pe=!1,ce,Ne,wr,ye;for(;++wt<=ft;){const ve=H[wt];switch(ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ve[0]==="enter"?Ot++:Ot--,ye=void 0;break}case"lineEndingBlank":{ve[0]==="enter"&&(ce&&!ye&&!Ot&&!wr&&(wr=wt),ye=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ye=void 0}if(!Ot&&ve[0]==="enter"&&ve[1].type==="listItemPrefix"||Ot===-1&&ve[0]==="exit"&&(ve[1].type==="listUnordered"||ve[1].type==="listOrdered")){if(ce){let Me=wt;for(Ne=void 0;Me--;){const Ie=H[Me];if(Ie[1].type==="lineEnding"||Ie[1].type==="lineEndingBlank"){if(Ie[0]==="exit")continue;Ne&&(H[Ne][1].type="lineEndingBlank",pe=!0),Ie[1].type="lineEnding",Ne=Me}else if(!(Ie[1].type==="linePrefix"||Ie[1].type==="blockQuotePrefix"||Ie[1].type==="blockQuotePrefixWhitespace"||Ie[1].type==="blockQuoteMarker"||Ie[1].type==="listItemIndent"))break}wr&&(!Ne||wr<Ne)&&(ce._spread=!0),ce.end=Object.assign({},Ne?H[Ne][1].start:ve[1].end),H.splice(Ne||wt,0,["exit",ce,ve[2]]),wt++,ft++}if(ve[1].type==="listItemPrefix"){const Me={type:"listItem",_spread:!1,start:Object.assign({},ve[1].start),end:void 0};ce=Me,H.splice(wt,0,["enter",Me,ve[2]]),wt++,ft++,wr=void 0,ye=!0}}}return H[rt][1]._spread=pe,ft}function s(H,rt){return ft;function ft(wt){a.call(this,H(wt),wt),rt&&rt.call(this,wt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(H,rt,ft){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([rt,ft||void 0]),H.position={start:jn(rt.start),end:void 0}}function l(H){return rt;function rt(ft){H&&H.call(this,ft),h.call(this,ft)}}function h(H,rt){const ft=this.stack.pop(),wt=this.tokenStack.pop();if(wt)wt[0].type!==H.type&&(rt?rt.call(this,H,wt[0]):(wt[1]||$f).call(this,H,wt[0]));else throw new Error("Cannot close `"+H.type+"` ("+vo({start:H.start,end:H.end})+"): it’s not open");ft.position.end=jn(H.end)}function u(){return Fd(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(H){if(this.data.expectingFirstListItemValue){const rt=this.stack[this.stack.length-2];rt.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.lang=H}function m(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.meta=H}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.value=H.replace(/(\r?\n|\r)$/g,"")}function C(H){const rt=this.resume(),ft=this.stack[this.stack.length-1];ft.label=rt,ft.identifier=Or(this.sliceSerialize(H)).toLowerCase()}function b(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.title=H}function w(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.url=H}function _(H){const rt=this.stack[this.stack.length-1];if(!rt.depth){const ft=this.sliceSerialize(H).length;rt.depth=ft}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function N(H){const rt=this.stack[this.stack.length-1];rt.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function L(H){const ft=this.stack[this.stack.length-1].children;let wt=ft[ft.length-1];(!wt||wt.type!=="text")&&(wt=Z(),wt.position={start:jn(H.start),end:void 0},ft.push(wt)),this.stack.push(wt)}function j(H){const rt=this.stack.pop();rt.value+=this.sliceSerialize(H),rt.position.end=jn(H.end)}function F(H){const rt=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ft=rt.children[rt.children.length-1];ft.position.end=jn(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(rt.type)&&(L.call(this,H),j.call(this,H))}function z(){this.data.atHardBreak=!0}function W(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.value=H}function P(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.value=H}function I(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.value=H}function M(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const rt=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=rt,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function O(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const rt=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=rt,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function $(H){const rt=this.sliceSerialize(H),ft=this.stack[this.stack.length-2];ft.label=sN(rt),ft.identifier=Or(rt).toLowerCase()}function B(){const H=this.stack[this.stack.length-1],rt=this.resume(),ft=this.stack[this.stack.length-1];if(this.data.inReference=!0,ft.type==="link"){const wt=H.children;ft.children=wt}else ft.alt=rt}function T(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.url=H}function G(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.title=H}function tt(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function V(H){const rt=this.resume(),ft=this.stack[this.stack.length-1];ft.label=rt,ft.identifier=Or(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function ht(H){this.data.characterReferenceType=H.type}function ct(H){const rt=this.sliceSerialize(H),ft=this.data.characterReferenceType;let wt;ft?(wt=B0(rt,ft==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):wt=Dd(rt);const Ot=this.stack[this.stack.length-1];Ot.value+=wt}function Ft(H){const rt=this.stack.pop();rt.position.end=jn(H.end)}function _t(H){j.call(this,H);const rt=this.stack[this.stack.length-1];rt.url=this.sliceSerialize(H)}function lt(H){j.call(this,H);const rt=this.stack[this.stack.length-1];rt.url="mailto:"+this.sliceSerialize(H)}function Y(){return{type:"blockquote",children:[]}}function ot(){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 ee(){return{type:"emphasis",children:[]}}function le(){return{type:"heading",depth:0,children:[]}}function Zt(){return{type:"break"}}function $e(){return{type:"html",value:""}}function Xt(){return{type:"image",title:null,url:"",alt:null}}function Re(){return{type:"link",title:null,url:"",children:[]}}function re(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 X(){return{type:"paragraph",children:[]}}function nt(){return{type:"strong",children:[]}}function Z(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function jn(t){return{line:t.line,column:t.column,offset:t.offset}}function z0(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?z0(t,n):cN(t,n)}}function cN(t,e){let r;for(r in e)if(R0.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 $f(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+vo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+vo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+vo({start:e.start,end:e.end})+") is still open")}function hN(t){const e=this;e.parser=r;function r(n){return aN(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function uN(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 dN(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
279
- `}]}function pN(t,e){const r=e.value?e.value+`
280
- `:"",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 fN(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function mN(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function gN(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=As(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 l={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,l);const h={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,h),t.applyData(e,h)}function xN(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 yN(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function W0(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 bN(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return W0(t,e);const i={src:As(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 CN(t,e){const r={src:As(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 kN(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 vN(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return W0(t,e);const i={href:As(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 wN(t,e){const r={href:As(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 SN(t,e,r){const n=t.all(e),i=r?TN(r):q0(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:`
281
- `}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=n[n.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
282
- `});const h={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,h),t.applyData(e,h)}function TN(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=q0(r[n])}return e}function q0(t){const e=t.spread;return e??t.children.length>1}function _N(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 jN(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function NN(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function EN(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function BN(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=Ld(e.children[1]),l=v0(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),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 LN(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 l=-1;const h=[];for(;++l<a;){const d=e.children[l],f={},p=o?o[l]: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 AN(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Rf=9,zf=32;function MN(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Wf(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Wf(e.slice(i),i>0,!1)),s.join("")}function Wf(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===Rf||s===zf;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===Rf||s===zf;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function IN(t,e){const r={type:"text",value:MN(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function FN(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const DN={blockquote:uN,break:dN,code:pN,delete:fN,emphasis:mN,footnoteReference:gN,heading:xN,html:yN,imageReference:bN,image:CN,inlineCode:kN,linkReference:vN,link:wN,listItem:SN,list:_N,paragraph:jN,root:NN,strong:EN,table:BN,tableCell:AN,tableRow:LN,text:IN,thematicBreak:FN,toml:ka,yaml:ka,definition:ka,footnoteDefinition:ka};function ka(){}const H0=-1,cc=0,So=1,ml=2,Od=3,$d=4,Rd=5,zd=6,U0=7,Y0=8,PN=typeof self=="object"?self:globalThis,qf=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new PN[t](e)},ON=(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 cc:case H0:return r(o,i);case So:{const a=r([],i);for(const l of o)a.push(n(l));return a}case ml:{const a=r({},i);for(const[l,h]of o)a[n(l)]=n(h);return a}case Od:return r(new Date(o),i);case $d:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case Rd:{const a=r(new Map,i);for(const[l,h]of o)a.set(n(l),n(h));return a}case zd:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case U0:{const{name:a,message:l}=o;return r(qf(a,l),i)}case Y0: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(qf(s,o),i)};return n},Hf=t=>ON(new Map,t)(0),Li="",{toString:$N}={},{keys:RN}=Object,Xs=t=>{const e=typeof t;if(e!=="object"||!t)return[cc,e];const r=$N.call(t).slice(8,-1);switch(r){case"Array":return[So,Li];case"Object":return[ml,Li];case"Date":return[Od,Li];case"RegExp":return[$d,Li];case"Map":return[Rd,Li];case"Set":return[zd,Li];case"DataView":return[So,r]}return r.includes("Array")?[So,r]:r.includes("Error")?[U0,r]:[ml,r]},va=([t,e])=>t===cc&&(e==="function"||e==="symbol"),zN=(t,e,r,n)=>{const i=(o,a)=>{const l=n.push(o)-1;return r.set(a,l),l},s=o=>{if(r.has(o))return r.get(o);let[a,l]=Xs(o);switch(a){case cc:{let u=o;switch(l){case"bigint":a=Y0,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([H0],o)}return i([a,u],o)}case So:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),i([l,[...f]],o)}const u=[],d=i([a,u],o);for(const f of o)u.push(s(f));return d}case ml:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const u=[],d=i([a,u],o);for(const f of RN(o))(t||!va(Xs(o[f])))&&u.push([s(f),s(o[f])]);return d}case Od:return i([a,o.toISOString()],o);case $d:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case Rd:{const u=[],d=i([a,u],o);for(const[f,p]of o)(t||!(va(Xs(f))||va(Xs(p))))&&u.push([s(f),s(p)]);return d}case zd:{const u=[],d=i([a,u],o);for(const f of o)(t||!va(Xs(f)))&&u.push(s(f));return d}}const{message:h}=o;return i([a,{name:l,message:h}],o)};return s},Uf=(t,{json:e,lossy:r}={})=>{const n=[];return zN(!(e||r),!!e,new Map,n)(t),n},gl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Hf(Uf(t,e)):structuredClone(t):(t,e)=>Hf(Uf(t,e));function WN(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 qN(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function HN(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||WN,n=t.options.footnoteBackLabel||qN,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const h=t.footnoteById.get(t.footnoteOrder[l]);if(!h)continue;const u=t.all(h),d=String(h.identifier).toUpperCase(),f=As(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 C=typeof r=="string"?r:r(l,p);typeof C=="string"&&(C={type:"text",value:C}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,p),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const C=g.children[g.children.length-1];C&&C.type==="text"?C.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:{...gl(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
283
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
284
- `}]}}const hc=(function(t){if(t==null)return VN;if(typeof t=="function")return uc(t);if(typeof t=="object")return Array.isArray(t)?UN(t):YN(t);if(typeof t=="string")return GN(t);throw new Error("Expected function, string, or object as test")});function UN(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=hc(t[r]);return uc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function YN(t){const e=t;return uc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function GN(t){return uc(e);function e(r){return r&&r.type===t}}function uc(t){return e;function e(r,n,i){return!!(XN(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function VN(){return!0}function XN(t){return t!==null&&typeof t=="object"&&"type"in t}const G0=[],KN=!0,ru=!1,QN="skip";function V0(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=hc(i),o=n?-1:1;a(t,void 0,[])();function a(l,h,u){const d=l&&typeof l=="object"?l:{};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 ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=G0,m,x,g;if((!e||s(l,h,u[u.length-1]||void 0))&&(p=ZN(r(l,u)),p[0]===ru))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==QN)for(x=(n?y.children.length:-1)+o,g=u.concat(y);x>-1&&x<y.children.length;){const C=y.children[x];if(m=a(C,x,g)(),m[0]===ru)return m;x=typeof m[1]=="number"?m[1]:x+o}}return p}}}function ZN(t){return Array.isArray(t)?t:typeof t=="number"?[KN,t]:t==null?G0:[t]}function Wd(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),V0(t,s,a,i);function a(l,h){const u=h[h.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const nu={}.hasOwnProperty,JN={};function tE(t,e){const r=e||JN,n=new Map,i=new Map,s=new Map,o={...DN,...r.handlers},a={all:h,applyData:rE,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:eE,wrap:iE};return Wd(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 l(u,d){const f=u.type,p=a.handlers[f];if(nu.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=gl(g);return y.children=a.all(u),y}return gl(u)}return(a.options.unknownHandler||nE)(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=Yf(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=Yf(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function eE(t,e){t.position&&(e.position=W_(t))}function rE(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,gl(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function nE(t,e){const r=e.data||{},n="value"in e&&!(nu.call(r,"hProperties")||nu.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 iE(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
285
- `});++n<t.length;)n&&r.push({type:"text",value:`
286
- `}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
287
- `}),r}function Yf(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Gf(t,e){const r=tE(t,e),n=r.one(t,void 0),i=HN(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
288
- `},i),s}function sE(t,e){return t&&"run"in t?async function(r,n){const i=Gf(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Gf(r,{file:n,...t||e})}}function Vf(t){if(t)throw t}var Gc,Xf;function oE(){if(Xf)return Gc;Xf=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 Gc=function l(){var h,u,d,f,p,m,x=arguments[0],g=1,y=arguments.length,C=!1;for(typeof x=="boolean"&&(C=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&&(C&&f&&(s(f)||(p=i(f)))?(p?(p=!1,m=d&&i(d)?d:[]):m=d&&s(d)?d:{},o(x,{name:u,newValue:l(C,m,f)})):typeof f<"u"&&o(x,{name:u,newValue:f}));return x},Gc}var aE=oE();const Vc=xd(aE);function iu(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 lE(){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(l,...h){const u=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(h[d]===null||h[d]===void 0)&&(h[d]=i[d]);i=h,u?cE(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 cE(t,e){let r;return n;function n(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(h){const u=h;if(a&&r)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){r||(r=!0,e(o,...a))}function s(o){i(null,o)}}const Xr={basename:hE,dirname:uE,extname:dE,join:pE,sep:"/"};function hE(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ta(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 uE(t){if(ta(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 dE(t){ta(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 pE(...t){let e=-1,r;for(;++e<t.length;)ta(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":fE(r)}function fE(t){ta(t);const e=t.codePointAt(0)===47;let r=mE(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function mE(t,e){let r="",n=0,i=-1,s=0,o=-1,a,l;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(l=r.lastIndexOf("/"),l!==r.length-1){l<0?(r="",n=0):(r=r.slice(0,l),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 ta(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const gE={cwd:xE};function xE(){return"/"}function su(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function yE(t){if(typeof t=="string")t=new URL(t);else if(!su(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 bE(t)}function bE(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 Xc=["history","path","basename","stem","extname","dirname"];class X0{constructor(e){let r;e?su(e)?r={path:e}:typeof e=="string"||CE(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":gE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Xc.length;){const s=Xc[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)Xc.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Xr.basename(this.path):void 0}set basename(e){Qc(e,"basename"),Kc(e,"basename"),this.path=Xr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Xr.dirname(this.path):void 0}set dirname(e){Kf(this.basename,"dirname"),this.path=Xr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Xr.extname(this.path):void 0}set extname(e){if(Kc(e,"extname"),Kf(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=Xr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){su(e)&&(e=yE(e)),Qc(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Xr.basename(this.path,this.extname):void 0}set stem(e){Qc(e,"stem"),Kc(e,"stem"),this.path=Xr.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 Ge(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 Kc(t,e){if(t&&t.includes(Xr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Xr.sep+"`")}function Qc(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Kf(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function CE(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const kE=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),vE={}.hasOwnProperty;class qd extends kE{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=lE()}copy(){const e=new qd;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Vc(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(th("data",this.frozen),this.namespace[e]=r,this):vE.call(this.namespace,e)&&this.namespace[e]||void 0:e?(th("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=wa(e),n=this.parser||this.Parser;return Zc("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Zc("process",this.parser||this.Parser),Jc("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=wa(e),l=n.parse(a);n.run(l,a,function(u,d,f){if(u||!d||!f)return h(u);const p=d,m=n.stringify(p,f);TE(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(),Zc("processSync",this.parser||this.Parser),Jc("processSync",this.compiler||this.Compiler),this.process(e,i),Zf("processSync","process",r),n;function i(s,o){r=!0,Vf(s),n=o}}run(e,r,n){Qf(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 l=wa(r);i.run(e,l,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),Zf("runSync","run",n),i;function s(o,a){Vf(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=wa(r),i=this.compiler||this.Compiler;return Jc("stringify",i),Qf(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(th("use",this.frozen),e!=null)if(typeof e=="function")l(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")l(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[u,...d]=h;l(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=Vc(!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 l(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];iu(x)&&iu(p)&&(p=Vc(!0,x,p)),n[f]=[h,p,...m]}}}}const wE=new qd().freeze();function Zc(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Jc(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function th(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 Qf(t){if(!iu(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Zf(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function wa(t){return SE(t)?t:new X0(t)}function SE(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function TE(t){return typeof t=="string"||_E(t)}function _E(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const jE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Jf=[],tm={allowDangerousHtml:!0},NE=/^(https?|ircs?|mailto|xmpp)$/i,EE=[{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 Hd(t){const e=BE(t),r=LE(t);return AE(e.runSync(e.parse(r),r),t)}function BE(t){const e=t.rehypePlugins||Jf,r=t.remarkPlugins||Jf,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...tm}:tm;return wE().use(hN).use(r).use(sE,n).use(e)}function LE(t){const e=t.children||"",r=new X0;return typeof e=="string"&&(r.value=e),r}function AE(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||ME;for(const u of EE)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+jE+u.id,void 0);return Wd(t,h),G_(t,{Fragment:c.Fragment,components:i,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.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 Hc)if(Object.hasOwn(Hc,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],x=Hc[p];(x===null||x.includes(u.tagName))&&(u.properties[p]=l(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 ME(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||NE.test(t.slice(0,e))?t:""}function em(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 IE(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function FE(t,e,r){const i=hc((r||{}).ignore||[]),s=DE(e);let o=-1;for(;++o<s.length;)V0(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 l(h,u)}function l(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,C=[];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 S=p(...b,_);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?f.lastIndex=w+1:(m!==w&&C.push({type:"text",value:h.value.slice(m,w)}),Array.isArray(S)?C.push(...S):S&&C.push(S),m=w+b[0].length,y=!0),!f.global)break;b=f.exec(h.value)}return y?(m<h.value.length&&C.push({type:"text",value:h.value.slice(m)}),d.children.splice(g,1,...C)):C=[h],g+C.length}}function DE(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([PE(i[0]),OE(i[1])])}return e}function PE(t){return typeof t=="string"?new RegExp(IE(t),"g"):t}function OE(t){return typeof t=="function"?t:function(){return t}}const eh="phrasing",rh=["autolink","link","image","label"];function $E(){return{transforms:[YE],enter:{literalAutolink:zE,literalAutolinkEmail:nh,literalAutolinkHttp:nh,literalAutolinkWww:nh},exit:{literalAutolink:UE,literalAutolinkEmail:HE,literalAutolinkHttp:WE,literalAutolinkWww:qE}}}function RE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:eh,notInConstruct:rh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:eh,notInConstruct:rh},{character:":",before:"[ps]",after:"\\/",inConstruct:eh,notInConstruct:rh}]}}function zE(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function nh(t){this.config.enter.autolinkProtocol.call(this,t)}function WE(t){this.config.exit.autolinkProtocol.call(this,t)}function qE(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 HE(t){this.config.exit.autolinkEmail.call(this,t)}function UE(t){this.exit(t)}function YE(t){FE(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,GE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),VE]],{ignore:["link","linkReference"]})}function GE(t,e,r,n,i){let s="";if(!K0(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!XE(r)))return!1;const o=KE(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 VE(t,e,r,n){return!K0(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function XE(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 KE(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=em(t,"(");let s=em(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 K0(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||mi(r)||ac(r))&&(!e||r!==47)}Q0.peek=sB;function QE(){this.buffer()}function ZE(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function JE(){this.buffer()}function tB(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function eB(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Or(this.sliceSerialize(t)).toLowerCase(),r.label=e}function rB(t){this.exit(t)}function nB(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Or(this.sliceSerialize(t)).toLowerCase(),r.label=e}function iB(t){this.exit(t)}function sB(){return"["}function Q0(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 oB(){return{enter:{gfmFootnoteCallString:QE,gfmFootnoteCall:ZE,gfmFootnoteDefinitionLabelString:JE,gfmFootnoteDefinition:tB},exit:{gfmFootnoteCallString:eB,gfmFootnoteCall:rB,gfmFootnoteDefinitionLabelString:nB,gfmFootnoteDefinition:iB}}}function aB(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:Q0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const h=s.enter("footnoteDefinition"),u=s.enter("label");return l+=a.move(s.safe(s.associationId(n),{before:l,after:"]"})),u(),l+=a.move("]:"),n.children&&n.children.length>0&&(a.shift(4),l+=a.move((e?`
289
- `:" ")+s.indentLines(s.containerFlow(n,a.current()),e?Z0:lB))),h(),l}}function lB(t,e,r){return e===0?t:Z0(t,e,r)}function Z0(t,e,r){return(r?"":" ")+t}const cB=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];J0.peek=fB;function hB(){return{canContainEols:["delete"],enter:{strikethrough:dB},exit:{strikethrough:pB}}}function uB(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cB}],handlers:{delete:J0}}}function dB(t){this.enter({type:"delete",children:[]},t)}function pB(t){this.exit(t)}function J0(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 fB(){return"~"}function mB(t){return t.length}function gB(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||mB,s=[],o=[],a=[],l=[];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 C=xB(t[u][y]);if(r.alignDelimiters!==!1){const b=i(C);g[y]=b,(l[y]===void 0||b>l[y])&&(l[y]=b)}x.push(C)}o[u]=x,a[u]=g}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<h;)s[d]=rm(n[d]);else{const x=rm(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 C=r.alignDelimiters===!1?1:Math.max(1,l[d]-g.length-y.length);const b=g+"-".repeat(C)+y;r.alignDelimiters!==!1&&(C=g.length+C+y.length,C>l[d]&&(l[d]=C),p[d]=C),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 C=x[d]||"";let b="",w="";if(r.alignDelimiters!==!1){const _=l[d]-(g[d]||0),S=s[d];S===114?b=" ".repeat(_):S===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&&C==="")&&(r.delimiterStart!==!1||d)&&y.push(" "),r.alignDelimiters!==!1&&y.push(b),y.push(C),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(`
290
- `)}function xB(t){return t==null?"":String(t)}function rm(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 yB(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()),bB);return i(),o}function bB(t,e,r){return">"+(r?"":" ")+t}function CB(t,e){return nm(t,e.inConstruct,!0)&&!nm(t,e.notInConstruct,!1)}function nm(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 im(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
291
- `&&CB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
292
- `}function kB(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 vB(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 wB(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 SB(t,e,r,n){const i=wB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(vB(t,r)){const d=r.enter("codeIndented"),f=r.indentLines(s,TB);return d(),f}const a=r.createTracker(n),l=i.repeat(Math.max(kB(s,i)+1,3)),h=r.enter("codeFenced");let u=a.move(l);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:`
293
- `,encode:["`"],...a.current()})),d()}return u+=a.move(`
294
- `),s&&(u+=a.move(s+`
295
- `)),u+=a.move(l),h(),u}function TB(t,e,r){return(r?"":" ")+t}function Ud(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 _B(t,e,r,n){const i=Ud(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const l=r.createTracker(n);let h=l.move("[");return h+=l.move(r.safe(r.associationId(t),{before:h,after:"]",...l.current()})),h+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(r.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(a=r.enter("destinationRaw"),h+=l.move(r.safe(t.url,{before:h,after:t.title?" ":`
296
- `,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),h+=l.move(" "+i),h+=l.move(r.safe(t.title,{before:h,after:i,...l.current()})),h+=l.move(i),a()),o(),h}function jB(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 Do(t){return"&#x"+t.toString(16).toUpperCase()+";"}function xl(t,e,r){const n=gs(t),i=gs(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}}ty.peek=NB;function ty(t,e,r,n){const i=jB(r),s=r.enter("emphasis"),o=r.createTracker(n),a=o.move(i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const h=l.charCodeAt(0),u=xl(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(l=Do(h)+l.slice(1));const d=l.charCodeAt(l.length-1),f=xl(n.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Do(d));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function NB(t,e,r){return r.options.emphasis||"*"}function EB(t,e){let r=!1;return Wd(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,ru}),!!((!t.depth||t.depth<3)&&Fd(t)&&(e.options.setext||r))}function BB(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(EB(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),f=r.containerPhrasing(t,{...s.current(),before:`
297
- `,after:`
298
- `});return d(),u(),f+`
299
- `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
300
- `))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let h=r.containerPhrasing(t,{before:"# ",after:`
301
- `,...s.current()});return/^[\t ]/.test(h)&&(h=Do(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,r.options.closeAtx&&(h+=" "+o),l(),a(),h}ey.peek=LB;function ey(t){return t.value||""}function LB(){return"<"}ry.peek=AB;function ry(t,e,r,n){const i=Ud(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const l=r.createTracker(n);let h=l.move("![");return h+=l.move(r.safe(t.alt,{before:h,after:"]",...l.current()})),h+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(r.safe(t.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(a=r.enter("destinationRaw"),h+=l.move(r.safe(t.url,{before:h,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),h+=l.move(" "+i),h+=l.move(r.safe(t.title,{before:h,after:i,...l.current()})),h+=l.move(i),a()),h+=l.move(")"),o(),h}function AB(){return"!"}ny.peek=MB;function ny(t,e,r,n){const i=t.referenceType,s=r.enter("imageReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("![");const h=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(h+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!h||h!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function MB(){return"!"}iy.peek=IB;function iy(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 l;if(o.atBreak)for(;l=a.exec(n);){let h=l.index;n.charCodeAt(h)===10&&n.charCodeAt(h-1)===13&&h--,n=n.slice(0,h)+" "+n.slice(l.index+1)}}return i+n+i}function IB(){return"`"}function sy(t,e){const r=Fd(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))}oy.peek=FB;function oy(t,e,r,n){const i=Ud(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(sy(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"),l=r.enter("label");let h=o.move("[");return h+=o.move(r.containerPhrasing(t,{before:h,after:"](",...o.current()})),h+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),h+=o.move("<"),h+=o.move(r.safe(t.url,{before:h,after:">",...o.current()})),h+=o.move(">")):(l=r.enter("destinationRaw"),h+=o.move(r.safe(t.url,{before:h,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=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),l()),h+=o.move(")"),a(),h}function FB(t,e,r){return sy(t,r)?"<":"["}ay.peek=DB;function ay(t,e,r,n){const i=t.referenceType,s=r.enter("linkReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("[");const h=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(h+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const d=r.safe(r.associationId(t),{before:l,after:"]",...a.current()});return o(),r.stack=u,s(),i==="full"||!h||h!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function DB(){return"["}function Yd(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 PB(t){const e=Yd(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 OB(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 ly(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 $B(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?OB(r):Yd(r);const a=t.ordered?o==="."?")":".":PB(r);let l=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&&(l=!0),ly(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"){l=!0;break}}}}l&&(o=a),r.bulletCurrent=o;const h=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),h}function RB(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 zB(t,e,r,n){const i=RB(r);let s=r.bulletCurrent||Yd(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 l=r.enter("listItem"),h=r.indentLines(r.containerFlow(t,a.current()),u);return l(),h;function u(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?s:s+" ".repeat(o-s.length))+d}}function WB(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const qB=hc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function HB(t,e,r,n){return(t.children.some(function(o){return qB(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function UB(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}cy.peek=YB;function cy(t,e,r,n){const i=UB(r),s=r.enter("strong"),o=r.createTracker(n),a=o.move(i+i);let l=o.move(r.containerPhrasing(t,{after:i,before:a,...o.current()}));const h=l.charCodeAt(0),u=xl(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(l=Do(h)+l.slice(1));const d=l.charCodeAt(l.length-1),f=xl(n.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Do(d));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function YB(t,e,r){return r.options.strong||"*"}function GB(t,e,r,n){return r.safe(t.value,n)}function VB(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 XB(t,e,r){const n=(ly(r)+(r.options.ruleSpaces?" ":"")).repeat(VB(r));return r.options.ruleSpaces?n.slice(0,-1):n}const hy={blockquote:yB,break:im,code:SB,definition:_B,emphasis:ty,hardBreak:im,heading:BB,html:ey,image:ry,imageReference:ny,inlineCode:iy,link:oy,linkReference:ay,list:$B,listItem:zB,paragraph:WB,root:HB,strong:cy,text:GB,thematicBreak:XB};function KB(){return{enter:{table:QB,tableData:sm,tableHeader:sm,tableRow:JB},exit:{codeText:tL,table:ZB,tableData:ih,tableHeader:ih,tableRow:ih}}}function QB(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 ZB(t){this.exit(t),this.data.inTable=void 0}function JB(t){this.enter({type:"tableRow",children:[]},t)}function ih(t){this.exit(t)}function sm(t){this.enter({type:"tableCell",children:[]},t)}function tL(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,eL));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function eL(t,e){return e==="|"?e:t}function rL(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
302
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,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),C=h([y]);return C.slice(0,C.indexOf(`
303
- `))}function l(p,m,x,g){const y=x.enter("tableCell"),C=x.enter("phrasing"),b=x.containerPhrasing(p,{...g,before:s,after:s});return C(),y(),b}function h(p,m){return gB(p,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function u(p,m,x){const g=p.children;let y=-1;const C=[],b=m.enter("table");for(;++y<g.length;)C[y]=d(g[y],m,x);return b(),C}function d(p,m,x){const g=p.children;let y=-1;const C=[],b=m.enter("tableRow");for(;++y<g.length;)C[y]=l(g[y],p,m,x);return b(),C}function f(p,m,x){let g=hy.inlineCode(p,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function nL(){return{exit:{taskListCheckValueChecked:om,taskListCheckValueUnchecked:om,paragraph:sL}}}function iL(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:oL}}}function om(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function sL(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 oL(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 l=hy.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),l;function h(u){return u+o}}function aL(){return[$E(),oB(),hB(),KB(),nL()]}function lL(t){return{extensions:[RE(),aB(t),uB(),rL(t),iL()]}}const cL={tokenize:mL,partial:!0},uy={tokenize:gL,partial:!0},dy={tokenize:xL,partial:!0},py={tokenize:yL,partial:!0},hL={tokenize:bL,partial:!0},fy={name:"wwwAutolink",tokenize:pL,previous:gy},my={name:"protocolAutolink",tokenize:fL,previous:xy},Cn={name:"emailAutolink",tokenize:dL,previous:yy},tn={};function uL(){return{text:tn}}let Qn=48;for(;Qn<123;)tn[Qn]=Cn,Qn++,Qn===58?Qn=65:Qn===91&&(Qn=97);tn[43]=Cn;tn[45]=Cn;tn[46]=Cn;tn[95]=Cn;tn[72]=[Cn,my];tn[104]=[Cn,my];tn[87]=[Cn,fy];tn[119]=[Cn,fy];function dL(t,e,r){const n=this;let i,s;return o;function o(d){return!ou(d)||!yy.call(n,n.previous)||Gd(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return ou(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(hL,u,h)(d):d===45||d===95||Ue(d)?(s=!0,t.consume(d),l):u(d)}function h(d){return t.consume(d),i=!0,l}function u(d){return s&&i&&Je(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function pL(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!gy.call(n,n.previous)||Gd(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(cL,t.attempt(uy,t.attempt(dy,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function fL(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&xy.call(n,n.previous)&&!Gd(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(Je(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),l}return r(d)}function l(d){return d===47?(t.consume(d),s?h:(s=!0,l)):r(d)}function h(d){return d===null||fl(d)||ae(d)||mi(d)||ac(d)?r(d):t.attempt(uy,t.attempt(dy,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function mL(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 gL(t,e,r){let n,i,s;return o;function o(h){return h===46||h===95?t.check(py,l,a)(h):h===null||ae(h)||mi(h)||h!==45&&ac(h)?l(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 l(h){return i||n||!s?r(h):e(h)}}function xL(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(py,e,s)(o):o===null||ae(o)||mi(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function yL(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)||mi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||ae(a)||mi(a)?e(a):n(a)}function s(a){return Je(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):Je(a)?(t.consume(a),o):r(a)}}function bL(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ue(s)?r(s):e(s)}}function gy(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ae(t)}function xy(t){return!Je(t)}function yy(t){return!(t===47||ou(t))}function ou(t){return t===43||t===45||t===46||t===95||Ue(t)}function Gd(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 CL={tokenize:NL,partial:!0};function kL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:TL,continuation:{tokenize:_L},exit:jL}},text:{91:{name:"gfmFootnoteCall",tokenize:SL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:vL,resolveTo:wL}}}}function vL(t,e,r){const n=this;let i=n.events.length;const s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o;for(;i--;){const l=n.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return r(l);const h=Or(n.sliceSerialize({start:o.end,end:n.now()}));return h.codePointAt(0)!==94||!s.includes(h.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function wL(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 SL(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"),l}function l(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(Or(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 TL(t,e,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(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=Or(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),Vt(t,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return e(m)}}function _L(t,e,r){return t.check(Jo,e,t.attempt(CL,e,r))}function jL(t){t.exit("gfmFootnoteDefinition")}function NL(t,e,r){const n=this;return Vt(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 EL(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 l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let h=l;for(;h--;)if(o[h][0]==="exit"&&o[h][1].type==="strikethroughSequenceTemporary"&&o[h][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[h][1].end.offset-o[h][1].start.offset){o[l][1].type="strikethroughSequence",o[h][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[h][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[h][1].end),end:Object.assign({},o[l][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&&Cr(f,f.length,0,lc(p,o.slice(h+1,l),a)),Cr(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Cr(o,h-1,l-h+3,f),l=h+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){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"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const x=gs(h);if(m===126)return d>1?l(m):(o.consume(m),d++,p);if(d<2&&!r)return l(m);const g=o.exit("strikethroughSequenceTemporary"),y=gs(m);return g._open=!y||y===2&&!!x,g._close=!x||x===2&&!!y,a(m)}}}class BL{constructor(){this.map=[]}add(e,r,n){LL(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 LL(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 AL(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 ML(){return{flow:{null:{name:"table",tokenize:IL,resolveAll:FL}}}}function IL(t,e,r){const n=this;let i=0,s=0,o;return a;function a(j){let F=n.events.length-1;for(;F>-1;){const P=n.events[F][1].type;if(P==="lineEnding"||P==="linePrefix")F--;else break}const z=F>-1?n.events[F][1].type:null,W=z==="tableHead"||z==="tableRow"?S:l;return W===S&&n.parser.lazy[n.now().line]?r(j):W(j)}function l(j){return t.enter("tableHead"),t.enter("tableRow"),h(j)}function h(j){return j===124||(o=!0,s+=1),u(j)}function u(j){return j===null?r(j):Nt(j)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),p):r(j):Ht(j)?Vt(t,u,"whitespace")(j):(s+=1,o&&(o=!1,i+=1),j===124?(t.enter("tableCellDivider"),t.consume(j),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(j)))}function d(j){return j===null||j===124||ae(j)?(t.exit("data"),u(j)):(t.consume(j),j===92?f:d)}function f(j){return j===92||j===124?(t.consume(j),d):d(j)}function p(j){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(j):(t.enter("tableDelimiterRow"),o=!1,Ht(j)?Vt(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):m(j))}function m(j){return j===45||j===58?g(j):j===124?(o=!0,t.enter("tableCellDivider"),t.consume(j),t.exit("tableCellDivider"),x):_(j)}function x(j){return Ht(j)?Vt(t,g,"whitespace")(j):g(j)}function g(j){return j===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(j),t.exit("tableDelimiterMarker"),y):j===45?(s+=1,y(j)):j===null||Nt(j)?w(j):_(j)}function y(j){return j===45?(t.enter("tableDelimiterFiller"),C(j)):_(j)}function C(j){return j===45?(t.consume(j),C):j===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(j),t.exit("tableDelimiterMarker"),b):(t.exit("tableDelimiterFiller"),b(j))}function b(j){return Ht(j)?Vt(t,w,"whitespace")(j):w(j)}function w(j){return j===124?m(j):j===null||Nt(j)?!o||i!==s?_(j):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(j)):_(j)}function _(j){return r(j)}function S(j){return t.enter("tableRow"),N(j)}function N(j){return j===124?(t.enter("tableCellDivider"),t.consume(j),t.exit("tableCellDivider"),N):j===null||Nt(j)?(t.exit("tableRow"),e(j)):Ht(j)?Vt(t,N,"whitespace")(j):(t.enter("data"),A(j))}function A(j){return j===null||j===124||ae(j)?(t.exit("data"),N(j)):(t.consume(j),j===92?L:A)}function L(j){return j===92||j===124?(t.consume(j),A):A(j)}}function FL(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,h,u,d;const f=new BL;for(;++r<t.length;){const p=t[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(am(f,e,l,h,u),u=void 0,l=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=Sa(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=Sa(f,e,s,i,void 0,d)),s=o,o=[s[1],r,0,0])):m.type==="tableHead"?(a=!0,l=r):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=r,s[1]!==0?(o[0]=o[1],d=Sa(f,e,s,i,r,d)):o[1]!==0&&(d=Sa(f,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&am(f,e,l,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=AL(e.events,r))}return t}function Sa(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Wi(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=Wi(e.events,r[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(r[1],0,[["enter",s,e]]),r[2]!==0){const h=Wi(e.events,r[2]),u=Wi(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({},Wi(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function am(t,e,r,n,i){const s=[],o=Wi(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 Wi(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const DL={name:"tasklistCheck",tokenize:OL};function PL(){return{text:{91:DL}}}function OL(t,e,r){const n=this;return i;function i(l){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return ae(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):r(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):r(l)}function a(l){return Nt(l)?e(l):Ht(l)?t.check({tokenize:$L},e,r)(l):r(l)}}function $L(t,e,r){return Vt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function RL(t){return E0([uL(),kL(),EL(t),ML(),PL()])}const zL={};function Vd(t){const e=this,r=t||zL,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(RL(r)),s.push(aL()),o.push(lL(r))}const dc=k.createContext({newIds:new Set,changedIds:new Set}),lm=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:()=>l,subscribe:h=>(r.add(h),()=>r.delete(h))},l=e=t(n,i,a);return a},WL=(t=>t?lm(t):lm),qL=t=>t;function HL(t,e=qL){const r=qt.useSyncExternalStore(t.subscribe,qt.useCallback(()=>e(t.getState()),[t,e]),qt.useCallback(()=>e(t.getInitialState()),[t,e]));return qt.useDebugValue(r),r}const cm=t=>{const e=WL(t),r=n=>HL(e,n);return Object.assign(r,e),r},Xd=(t=>t?cm(t):cm),Ks=new Map;function UL(t,e,r){var O,$;const{prevItemMapRef:n,snapshotProviderRef:i,gatesRef:s,pendingResolveIdsRef:o,changeTimerRef:a,sessionEndTimerRef:l,wsRef:h}=e,{setItems:u,setConnections:d,setGates:f,setGateEvent:p,setRecentChanges:m,setUICommand:x,setAgentActivity:g,setAgentErrors:y,setSessionState:C,setSpawnedAgents:b,setAgentRelays:w,setSettings:_,setPipelineDraft:S,setActiveBuild:N,setSessions:A,setIterationStates:L,setFeatureTimeline:j,EMPTY_CHANGES:F,appendDecisionEvent:z,setDecisionEventsSnapshot:W,setStatusSnapshot:P,clearStatusSnapshots:I}=r,M=j?B=>{j(T=>T.some(G=>G.id===B.id)?T:[...T,B])}:null;if(t.type==="visionState"||t.type==="hydrate"){const B=t.items||[];if(n.current){const T=n.current,G=new Set,tt=new Set;for(const D of B){const V=T.get(D.id);V?(V.status!==D.status||V.confidence!==D.confidence||V.title!==D.title)&&tt.add(D.id):G.add(D.id)}(G.size>0||tt.size>0)&&(m({newIds:G,changedIds:tt}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(F),800))}n.current=new Map(B.map(T=>[T.id,T])),u(B),d(t.connections||[]),f(t.gates||[]),A&&A(t.sessions||[]),W&&Array.isArray(t.decisionEventsSnapshot)&&W(t.decisionEventsSnapshot),I&&I()}else if(t.type==="decisionEvent")z&&t.event&&z(t.event);else if(t.type==="decisionEventsSnapshot")W&&Array.isArray(t.events)&&W(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(B=>{const T=[...B,{tool:t.tool,category:t.category||null,detail:t.detail,items:t.items||[],error:t.error||null,timestamp:t.timestamp}];return T.length>20?T.slice(-20):T}),C(B=>B!=null&&B.active?{...B,toolCount:(B.toolCount||0)+1}:B);else if(t.type==="agentSpawned")b(B=>[...B,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")b(B=>B.map(T=>T.agentId===t.agentId?{...T,silent:!0,silentSinceMs:t.silentSinceMs}:T));else if(t.type==="agentKilled")b(B=>B.map(T=>T.agentId===t.agentId?{...T,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:T));else if(t.type==="agentGC")((O=t.removed)==null?void 0:O.length)>0&&g(B=>{const T=[...B,{tool:"gc",category:"executing",detail:`Cleaned ${t.removed.length} orphan worktree(s)`,items:[],timestamp:t.timestamp}];return T.length>20?T.slice(-20):T});else if(t.type==="agentComplete")b(B=>B.map(T=>T.agentId===t.agentId?T.status==="killed"?T:{...T,status:t.status,completedAt:new Date().toISOString()}:T));else if(t.type==="agentRelay")w(B=>[...B,t].slice(-50));else if(t.type==="sessionStart")l.current&&(clearTimeout(l.current),l.current=null),b(()=>[]),w(()=>[]),C(B=>B&&B.id===t.sessionId?{...B,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}),M&&M({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")l.current&&(clearTimeout(l.current),l.current=null),C(B=>B?{...B,active:!1,endedAt:t.timestamp,toolCount:t.toolCount,duration:t.duration,journalSpawned:t.journalSpawned,featureCode:t.featureCode||(B==null?void 0:B.featureCode)||null,phaseAtEnd:t.phaseAtEnd||null}:null),l.current=setTimeout(()=>{C(null),l.current=null},3e3),M&&M({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")C(B=>B&&{...B,summaries:[...B.summaries||[],{summary:t.summary,intent:t.intent,component:t.component,timestamp:t.timestamp}].slice(-5)});else if(t.type==="sessionBound")C(B=>B&&{...B,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(B=>{const T=[...B,{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 T.length>10?T.slice(-10):T}),C(B=>B!=null&&B.active?{...B,errorCount:(B.errorCount||0)+1}:B),M&&M({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}),M&&M({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(G=>G.map(tt=>tt.id===t.gateId?{...tt,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:tt)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const G=t.itemId??(($=s.current.find(tt=>tt.id===t.gateId))==null?void 0:$.itemId)??t.gateId;p({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:G})}const B=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,T={approve:"success",revise:"warning",kill:"error"};M&&M({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${B}`,detail:null,severity:T[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(B=>{let T;t.type==="iterationStarted"?T=`${t.loopType} loop started (0/${t.maxIterations})`:t.type==="iterationComplete"?T=`${t.loopType??"loop"} loop complete (${t.outcome} after ${t.finalCount} iterations)`:T=`${t.loopType??"loop"} iteration ${t.count}/${t.maxIterations}`;const G=[...B,{tool:"iteration",category:t.loopType||"iteration",detail:T,items:[],timestamp:t.timestamp}];return G.length>20?G.slice(-20):G}),t.type==="iterationStarted")Ks.has(t.loopId)&&(clearTimeout(Ks.get(t.loopId)),Ks.delete(t.loopId)),L(B=>{const T=new Map(B);return T.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}),T});else if(t.type==="iterationUpdate")L(B=>{const T=B.get(t.loopId);if(!T)return B;const G=new Map(B);return G.set(t.loopId,{...T,count:t.count,maxIterations:t.maxIterations}),G});else if(t.type==="iterationComplete"){L(T=>{const G=T.get(t.loopId);if(!G)return T;const tt=new Map(T);return tt.set(t.loopId,{...G,status:"complete",outcome:t.outcome,count:t.finalCount??G.count}),tt});const B=setTimeout(()=>{L(T=>{const G=new Map(T);return G.delete(t.loopId),G}),Ks.delete(t.loopId)},5e3);Ks.set(t.loopId,B)}if(t.type==="iterationComplete"&&(t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit")){const B={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(T=>{const G=[...T,{errorType:"iteration_limit",severity:"warning",message:B[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return G.length>10?G.slice(-10):G}),C(T=>T!=null&&T.active?{...T,errorCount:(T.errorCount||0)+1}:T)}if(M&&(t.type==="iterationStarted"||t.type==="iterationComplete")){const B=t.type==="iterationStarted"?`${t.loopType} loop started (0/${t.maxIterations})`:`${t.loopType??"loop"} loop ${t.outcome} (${t.finalCount} iterations)`;M({id:`iteration-${t.loopId}-${t.type}`,timestamp:t.timestamp,category:"iteration",title:B,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")M&&M({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 B=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",T=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";M&&M({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${B}`,detail:null,severity:T,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(B=>B.map(T=>{if(T.id!==t.itemId)return T;const G=T.lifecycle?{...T.lifecycle}:{};return G.lifecycle_ext={...G.lifecycle_ext||{},open_loops:t.loops},{...T,lifecycle:G}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(B=>B.map(T=>{if(T.id!==t.itemId)return T;const G=T.lifecycle?{...T.lifecycle}:{};return G.lifecycle_ext={...G.lifecycle_ext||{},drift_axes:t.drift_axes},{...T,lifecycle:G}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:B,itemId:T,...G}=t;u(tt=>tt.map(D=>{if(D.id!==T)return D;const V=D.lifecycle?{...D.lifecycle}:{};return V.lifecycle_ext={...V.lifecycle_ext||{},branch_lineage:G},{...D,lifecycle:V}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")_&&_(t.settings||null);else if(t.type==="buildState")N&&N(B=>{const T=(B==null?void 0:B.flowId)&&t.flowId&&B.flowId===t.flowId;return{...t,tierEvents:T?B.tierEvents??[]:[],capabilityEvents:T?B.capabilityEvents??[]:[],...T&&(B==null?void 0:B.health_score)!=null?{health_score:B.health_score,health_breakdown:B.health_breakdown,health_missing:B.health_missing}:{}}});else if(t.type==="pipelineDraft")S&&S(t);else if(t.type==="pipelineDraftResolved")S&&S(null);else if(t.type==="system"&&t.subtype==="health_score")N&&N(B=>B&&{...B,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"))N&&N(B=>B&&{...B,tierEvents:[...B.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")N&&N(B=>B&&{...B,capabilityEvents:[...B.capabilityEvents||[],t].slice(-200)});else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:B}=e,T=i.current?i.current():{},G=B?B():{},tt=h.current;tt&&tt.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...T,dom:G,timestamp:new Date().toISOString()}}))}}function YL(){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 l={},h=s.getAttribute("role")||s.getAttribute("aria-label"),u=s.tagName.toLowerCase();if(h?l.role=h:l.tag=u,s.className&&typeof s.className=="string"){const f=s.className.trim();f.length<80&&(l.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"?l.text=d[0]:d.length>0&&(l.children=d),!h&&(u==="div"||u==="span")&&!l.text&&d.length===1&&typeof d[0]=="object"?d[0]:l}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},hm={newIds:new Set,changedIds:new Set},fr=Xd((t,e)=>{async function r(o,a){const l=await Mt(o,a),h=await l.json();return l.ok?h:(console.error(`[vision] API error ${l.status}:`,h.error||h),{error:h.error||`HTTP ${l.status}`})}function n(){t({connected:!0}),Mt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),Mt("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),Mt("/api/agents/tree").then(o=>o.json()).then(o=>{e().spawnedAgents.length===0&&t({spawnedAgents:(o.agents||[]).map(l=>({agentId:l.agentId,parentSessionId:l.parentSessionId,agentType:l.agentType,status:l.status||"running",startedAt:l.startedAt,prompt:l.prompt}))})}).catch(()=>{})}function i(o){try{const a=JSON.parse(o.data);UL(a,{prevItemMapRef:{get current(){return fe.prevItemMap},set current(l){fe.prevItemMap=l}},snapshotProviderRef:{get current(){return fe.snapshotProvider},set current(l){fe.snapshotProvider=l}},gatesRef:{get current(){return fe.gates},set current(l){fe.gates=l}},pendingResolveIdsRef:{get current(){return fe.pendingResolveIds},set current(l){fe.pendingResolveIds=l}},changeTimerRef:{get current(){return fe.changeTimer},set current(l){fe.changeTimer=l}},sessionEndTimerRef:{get current(){return fe.sessionEndTimer},set current(l){fe.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=fe.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:YL},{setItems:l=>t(h=>({items:typeof l=="function"?l(h.items):l})),setConnections:l=>t(h=>({connections:typeof l=="function"?l(h.connections):l})),setGates:l=>{t(h=>{const u=typeof l=="function"?l(h.gates):l;return fe.gates=u,{gates:u}})},setGateEvent:l=>t({gateEvent:l}),setRecentChanges:l=>t(h=>({recentChanges:typeof l=="function"?l(h.recentChanges):l})),setUICommand:l=>t({uiCommand:l}),setAgentActivity:l=>t(h=>({agentActivity:typeof l=="function"?l(h.agentActivity):l})),setAgentErrors:l=>{t(h=>{const u=typeof l=="function"?l(h.agentErrors):l,d=Date.now()-6e4,f=u.filter(p=>new Date(p.timestamp).getTime()>d).slice(-5);return{agentErrors:u,recentErrors:f}})},setSessionState:l=>t(h=>({sessionState:typeof l=="function"?l(h.sessionState):l})),setSpawnedAgents:l=>t(h=>({spawnedAgents:typeof l=="function"?l(h.spawnedAgents):l})),setAgentRelays:l=>t(h=>({agentRelays:typeof l=="function"?l(h.agentRelays):l})),setSettings:l=>t({settings:l}),setPipelineDraft:l=>t({pipelineDraft:l}),setActiveBuild:l=>t(h=>({activeBuild:typeof l=="function"?l(h.activeBuild):l})),setSessions:l=>t(h=>({sessions:typeof l=="function"?l(h.sessions):l})),setFeatureTimeline:l=>t(h=>({featureTimeline:typeof l=="function"?l(h.featureTimeline):l})),setIterationStates:l=>t(h=>({iterationStates:typeof l=="function"?l(h.iterationStates):l})),appendDecisionEvent:l=>t(h=>!(l!=null&&l.id)||h.decisionEvents.some(u=>u.id===l.id)?h:{decisionEvents:[...h.decisionEvents,l]}),setDecisionEventsSnapshot:l=>t({decisionEvents:Array.isArray(l)?l:[]}),setStatusSnapshot:(l,h)=>t(u=>({statusSnapshots:{...u.statusSnapshots,[l]:h}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),EMPTY_CHANGES:hm})}catch{}}function s(){if(fe.disposed||fe.ws)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/vision`;fe.ws=oS({url:a,onOpen:n,onMessage:i,onClose:()=>t({connected:!1})})}return Mt("/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(()=>{Mt("/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,l=o.filter(h=>new Date(h.timestamp).getTime()>a).slice(-5);t({recentErrors:l})},1e4),s(),{items:[],connections:[],connected:!1,uiCommand:null,recentChanges:hm,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(l=>({selectedBranches:{...l.selectedBranches,[o]:a}})),setStatusSnapshot:(o,a)=>t(l=>({statusSnapshots:{...l.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(l=>l.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 Mt("/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(l=>({items:l.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,l)=>{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:l})});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}:{})})}}),GL=lS("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 rr({className:t,variant:e,...r}){return c.jsx("div",{className:st(GL({variant:e}),t),...r})}var VL=k.createContext(void 0);function XL(t){const e=k.useContext(VL);return t||e||"ltr"}function KL(t,[e,r]){return Math.min(r,Math.max(e,t))}function QL(t,e){return k.useReducer((r,n)=>e[r][n]??r,t)}var Kd="ScrollArea",[by]=cS(Kd),[ZL,Er]=by(Kd),Cy=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=k.useState(null),[h,u]=k.useState(null),[d,f]=k.useState(null),[p,m]=k.useState(null),[x,g]=k.useState(null),[y,C]=k.useState(0),[b,w]=k.useState(0),[_,S]=k.useState(!1),[N,A]=k.useState(!1),L=js(e,F=>l(F)),j=XL(i);return c.jsx(ZL,{scope:r,type:n,dir:j,scrollHideDelay:s,scrollArea:a,viewport:h,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:S,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:A,onCornerWidthChange:C,onCornerHeightChange:w,children:c.jsx(Ns.div,{dir:j,...o,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...t.style}})})});Cy.displayName=Kd;var ky="ScrollAreaViewport",vy=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Er(ky,r),a=k.useRef(null),l=js(e,a,o.onViewportChange);return c.jsxs(c.Fragment,{children:[c.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}),c.jsx(Ns.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:c.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});vy.displayName=ky;var en="ScrollAreaScrollbar",Qd=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Er(en,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return k.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?c.jsx(JL,{...n,ref:e,forceMount:r}):i.type==="scroll"?c.jsx(tA,{...n,ref:e,forceMount:r}):i.type==="auto"?c.jsx(wy,{...n,ref:e,forceMount:r}):i.type==="always"?c.jsx(Zd,{...n,ref:e,"data-state":"visible"}):null});Qd.displayName=en;var JL=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Er(en,t.__scopeScrollArea),[s,o]=k.useState(!1);return k.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const h=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),c.jsx(ic,{present:r||s,children:c.jsx(wy,{"data-state":s?"visible":"hidden",...n,ref:e})})}),tA=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Er(en,t.__scopeScrollArea),s=t.orientation==="horizontal",o=fc(()=>l("SCROLL_END"),100),[a,l]=QL("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 k.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,i.scrollHideDelay,l]),k.useEffect(()=>{const h=i.viewport,u=s?"scrollLeft":"scrollTop";if(h){let d=h[u];const f=()=>{const p=h[u];d!==p&&(l("SCROLL"),o()),d=p};return h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[i.viewport,s,l,o]),c.jsx(ic,{present:r||a!=="hidden",children:c.jsx(Zd,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:ci(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:ci(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),wy=k.forwardRef((t,e)=>{const r=Er(en,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=k.useState(!1),a=t.orientation==="horizontal",l=fc(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?h:u)}},10);return xs(r.viewport,l),xs(r.content,l),c.jsx(ic,{present:n||s,children:c.jsx(Zd,{"data-state":s?"visible":"hidden",...i,ref:e})})}),Zd=k.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Er(en,t.__scopeScrollArea),s=k.useRef(null),o=k.useRef(0),[a,l]=k.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=Ny(a.viewport,a.content),u={...n,sizes:a,onSizesChange:l,hasThumb:h>0&&h<1,onThumbChange:f=>s.current=f,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:f=>o.current=f};function d(f,p){return oA(f,o.current,a,p)}return r==="horizontal"?c.jsx(eA,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollLeft,p=um(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"?c.jsx(rA,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollTop,p=um(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}),eA=k.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Er(en,t.__scopeScrollArea),[o,a]=k.useState(),l=k.useRef(null),h=js(e,l,s.onScrollbarXChange);return k.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Ty,{"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":pc(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),By(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:bl(o.paddingLeft),paddingEnd:bl(o.paddingRight)}})}})}),rA=k.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Er(en,t.__scopeScrollArea),[o,a]=k.useState(),l=k.useRef(null),h=js(e,l,s.onScrollbarYChange);return k.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Ty,{"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":pc(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),By(f,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:bl(o.paddingTop),paddingEnd:bl(o.paddingBottom)}})}})}),[nA,Sy]=by(en),Ty=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:h,onWheelScroll:u,onResize:d,...f}=t,p=Er(en,r),[m,x]=k.useState(null),g=js(e,L=>x(L)),y=k.useRef(null),C=k.useRef(""),b=p.viewport,w=n.content-n.viewport,_=ii(u),S=ii(l),N=fc(d,10);function A(L){if(y.current){const j=L.clientX-y.current.left,F=L.clientY-y.current.top;h({x:j,y:F})}}return k.useEffect(()=>{const L=j=>{const F=j.target;(m==null?void 0:m.contains(F))&&_(j,w)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[b,m,w,_]),k.useEffect(S,[n,S]),xs(m,N),xs(p.content,N),c.jsx(nA,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:ii(s),onThumbPointerUp:ii(o),onThumbPositionChange:S,onThumbPointerDown:ii(a),children:c.jsx(Ns.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:ci(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),y.current=m.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(L))}),onPointerMove:ci(t.onPointerMove,A),onPointerUp:ci(t.onPointerUp,L=>{const j=L.target;j.hasPointerCapture(L.pointerId)&&j.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=C.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),yl="ScrollAreaThumb",_y=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Sy(yl,t.__scopeScrollArea);return c.jsx(ic,{present:r||i.hasThumb,children:c.jsx(iA,{ref:e,...n})})}),iA=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Er(yl,r),o=Sy(yl,r),{onThumbPositionChange:a}=o,l=js(e,d=>o.onThumbChange(d)),h=k.useRef(void 0),u=fc(()=>{h.current&&(h.current(),h.current=void 0)},100);return k.useEffect(()=>{const d=s.viewport;if(d){const f=()=>{if(u(),!h.current){const p=aA(d,a);h.current=p,a()}};return a(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[s.viewport,u,a]),c.jsx(Ns.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ci(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:ci(t.onPointerUp,o.onThumbPointerUp)})});_y.displayName=yl;var Jd="ScrollAreaCorner",jy=k.forwardRef((t,e)=>{const r=Er(Jd,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?c.jsx(sA,{...t,ref:e}):null});jy.displayName=Jd;var sA=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Er(Jd,r),[s,o]=k.useState(0),[a,l]=k.useState(0),h=!!(s&&a);return xs(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),l(u)}),xs(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),h?c.jsx(Ns.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 bl(t){return t?parseInt(t,10):0}function Ny(t,e){const r=t/e;return isNaN(r)?0:r}function pc(t){const e=Ny(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function oA(t,e,r,n="ltr"){const i=pc(r),s=i/2,o=e||s,a=i-o,l=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 Ey([l,h],d)(t)}function um(t,e,r="ltr"){const n=pc(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-n,l=r==="ltr"?[0,o]:[o*-1,0],h=KL(t,l);return Ey([0,o],[0,a])(h)}function Ey(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 By(t,e){return t>0&&t<e}var aA=(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 fc(t,e){const r=ii(t),n=k.useRef(0);return k.useEffect(()=>()=>window.clearTimeout(n.current),[]),k.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function xs(t,e){const r=ii(e);hS(()=>{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 Ly=Cy,lA=vy,cA=jy;const $n=k.forwardRef(({className:t,children:e,...r},n)=>c.jsxs(Ly,{ref:n,className:st("relative overflow-hidden",t),...r,children:[c.jsx(lA,{className:"h-full w-full rounded-[inherit]",children:e}),c.jsx(Ay,{}),c.jsx(cA,{})]}));$n.displayName=Ly.displayName;const Ay=k.forwardRef(({className:t,orientation:e="vertical",...r},n)=>c.jsx(Qd,{ref:n,orientation:e,className:st("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:c.jsx(_y,{className:"relative flex-1 rounded-full bg-border"})}));Ay.displayName=Qd.displayName;var hA="Separator",dm="horizontal",uA=["horizontal","vertical"],My=k.forwardRef((t,e)=>{const{decorative:r,orientation:n=dm,...i}=t,s=dA(n)?n:dm,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return c.jsx(Ns.div,{"data-orientation":s,...a,...i,ref:e})});My.displayName=hA;function dA(t){return uA.includes(t)}var Iy=My;const Cl=k.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>c.jsx(Iy,{ref:i,decorative:r,orientation:e,className:st("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Cl.displayName=Iy.displayName;function pA({agentId:t,status:e}){const[r,n]=k.useState(""),[i,s]=k.useState(""),o=k.useRef(null),a=k.useRef(!1),l=k.useCallback(()=>{const d=o.current;d&&(a.current=d.scrollTop+d.clientHeight<d.scrollHeight-20)},[]);k.useEffect(()=>{const d=o.current;d&&!a.current&&(d.scrollTop=d.scrollHeight)},[r,i]),k.useEffect(()=>{if(!t)return;const d=async()=>{try{const f=await Mt(`/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 c.jsx("div",{children:c.jsx("div",{ref:o,onScroll:l,className:"overflow-auto max-h-[300px] rounded bg-muted/30 p-2",children:h?c.jsx("p",{className:"text-[10px] font-mono text-muted-foreground italic",children:u?"Waiting for output...":"No output"}):c.jsxs(c.Fragment,{children:[r&&c.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground whitespace-pre-wrap break-all m-0",children:r}),i&&c.jsxs("div",{className:"mt-2",children:[c.jsx("span",{className:"text-[10px] font-mono font-medium text-destructive",children:"stderr"}),c.jsx("pre",{className:"text-[10px] font-mono text-destructive whitespace-pre-wrap break-all m-0 mt-0.5",children:i})]})]})})})}const fA=qt.memo(pA);function mA(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 gA({agentId:t,relays:e}){const r=k.useMemo(()=>!e||!t?[]:e.filter(n=>n.fromAgentId===t||n.toAgentId===t),[e,t]);return r.length===0?null:c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Relays"}),c.jsx("div",{className:"space-y-0.5",children:r.map((n,i)=>{const s=n.direction==="result";return c.jsxs("div",{className:"flex items-start gap-1 text-[10px] font-mono",children:[c.jsx("span",{className:s?"text-foreground shrink-0":"text-muted-foreground shrink-0",children:s?"→":"←"}),c.jsx("span",{className:s?"text-foreground truncate":"text-muted-foreground truncate",title:n.messagePreview,children:n.messagePreview}),c.jsx("span",{className:"text-muted-foreground opacity-50 ml-auto shrink-0 tabular-nums",children:mA(n.timestamp)})]},n.id||i)})})]})}const xA=qt.memo(gA),yA={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},pm={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function sh(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 bA=qt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=qt.useState(0);qt.useEffect(()=>{if(!r)return;const l=setInterval(()=>i(h=>h+1),1e3);return()=>clearInterval(l)},[r]);const s=r?Math.floor((Date.now()-new Date(e).getTime())/1e3):n||0,o=Math.floor(s/60),a=s%60;return c.jsxs("span",{className:"tabular-nums",children:[o,"m ",String(a).padStart(2,"0"),"s"]})});function CA({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,C;const[a,l]=qt.useState(null),[h,u]=qt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=qt.useState(0),[f,p]=qt.useState([]),m=qt.useRef(null);return qt.useEffect(()=>{const b=w=>u(w.detail);return window.addEventListener("compose:agent-status",b),()=>window.removeEventListener("compose:agent-status",b)},[]),qt.useEffect(()=>{if(h.status!=="working")return;const b=setInterval(()=>d(w=>w+1),1e3);return()=>clearInterval(b)},[h.status]),qt.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]),qt.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),c.jsxs(c.Fragment,{children:[i&&i.length>0&&c.jsxs("div",{className:"flex items-center gap-0.5 mb-1.5 overflow-x-auto px-3",children:[c.jsx("button",{onClick:()=>l(null),className:st("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=>c.jsxs("span",{className:"flex items-center gap-0 shrink-0",children:[c.jsxs("button",{onClick:()=>l(b.agentId),className:st("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:[c.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&&c.jsx("span",{className:"text-[8px] text-yellow-500 ml-0.5",title:"Agent silent",children:"!"})]}),b.status==="running"&&o&&c.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?c.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[c.jsx(fA,{agentId:a,status:(x=i.find(b=>b.agentId===a))==null?void 0:x.status}),c.jsx(xA,{agentId:a,relays:s})]}):c.jsxs(c.Fragment,{children:[(r==null?void 0:r.featureCode)&&c.jsxs("div",{className:"px-3 py-1.5 mb-1 rounded bg-muted/50",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground",children:"Working on"}),c.jsx("button",{className:"font-medium text-foreground hover:underline",onClick:()=>r.featureItemId&&(n==null?void 0:n(r.featureItemId)),children:r.featureCode})]}),r.phaseAtBind&&c.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Phase: ",r.phaseAtBind.replace(/_/g," ")]})]}),r&&c.jsxs("div",{className:"px-3 pb-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:[c.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:r.active?"hsl(var(--primary))":"hsl(var(--success))"}}),c.jsx(bA,{startedAt:r.startedAt,active:r.active,duration:r.duration}),c.jsxs("span",{className:"tabular-nums",children:[r.toolCount||0," tools"]}),r.errorCount>0&&c.jsxs("span",{style:{color:"hsl(var(--destructive))"},children:[r.errorCount," err"]}),!r.active&&r.journalSpawned&&c.jsx("span",{style:{color:"hsl(var(--primary))"},children:"journal"})]}),((g=r.summaries)==null?void 0:g.length)>0&&c.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:(C=r.summaries[r.summaries.length-1])==null?void 0:C.summary})]}),c.jsx("div",{className:"px-3 pb-2",children:c.jsxs("div",{className:"rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[c.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"}}),c.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"?yA[h.category]||"Working":"Idle"}),h.status==="working"&&h.tool&&c.jsx("span",{className:"text-[10px] tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:h.tool}),h.status==="working"&&h.currentActivity&&c.jsx("span",{className:"text-[10px] tabular-nums ml-auto",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:sh(Date.now()-h.currentActivity.startTime)})]}),h.activityLog&&h.activityLog.length>0&&c.jsx("div",{className:"flex items-center gap-0.5 mt-1",children:h.activityLog.slice(-6).map((b,w,_)=>c.jsx("div",{className:"h-1 rounded-full",title:`${b.tool||"thinking"} — ${sh(b.duration)}`,style:{width:Math.max(4,Math.min(16,(b.duration||0)/1e3*2)),background:pf[b.category]||(h.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+w/_.length*.6}},w))}),t&&t.length>0&&c.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((b,w)=>c.jsxs("div",{className:"flex items-center gap-1 text-[10px]",style:{color:b.error?"hsl(var(--destructive))":"hsl(var(--muted-foreground))"},children:[b.error&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--destructive))"}}),c.jsx("span",{className:"font-medium shrink-0",children:b.tool}),b.category&&!b.error&&c.jsx("span",{className:"shrink-0 opacity-50",style:{color:pf[b.category]},children:b.category}),b.error?c.jsx("span",{className:"truncate",title:b.error.type,children:pm[b.error.type]||b.error.type}):b.detail?c.jsx("span",{className:"truncate opacity-60",title:b.detail,children:b.detail.split("/").pop()}):null]},w))}),f.length>0&&c.jsxs("div",{className:"mt-1.5",children:[c.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=>c.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[c.jsx("span",{children:b.status==="in_progress"?"◆":"◇"}),c.jsx("span",{className:"truncate",children:b.title})]},b.id))]}),e&&e.length>0&&c.jsxs("div",{className:"mt-1.5",children:[c.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)=>c.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--destructive))"},children:[c.jsx("span",{className:"font-medium shrink-0",children:pm[b.errorType]||b.errorType}),c.jsx("span",{className:"truncate opacity-70",title:b.message,children:b.message})]},w))]}),i&&i.length>0&&c.jsxs("div",{className:"mt-1.5",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Subagents"}),i.map(b=>c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[c.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"}}),c.jsx("span",{className:"font-medium shrink-0",children:b.agentType}),c.jsx("span",{className:"truncate opacity-60",children:b.status}),c.jsx("span",{className:"tabular-nums ml-auto opacity-50",children:sh(Date.now()-new Date(b.startedAt).getTime())})]},b.agentId))]})]})})]})]})}const kA=qt.memo(CA),To={DECISION:1,PENDING_GATE:2,BLOCKED:3};function Fy(t,e){const r=new Set((e||[]).filter(s=>s.status==="pending").map(s=>s.itemId)),n=new Map,i=(s,o,a)=>{const l=n.get(s.id);(!l||o>l.priority)&&n.set(s.id,{item:s,priority:o,reason:a})};for(const s of t||[])s.status==="blocked"&&i(s,To.BLOCKED,"Blocked"),r.has(s.id)&&i(s,To.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,To.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function vA(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,l=Math.min(100,Math.max(0,Math.round(a))),h=e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," "):"";return{isRunning:o,pct:l,stepLabel:h,featureCode:s||"",stepNum:r??0,totalSteps:n??0,status:i||""}}function Dy(t,e){const r=t||[],n=e||[];let i=0,s=0,o=0;for(const l of r)l.status==="in_progress"&&i++,l.status==="blocked"&&s++;const a=n.filter(l=>l.status==="pending"||l.status==="awaiting").length;return o=Fy(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function wA(t,e){return t&&t===e?null:e}const SA={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"}},TA={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function tp({status:t,className:e}){const r=SA[t]||TA,n=t?t.replace(/_/g," "):"—";return c.jsxs("span",{className:st("inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",r.bg,r.text,e),children:[c.jsx("span",{className:st("w-1 h-1 rounded-full shrink-0",r.dot)}),n]})}const _A={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"},jA="text-slate-400 bg-slate-500/10 border-slate-500/20";function NA({phase:t,className:e}){const r=_A[t]||jA;return c.jsx("span",{className:st("inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-mono",r,e),children:t||"—"})}async function Nn(t,e={}){const r=await Mt(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let oh=null;function Py(t){if(oh)return;const e=window.location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${e}//${window.location.host}/ws/vision`);oh=r,r.onmessage=n=>{try{const i=JSON.parse(n.data);i.type==="ideaboxUpdated"&&t(i)}catch{}},r.onclose=()=>{oh=null,setTimeout(()=>{Py(t)},3e3)},r.onerror=()=>{}}const ys=Xd((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{Py(()=>{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 Nn("/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 Nn("/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 Nn(`/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 Nn(`/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 Nn(`/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 Nn(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await Nn(`/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 Nn(`/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 EA({activeBuild:t}){const e=vA(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 c.jsxs("div",{className:"mx-3 mb-2 rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(ul,{className:"h-3 w-3 shrink-0",style:{color:r}}),c.jsx("span",{className:"text-[10px] font-medium truncate max-w-[100px]",style:{color:"hsl(var(--foreground))"},children:e.featureCode||"Build"})]}),c.jsxs("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))"},children:[e.stepNum,"/",e.totalSteps]})]}),c.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${e.pct}%`,background:r}})}),c.jsxs("div",{className:"flex items-center justify-between mt-1",children:[c.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:e.stepLabel}),e.isRunning&&c.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 BA({items:t,gates:e,onSelectItem:r,onViewChange:n}){const i=qt.useMemo(()=>Fy(t,e),[t,e]);if(i.length===0)return null;const s=i.slice(0,5),o=i.length-s.length,a=l=>l===To.BLOCKED?c.jsx(oc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):l===To.PENDING_GATE?c.jsx(wT,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):c.jsx(vS,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--muted-foreground))"}});return c.jsxs("div",{className:"px-2 mb-2",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Needs Attention"}),s.map(({item:l,priority:h,reason:u})=>c.jsxs("button",{onClick:()=>r==null?void 0:r(l.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:u,children:[a(h),c.jsx("span",{className:"truncate flex-1 text-left",children:l.title}),l.phase&&c.jsx(NA,{phase:l.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),c.jsx(tp,{status:l.status,className:"shrink-0"})]},l.id)),o>0&&c.jsxs("button",{onClick:()=>n==null?void 0:n("attention"),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:["+",o," more"]})]})}function LA({items:t,gates:e}){const r=qt.useMemo(()=>Dy(t,e),[t,e]);return r.total===0?null:c.jsxs("div",{className:"flex items-center gap-2 flex-wrap px-3 pb-1",children:[c.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.total," items"]}),r.inProgress>0&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--primary))"},children:[r.inProgress," active"]}),r.blocked>0&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--destructive))"},children:[r.blocked," blocked"]}),r.pendingGates>0&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--warning))"},children:[r.pendingGates," ",r.pendingGates===1?"gate":"gates"]})]})}const AA=new Set(["planned","ready","in_progress","review","blocked","parked"]);function MA({items:t,hiddenGroups:e,onToggleGroup:r}){const n=qt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!AA.has(o.status))continue;const l=o.group||"other";i[l]=(i[l]||0)+1,["in_progress","review","ready"].includes(o.status)&&(s[l]=(s[l]||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:c.jsx(c.Fragment,{children:n.map(({group:i,count:s,active:o})=>{const a=e==null?void 0:e.has(i);return c.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:[c.jsx("span",{className:"truncate flex-1 text-left",children:i}),o>0&&c.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--primary))"},children:o}),c.jsx("span",{className:"text-[10px] tabular-nums shrink-0",style:{color:"hsl(var(--muted-foreground))"},children:s})]},i)})})}function IA({onViewChange:t}){const e=ys(n=>n.ideas),r=qt.useMemo(()=>e.filter(n=>!n.priority||n.priority==="—").length,[e]);return r===0?null:c.jsxs("div",{className:"px-2 mb-2",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Ideas"}),c.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:[c.jsx(fi,{className:"h-3 w-3 shrink-0 text-amber-400"}),c.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function Oy({items:t,gates:e,activeBuild:r,onViewChange:n,selectedPhase:i,onPhaseSelect:s,selectedTrack:o,onTrackSelect:a,visibleTracks:l,onToggleVisibleTrack:h,onShowAllTracks:u,hiddenGroups:d,onToggleGroup:f,searchQuery:p,onSearchChange:m,connected:x,agentActivity:g,agentErrors:y,spawnedAgents:C,agentRelays:b,sessionState:w,onSelectItem:_,onStopAgent:S,onThemeChange:N,onNewItem:A,widthPx:L}){const j=t||[],F=e||[],z=qt.useMemo(()=>Dy(j,F),[j,F]),[W,P]=qt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));qt.useEffect(()=>{if(typeof document>"u")return;const M=new MutationObserver(()=>{P(document.documentElement.classList.contains("dark"))});return M.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>M.disconnect()},[]);const I=qt.useCallback(()=>{const M=!W,O=M?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",M);try{localStorage.setItem("compose:theme",O)}catch{}N&&N({ui:{theme:O}})},[W,N]);return qt.useCallback(M=>{s&&s(wA(i,M))},[s,i]),c.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:L??208},children:[c.jsxs("div",{className:"p-3 pb-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"Compose"}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[!x&&c.jsx("span",{className:"text-[10px] text-destructive",children:"disconnected"}),A&&c.jsxs("button",{onClick:A,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:[c.jsx(Vh,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"New"})]}),c.jsx("button",{onClick:I,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:W?"Switch to light mode":"Switch to dark mode",children:W?c.jsx(ET,{className:"h-3.5 w-3.5"}):c.jsx(cT,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(LA,{items:j,gates:F})]}),c.jsx(EA,{activeBuild:r}),c.jsx(kA,{agentActivity:g,agentErrors:y,sessionState:w,onSelectItem:_,onStopAgent:S,spawnedAgents:C,agentRelays:b}),z.attentionCount>0&&c.jsxs(c.Fragment,{children:[c.jsx(Cl,{className:"bg-sidebar-border"}),c.jsx(BA,{items:j,gates:F,onSelectItem:_,onViewChange:n})]}),c.jsx(IA,{onViewChange:n}),c.jsx("div",{className:"px-3 pb-2",children:c.jsxs("div",{className:"relative",children:[c.jsx(bn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(yd,{placeholder:"Search...",value:p,onChange:M=>m(M.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),c.jsx(Cl,{className:"bg-sidebar-border"}),c.jsx($n,{className:"flex-1",children:c.jsxs("div",{className:"p-2",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Groups"}),c.jsx(MA,{items:j,hiddenGroups:d,onToggleGroup:f})]})})]})}function FA({level:t,size:e=4}){return c.jsx("div",{className:"flex items-center gap-px",children:[0,1,2,3].map(r=>c.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 ea({featureCode:t,active:e,onToggle:r}){return t?c.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 ep({icon:t=KS,title:e,description:r,action:n,onAction:i,className:s}){return c.jsxs("div",{className:st("flex flex-col items-center justify-center gap-3 p-8 text-center",s),children:[c.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-muted/50",children:c.jsx(t,{className:"w-6 h-6 text-muted-foreground/60"})}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("h3",{className:"text-sm font-medium text-foreground",children:e}),r&&c.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),n&&c.jsx(Pt,{variant:"outline",size:"sm",onClick:i,children:n})]})}const fm=[{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"]}],DA=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function mm({active:t,onClick:e,children:r}){return c.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 $y({item:t,children:e,depth:r,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o}){const a=e.length>0,l=o.has(t.id),h=n===t.id,u=mr[t.type]||mr.task,d=On[t.status]||On.planned,{newIds:f,changedIds:p}=k.useContext(dc),m=f.has(t.id),x=p.has(t.id);return c.jsxs("div",{children:[c.jsxs("div",{"data-item-id":t.id,onClick:()=>i(t.id),className:st("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:[c.jsx("button",{onClick:g=>{g.stopPropagation(),a&&s(t.id)},className:st("shrink-0 w-4 h-4 flex items-center justify-center rounded",a?"text-muted-foreground hover:text-foreground":"invisible"),children:a&&(l?c.jsx(Es,{className:"h-3.5 w-3.5"}):c.jsx(pi,{className:"h-3.5 w-3.5"}))}),c.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:d}}),c.jsx("span",{className:"text-[9px] uppercase tracking-wider shrink-0 w-12",style:{color:u},children:t.type}),c.jsx("span",{className:st("text-sm text-foreground truncate flex-1",t.status==="killed"&&"line-through opacity-50"),children:t.title}),c.jsx(FA,{level:t.confidence||0}),t.phase&&c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-3.5 shrink-0",children:t.phase})]}),a&&l&&c.jsx("div",{children:e.map(g=>c.jsx($y,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function Ry({items:t,connections:e,selectedItemId:r,onSelect:n,onCreate:i,onCreateFeature:s,isEmptyProject:o,featureCode:a,focusActive:l,onToggleFocus:h}){const[u,d]=k.useState(()=>new Set),[f,p]=k.useState(""),[m,x]=k.useState("all"),[g,y]=k.useState("all"),C=k.useCallback(N=>{d(A=>{const L=new Set(A);return L.has(N)?L.delete(N):L.add(N),L})},[]),b=k.useMemo(()=>{let N=t;const A=fm.find(L=>L.key===m);if(A!=null&&A.statuses&&(N=N.filter(L=>A.statuses.includes(L.status||"planned"))),g!=="all"&&(N=N.filter(L=>L.type===g)),f){const L=f.toLowerCase();N=N.filter(j=>(j.title||"").toLowerCase().includes(L)||(j.description||"").toLowerCase().includes(L)||(j.type||"").toLowerCase().includes(L)||(j.phase||"").toLowerCase().includes(L))}return l&&a&&(N=N.filter(L=>{var j;return L.featureCode===a||((j=L.lifecycle)==null?void 0:j.featureCode)===a||(L.title||"").includes(a)})),N},[t,f,m,g,l,a]),w=k.useMemo(()=>{const N=new Set(b.map(z=>z.id)),A=new Map;for(const z of b)A.set(z.id,{...z,_children:[]});const L=new Map;for(const z of e)!N.has(z.fromId)||!N.has(z.toId)||(z.type==="informs"?L.has(z.toId)||L.set(z.toId,z.fromId):(z.type==="supports"||z.type==="blocks")&&(L.has(z.fromId)||L.set(z.fromId,z.toId)));for(const z of t)z.parentId&&A.has(z.parentId)&&L.set(z.id,z.parentId);for(const[z]of L){const W=new Set;let P=z;for(;P&&L.has(P);){if(W.has(P)){L.delete(P);break}W.add(P),P=L.get(P)}}const j=[];for(const z of A.values()){const W=L.get(z.id);W&&A.has(W)?A.get(W)._children.push(z):j.push(z)}const F=z=>{z.sort((W,P)=>(W.confidence||0)-(P.confidence||0));for(const W of z)W._children.length>0&&F(W._children)};return F(j),j},[b,e]);qt.useEffect(()=>{if(f){const N=new Set,A=L=>{for(const j of L)j._children.length>0&&(N.add(j.id),A(j._children))};A(w),d(N)}else u.size===0&&w.length>0&&d(new Set(w.map(N=>N.id)))},[w,f]),qt.useEffect(()=>{if(!r||w.length===0)return;const N=[],A=(L,j)=>{for(const F of L){if(F.id===j)return!0;if(F._children.length>0&&A(F._children,j))return N.push(F.id),!0}return!1};A(w,r),N.length>0&&d(L=>{const j=new Set(L);for(const F of N)j.add(F);return j}),requestAnimationFrame(()=>{const L=document.querySelector(`[data-item-id="${r}"]`);L&&L.scrollIntoView({block:"center",behavior:"smooth"})})},[r,w]);const _=k.useCallback(()=>{const N=new Set,A=L=>{for(const j of L)j._children.length>0&&(N.add(j.id),A(j._children))};A(w),d(N)},[w]),S=k.useCallback(()=>{d(new Set)},[]);return w.filter(N=>N._children.length>0).length,c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[c.jsx(ea,{featureCode:a,active:l,onToggle:h}),c.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[c.jsx(bn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(yd,{placeholder:"Search items...",value:f,onChange:N=>p(N.target.value),className:"h-7 pl-7 pr-7 text-xs"}),f&&c.jsx("button",{onClick:()=>p(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c.jsx(yn,{className:"h-3 w-3"})})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Status:"}),fm.map(N=>c.jsx(mm,{active:m===N.key,onClick:()=>x(N.key),children:N.label},N.key))]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Type:"}),DA.map(N=>c.jsx(mm,{active:g===N.key,onClick:()=>y(N.key),children:N.label},N.key))]}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[b.length,f||m!=="all"||g!=="all"?`/${t.length}`:""]}),c.jsx("div",{className:"flex-1"}),c.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"}),c.jsx("button",{onClick:S,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&&c.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:c.jsx(Vh,{className:"h-3.5 w-3.5"})})]}),c.jsx($n,{className:"flex-1",children:c.jsx("div",{className:"py-1",children:w.length===0?o?c.jsx(ep,{icon:Vh,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"}):c.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No items match the current filters"}):w.map(N=>c.jsx($y,{item:N,children:N._children,depth:0,selectedItemId:r,onSelect:n,onToggle:C,expandedIds:u},N.id))})})]})}try{Ko.use(Xx)}catch{}try{Ko.use(fS)}catch{}const kl={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},PA=Object.fromEntries(Object.entries(mr).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(l=>l.toString(16).padStart(2,"0")).join("")}`]})),OA=[1,1.5,2,2.5,3],au={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"}},gm=[{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 uo(t){return t.group||"other"}const xm=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,ah=24;function $A(t){if(!t||t.length<=ah)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>ah-1)break;r=i}return(r||t.slice(0,ah-1))+"…"}function RA(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&xm.test(e))return e;if(t.id&&xm.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?$A(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(`
304
- `)}function zA(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 l=new Set;if(r){const d=[...new Set(t.map(f=>uo(f)).filter(Boolean))].map(f=>{const p=t.filter(y=>uo(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;l.add(f);const x=a&&t.some(g=>uo(g)===f&&a.has(g.id));s.push({data:{id:`group-${f}`,label:`${ym(f)}
305
- (${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(RA(u),14),p=uo(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&&l.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=au[u.type]||au.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 WA(){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(kl).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(PA).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...OA.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 qA({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=kl[n.status]||kl.planned,s=mr[n.itemType]||"#94a3b8",o=e+300>window.innerWidth?e-294:e+14,a=Math.min(r-10,window.innerHeight-200);return c.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:[c.jsx("div",{style:{fontWeight:700,fontSize:13,color:"#f8fafc",marginBottom:3},children:n.slug}),c.jsx("div",{style:{color:"#94a3b8",marginBottom:6,lineHeight:1.4},children:n.title}),c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[c.jsx(lh,{color:i,children:(n.status||"planned").replace("_"," ")}),c.jsx(lh,{color:s,children:n.itemType}),n.phase&&c.jsx(lh,{color:"#94a3b8",children:dl[n.phase]||n.phase})]}),n.description&&c.jsx("div",{style:{marginTop:8,color:"#94a3b8",fontSize:11,lineHeight:1.4},children:n.description.length>140?n.description.slice(0,140)+"…":n.description}),c.jsxs("div",{style:{marginTop:6,color:"#64748b",fontSize:10},children:[Nd[n.confidence||0]," confidence"]})]})}function HA({data:t,onApply:e,onClose:r}){const{x:n,y:i,currentGroup:s}=t,[o,a]=k.useState(s||""),l=k.useRef(null);k.useEffect(()=>{var f,p;(f=l.current)==null||f.focus(),(p=l.current)==null||p.select()},[]),k.useEffect(()=>{const f=p=>{p.key==="Escape"&&r()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[r]),k.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 c.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:[c.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Change group"}),c.jsx("input",{ref:l,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"}}),c.jsxs("div",{style:{display:"flex",gap:6,marginTop:8,justifyContent:"flex-end"},children:[c.jsx("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"transparent",color:"#94a3b8",border:"1px solid #334155"},children:"Cancel"}),c.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 lh({color:t,children:e}){return c.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 zy={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function Qs({active:t,onClick:e,children:r}){return c.jsx("button",{onClick:e,style:{...zy,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function ch({onClick:t,children:e,title:r}){return c.jsx("button",{onClick:t,title:r,style:{...zy,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function Ta(){return c.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const UA=["build-building","build-gate-pending","build-blocked-downstream","build-error"],YA={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 GA({badge:t,onClick:e}){const r=YA[t.state];return r?c.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 VA({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}),l=a&&(e==null?void 0:e.find(u=>u.itemId===a.id&&!u.resolvedAt));if(!l)return null;const h=l.stepId?l.stepId.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):"Gate";return c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{position:"fixed",inset:0,zIndex:199},onClick:s}),c.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:[c.jsx("div",{style:{fontSize:10,color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:4},children:h}),c.jsx("div",{style:{fontSize:12,color:"#f8fafc",fontWeight:600,marginBottom:8},children:t}),c.jsxs("div",{style:{display:"flex",gap:4},children:[c.jsx("button",{onClick:()=>i(l.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"}),c.jsx("button",{onClick:()=>i(l.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"}),c.jsx("button",{onClick:()=>i(l.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 Wy({items:t,connections:e,selectedItemId:r,onSelect:n,onCreateFeature:i,isEmptyProject:s,visibleTracks:o,hiddenGroups:a,buildStateMap:l,resolveGate:h,gates:u,spawnedAgents:d,agentRelays:f,agentOverlay:p,featureCode:m,focusActive:x,onToggleFocus:g}){const y=k.useRef(null),C=k.useRef(null),b=k.useRef({}),w=k.useRef(!1),_=k.useRef({}),S=k.useRef(null),[N,A]=k.useState(null),[L,j]=k.useState("active"),[F,z]=k.useState(!0),[W,P]=k.useState(!1),[I,M]=k.useState(null),[O,$]=k.useState(null),[B,T]=k.useState([]),[G,tt]=k.useState(!1),[D,V]=k.useState(!1),ht=ys(X=>X.ideas);k.useEffect(()=>{let X=!1;return Mt("/api/graph/layout").then(nt=>nt.ok?nt.json():{positions:{}}).then(nt=>{if(X)return;b.current=nt.positions||{},w.current=!0;const Z=C.current;Z&&_t(Z)}).catch(()=>{w.current=!0}),()=>{X=!0}},[]);const ct=k.useCallback(()=>{const X=_.current;_.current={},S.current=null,Object.keys(X).length&&Mt("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:X})}).catch(nt=>console.warn("[graph-layout] save failed:",nt))},[]),Ft=k.useCallback(X=>{Object.assign(_.current,X),Object.assign(b.current,X),S.current&&clearTimeout(S.current),S.current=setTimeout(ct,500)},[ct]),_t=k.useCallback(X=>{const nt=b.current,Z={};X.nodes("node[status]").forEach(dt=>{const H=dt.data();if(H.isAgentNode||H.isIdeaNode)return;const rt=dt.id(),ft=nt[rt];if(ft&&Number.isFinite(ft.x)&&Number.isFinite(ft.y))dt.position({x:ft.x,y:ft.y});else{const wt=dt.position();Number.isFinite(wt.x)&&Number.isFinite(wt.y)&&(Z[rt]={x:wt.x,y:wt.y})}}),Object.keys(Z).length&&Ft(Z)},[Ft]),lt=k.useRef(!1);k.useEffect(()=>{const X=d==null?void 0:d.some(nt=>nt.status==="running");X&&!lt.current?tt(!0):!X&&lt.current&&(d==null?void 0:d.length)>0&&tt(!1),lt.current=!!X},[d]);const Y=k.useMemo(()=>t.filter(X=>{const nt=X.title||"";return!nt.startsWith("`docs/")&&!nt.startsWith("docs/")}),[t]),ot=k.useMemo(()=>{let X=Y;const nt=gm.find(Z=>Z.key===L);if(nt!=null&&nt.statuses&&(X=X.filter(Z=>nt.statuses.includes(Z.status||"planned"))),o){const Z=dt=>{const H=(dt.description||"").match(/Track:\s*(\w+)/i);return H?H[1].toLowerCase():dt.type||"other"};X=X.filter(dt=>o.has(Z(dt)))}return(a==null?void 0:a.size)>0&&(X=X.filter(Z=>!a.has(uo(Z)))),X},[Y,L,o,a]),kt=k.useMemo(()=>{const X=new Set(ot.map(nt=>nt.id));return e.filter(nt=>X.has(nt.fromId)&&X.has(nt.toId))},[e,ot]),Tt=k.useMemo(()=>!p||!p.nodes.length?[]:[...p.nodes,...p.edges],[d]),ee=k.useMemo(()=>{if(!D)return[];new Set(ot.map(nt=>nt.id));const X=[];for(const nt of ht){if(!nt.mapsTo)continue;const Z=`idea-${nt.id}`;X.push({data:{id:Z,label:`${nt.id}
306
- ${nt.title.slice(0,20)}${nt.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:nt.id},classes:"idea-node"});const dt=nt.mapsTo.split(",").map(H=>H.trim()).filter(Boolean);for(const H of dt){const rt=ot.find(ft=>{var wt;return((wt=ft.lifecycle)==null?void 0:wt.featureCode)===H||ft.featureCode===H||(ft.title||"").startsWith(H)});rt&&X.push({data:{id:`idea-edge-${nt.id}-${rt.id}`,source:Z,target:rt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return X},[D,ht,ot]),le=k.useMemo(()=>{let nt=zA(ot,kt,F,x,m);return G&&Tt.length>0&&(nt=[...nt,...Tt]),D&&ee.length>0&&(nt=[...nt,...ee]),nt},[ot,kt,F,G,Tt,D,ee,x,m]),Zt=k.useMemo(()=>WA(),[]);k.useEffect(()=>{if(!y.current)return;C.current&&(C.current.destroy(),C.current=null);const X=Ko({container:y.current,elements:le,style:Zt,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(C.current=X,X.one("layoutstop",()=>{w.current&&_t(X),X.fit(void 0,30)}),X.fit(void 0,30),X.on("dragfree","node[status]",nt=>{const Z=nt.target,dt=Z.data();if(dt.isAgentNode||dt.isIdeaNode)return;const H=Z.position();!Number.isFinite(H.x)||!Number.isFinite(H.y)||Ft({[Z.id()]:{x:H.x,y:H.y}})}),r){const nt=X.$id(r);nt.length&&hh(X,nt)}return X.on("mouseover","node[status]",nt=>{const Z=nt.renderedPosition||nt.position,dt=X.container().getBoundingClientRect();A({x:dt.left+Z.x,y:dt.top+Z.y,item:nt.target.data()})}),X.on("mousemove","node[status]",nt=>{const Z=nt.renderedPosition||nt.position,dt=X.container().getBoundingClientRect();A(H=>H?{x:dt.left+Z.x,y:dt.top+Z.y,item:H.item}:null)}),X.on("mouseout","node[status]",()=>A(null)),X.on("tap","node[status]",nt=>{$e.current=!0,hh(X,nt.target),n(nt.target.id())}),X.on("tap",nt=>{nt.target===X&&X.elements().removeClass("dimmed highlighted")}),X.on("cxttap","node[status]",nt=>{var rt;const Z=nt.target.data();if(Z.isAgentNode||Z.isIdeaNode||Z.isGroup)return;try{(rt=nt.originalEvent)==null||rt.preventDefault()}catch{}const dt=nt.renderedPosition||nt.position,H=X.container().getBoundingClientRect();$({x:H.left+dt.x,y:H.top+dt.y,itemId:nt.target.id(),currentGroup:Z.group||""}),A(null)}),X.container().addEventListener("contextmenu",nt=>nt.preventDefault()),()=>{S.current&&(clearTimeout(S.current),ct()),X.destroy(),C.current=null}},[le,Zt]);const $e=k.useRef(!1);k.useEffect(()=>{const X=C.current;if(!X||!r)return;const nt=X.$id(r);nt.length&&(X.elements().removeClass("dimmed highlighted"),hh(X,nt),$e.current||X.animate({center:{eles:nt},duration:200}),$e.current=!1)},[r]),k.useEffect(()=>{const X=C.current;if(X&&(X.nodes().removeClass(UA.join(" ")),!(!l||Object.keys(l).length===0)))for(const[nt,Z]of Object.entries(l)){const dt=`build-${Z.replace(/_/g,"-")}`,H=X.nodes().filter(rt=>{const ft=rt.data();return ft.slug===nt||ft.title===nt||ft.featureCode===nt});H.length&&H.addClass(dt)}},[l]),k.useEffect(()=>{const X=C.current;if(!X||!l||!Object.values(l).includes("building"))return;let Z=!0;const dt=setInterval(()=>{const H=X.nodes(".build-building");H.length&&(Z=!Z,H.style("shadow-blur",Z?12:4),H.style("shadow-opacity",Z?.6:.2))},800);return()=>clearInterval(dt)},[l]),k.useEffect(()=>{var H;const X=C.current;if(!X||(X.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!G||!((H=p==null?void 0:p.activeEdgeIds)!=null&&H.size)))return;const nt=new Set((d||[]).map(rt=>rt.agentId)),Z=rt=>rt==="session"?"agent-session":nt.has(rt)?`agent-${rt}`:"agent-session";for(const rt of p.activeEdgeIds){const ft=X.getElementById(rt);if(ft.length){const wt=f==null?void 0:f.findLast(Ot=>{const pe=Z(Ot.fromAgentId),ce=Z(Ot.toAgentId);return(Ot.direction==="dispatch"?`relay-${pe}-${ce}`:`relay-${ce}-${pe}`)===rt});ft.addClass((wt==null?void 0:wt.direction)==="result"?"relay-result":"relay-active")}}const dt=setInterval(()=>{const rt=X.edges(".relay-active, .relay-result");if(!rt.length)return;const ft=Date.now()/20%100;rt.style("line-dash-offset",-ft)},50);return()=>clearInterval(dt)},[G,p==null?void 0:p.activeEdgeIds,f]);const Xt=k.useCallback(()=>{const X=C.current;if(!X||!l||Object.keys(l).length===0){T([]);return}const nt=[];for(const[Z,dt]of Object.entries(l)){if(dt!=="gate_pending"&&dt!=="error"&&dt!=="building")continue;const H=X.nodes().filter(wt=>{const Ot=wt.data();return Ot.slug===Z||Ot.title===Z||Ot.featureCode===Z});if(!H.length)continue;const rt=H.renderedPosition(),ft=H.renderedOuterWidth();nt.push({featureCode:Z,state:dt,x:rt.x+ft/2-6,y:rt.y-H.renderedOuterHeight()/2-6,nodeId:H.id()})}T(nt)},[l]);k.useEffect(()=>{const X=C.current;if(X)return X.on("render pan zoom",Xt),Xt(),()=>{X.removeListener("render pan zoom",Xt)}},[Xt]);const Re=k.useCallback(()=>{var X;return(X=C.current)==null?void 0:X.fit(void 0,40)},[]),re=k.useCallback(()=>{const X=C.current;X&&X.zoom({level:X.zoom()*1.3,renderedPosition:{x:X.width()/2,y:X.height()/2}})},[]),Ae=k.useCallback(()=>{const X=C.current;X&&X.zoom({level:X.zoom()/1.3,renderedPosition:{x:X.width()/2,y:X.height()/2}})},[]);return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",style:{background:"#0f172a"},children:[c.jsx("div",{className:"shrink-0",style:{background:"#1e293b",borderBottom:"1px solid #334155"},children:c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(ea,{featureCode:m,active:x,onToggle:g}),m&&c.jsx(Ta,{}),c.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),gm.map(X=>c.jsx(Qs,{active:L===X.key,onClick:()=>j(X.key),children:X.label},X.key)),c.jsx(Ta,{}),c.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[ot.length," items · ",kt.length," edges"]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(Qs,{active:F,onClick:()=>z(!F),children:"Group"}),c.jsx(Qs,{active:G,onClick:()=>tt(X=>!X),title:"Show/hide agent topology",children:"Agents"}),c.jsx(Qs,{active:D,onClick:()=>V(X=>!X),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),c.jsx(Ta,{}),c.jsx(ch,{onClick:Ae,title:"Zoom out",children:"−"}),c.jsx(ch,{onClick:Re,title:"Fit to view",children:"Fit"}),c.jsx(ch,{onClick:re,title:"Zoom in",children:"+"}),c.jsx(Ta,{}),c.jsx(Qs,{active:W,onClick:()=>P(!W),children:"Legend"})]})]})}),ot.length===0&&!G?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("div",{style:{textAlign:"center"},children:s?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items yet"}),c.jsx("div",{style:{fontSize:11,color:"#475569",marginBottom:10},children:"Create your first feature to start building in the cockpit."}),i&&c.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"})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items match the current filters"}),c.jsx("div",{style:{fontSize:11,color:"#475569"},children:"Try adjusting the status or group filters"})]})})}):c.jsxs("div",{className:"flex-1 relative min-h-0",children:[c.jsx("div",{ref:y,className:"w-full h-full"}),W&&c.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:[c.jsx(uh,{title:"Types",children:Object.entries(mr).map(([X,nt])=>c.jsxs(ph,{children:[c.jsx(bm,{color:nt}),X]},X))}),c.jsx(dh,{}),c.jsx(uh,{title:"Status",children:Object.entries(kl).map(([X,nt])=>c.jsxs(ph,{children:[c.jsx(bm,{color:nt}),X.replace("_"," ")]},X))}),c.jsx(dh,{}),c.jsx(uh,{title:"Edges",children:Object.entries(au).map(([X,nt])=>c.jsxs(ph,{children:[c.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:c.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:nt.color,strokeWidth:"1.5",strokeDasharray:nt.style==="dashed"?"6,3":"none"})}),X]},X))}),c.jsx(dh,{}),c.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",c.jsx("br",{}),"Click node to trace deps"]})]}),c.jsx(qA,{data:N}),O&&c.jsx(HA,{data:O,onClose:()=>$(null),onApply:X=>{const nt=O.itemId;$(null),Mt(`/api/vision/items/${nt}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:X||null})}).catch(Z=>console.warn("[graph] group update failed:",Z))}}),B.map(X=>c.jsx(GA,{badge:X,onClick:X.state==="gate_pending"?()=>M(I===X.featureCode?null:X.featureCode):X.state==="error"?()=>n(X.nodeId):void 0},X.featureCode)),I&&c.jsx(VA,{featureCode:I,gates:u,items:t,badgePositions:B,onResolve:(X,nt)=>{h&&h(X,nt),M(null)},onClose:()=>M(null)})]})]})}function hh(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 uh({title:t,children:e}){return c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:5,fontWeight:700},children:t}),e]})}function dh(){return c.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function ph({children:t}){return c.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function bm({color:t}){return c.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}const qy=4e3,Cm={info:{color:"hsl(var(--foreground))",bg:"hsl(var(--muted))"},warn:{color:"hsl(var(--warning, 32 95% 52%))",bg:"hsl(var(--muted))"},error:{color:"hsl(var(--destructive))",bg:"hsl(var(--destructive) / 0.08)"}};function XA(){const[t,e]=k.useState(null),r=k.useRef(null);if(k.useEffect(()=>{function i(s){const{message:o,level:a="info",ttl:l=qy}=s.detail??{};o&&(clearTimeout(r.current),e({message:o,level:a}),l>0&&(r.current=setTimeout(()=>e(null),l)))}return window.addEventListener("compose:notify",i),()=>{window.removeEventListener("compose:notify",i),clearTimeout(r.current)}},[]),!t)return null;const n=Cm[t.level]??Cm.info;return c.jsxs("div",{className:"h-6 flex items-center justify-between px-3 gap-2 shrink-0 text-[11px] font-mono",style:{background:n.bg,color:n.color,borderTop:"1px solid hsl(var(--border))"},role:"status","aria-live":"polite",children:[c.jsx("span",{className:"flex-1 min-w-0 truncate",children:t.message}),c.jsx("button",{className:"shrink-0 opacity-60 hover:opacity-100 text-[10px]",onClick:()=>{clearTimeout(r.current),e(null)},"aria-label":"Dismiss notification",children:"✕"})]})}function _e(t,e="info",r=qy){try{window.dispatchEvent(new CustomEvent("compose:notify",{detail:{message:t,level:e,ttl:r}}))}catch{}}var Xa={exports:{}},KA=Xa.exports,km;function QA(){return km||(km=1,(function(t,e){(function(r,n){t.exports=n()})(KA,(function(){var r=1e3,n=6e4,i=36e5,s="millisecond",o="second",a="minute",l="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=/\[([^\]]+)]|YYYY|YY|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,C={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"],M=P%100;return"["+P+(I[(M-20)%10]||I[M]||I[0])+"]"}},b=function(P,I,M){var O=String(P);return!O||O.length>=I?P:""+Array(I+1-O.length).join(M)+P},w={s:b,z:function(P){var I=-P.utcOffset(),M=Math.abs(I),O=Math.floor(M/60),$=M%60;return(I<=0?"+":"-")+b(O,2,"0")+":"+b($,2,"0")},m:function P(I,M){if(I.date()<M.date())return-P(M,I);var O=12*(M.year()-I.year())+(M.month()-I.month()),$=I.clone().add(O,d),B=M-$<0,T=I.clone().add(O+(B?-1:1),d);return+(-(O+(M-$)/(B?$-T:T-$))||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:l,m:a,s:o,ms:s,Q:f}[P]||String(P||"").toLowerCase().replace(/s$/,"")},u:function(P){return P===void 0}},_="en",S={};S[_]=C;var N="$isDayjsObject",A=function(P){return P instanceof z||!(!P||!P[N])},L=function P(I,M,O){var $;if(!I)return _;if(typeof I=="string"){var B=I.toLowerCase();S[B]&&($=B),M&&(S[B]=M,$=B);var T=I.split("-");if(!$&&T.length>1)return P(T[0])}else{var G=I.name;S[G]=I,$=G}return!O&&$&&(_=$),$||!O&&_},j=function(P,I){if(A(P))return P.clone();var M=typeof I=="object"?I:{};return M.date=P,M.args=arguments,new z(M)},F=w;F.l=L,F.i=A,F.w=function(P,I){return j(P,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var z=(function(){function P(M){this.$L=L(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[N]=!0}var I=P.prototype;return I.parse=function(M){this.$d=(function(O){var $=O.date,B=O.utc;if($===null)return new Date(NaN);if(F.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var T=$.match(g);if(T){var G=T[2]-1||0,tt=(T[7]||"0").substring(0,3);return B?new Date(Date.UTC(T[1],G,T[3]||1,T[4]||0,T[5]||0,T[6]||0,tt)):new Date(T[1],G,T[3]||1,T[4]||0,T[5]||0,T[6]||0,tt)}}return new Date($)})(M),this.init()},I.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},I.$utils=function(){return F},I.isValid=function(){return this.$d.toString()!==x},I.isSame=function(M,O){var $=j(M);return this.startOf(O)<=$&&$<=this.endOf(O)},I.isAfter=function(M,O){return j(M)<this.startOf(O)},I.isBefore=function(M,O){return this.endOf(O)<j(M)},I.$g=function(M,O,$){return F.u(M)?this[O]:this.set($,M)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(M,O){var $=this,B=!!F.u(O)||O,T=F.p(M),G=function(lt,Y){var ot=F.w($.$u?Date.UTC($.$y,Y,lt):new Date($.$y,Y,lt),$);return B?ot:ot.endOf(h)},tt=function(lt,Y){return F.w($.toDate()[lt].apply($.toDate("s"),(B?[0,0,0,0]:[23,59,59,999]).slice(Y)),$)},D=this.$W,V=this.$M,ht=this.$D,ct="set"+(this.$u?"UTC":"");switch(T){case p:return B?G(1,0):G(31,11);case d:return B?G(1,V):G(0,V+1);case u:var Ft=this.$locale().weekStart||0,_t=(D<Ft?D+7:D)-Ft;return G(B?ht-_t:ht+(6-_t),V);case h:case m:return tt(ct+"Hours",0);case l:return tt(ct+"Minutes",1);case a:return tt(ct+"Seconds",2);case o:return tt(ct+"Milliseconds",3);default:return this.clone()}},I.endOf=function(M){return this.startOf(M,!1)},I.$set=function(M,O){var $,B=F.p(M),T="set"+(this.$u?"UTC":""),G=($={},$[h]=T+"Date",$[m]=T+"Date",$[d]=T+"Month",$[p]=T+"FullYear",$[l]=T+"Hours",$[a]=T+"Minutes",$[o]=T+"Seconds",$[s]=T+"Milliseconds",$)[B],tt=B===h?this.$D+(O-this.$W):O;if(B===d||B===p){var D=this.clone().set(m,1);D.$d[G](tt),D.init(),this.$d=D.set(m,Math.min(this.$D,D.daysInMonth())).$d}else G&&this.$d[G](tt);return this.init(),this},I.set=function(M,O){return this.clone().$set(M,O)},I.get=function(M){return this[F.p(M)]()},I.add=function(M,O){var $,B=this;M=Number(M);var T=F.p(O),G=function(V){var ht=j(B);return F.w(ht.date(ht.date()+Math.round(V*M)),B)};if(T===d)return this.set(d,this.$M+M);if(T===p)return this.set(p,this.$y+M);if(T===h)return G(1);if(T===u)return G(7);var tt=($={},$[a]=n,$[l]=i,$[o]=r,$)[T]||1,D=this.$d.getTime()+M*tt;return F.w(D,this)},I.subtract=function(M,O){return this.add(-1*M,O)},I.format=function(M){var O=this,$=this.$locale();if(!this.isValid())return $.invalidDate||x;var B=M||"YYYY-MM-DDTHH:mm:ssZ",T=F.z(this),G=this.$H,tt=this.$m,D=this.$M,V=$.weekdays,ht=$.months,ct=$.meridiem,Ft=function(Y,ot,kt,Tt){return Y&&(Y[ot]||Y(O,B))||kt[ot].slice(0,Tt)},_t=function(Y){return F.s(G%12||12,Y,"0")},lt=ct||function(Y,ot,kt){var Tt=Y<12?"AM":"PM";return kt?Tt.toLowerCase():Tt};return B.replace(y,(function(Y,ot){return ot||(function(kt){switch(kt){case"YY":return String(O.$y).slice(-2);case"YYYY":return F.s(O.$y,4,"0");case"M":return D+1;case"MM":return F.s(D+1,2,"0");case"MMM":return Ft($.monthsShort,D,ht,3);case"MMMM":return Ft(ht,D);case"D":return O.$D;case"DD":return F.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return Ft($.weekdaysMin,O.$W,V,2);case"ddd":return Ft($.weekdaysShort,O.$W,V,3);case"dddd":return V[O.$W];case"H":return String(G);case"HH":return F.s(G,2,"0");case"h":return _t(1);case"hh":return _t(2);case"a":return lt(G,tt,!0);case"A":return lt(G,tt,!1);case"m":return String(tt);case"mm":return F.s(tt,2,"0");case"s":return String(O.$s);case"ss":return F.s(O.$s,2,"0");case"SSS":return F.s(O.$ms,3,"0");case"Z":return T}return null})(Y)||T.replace(":","")}))},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(M,O,$){var B,T=this,G=F.p(O),tt=j(M),D=(tt.utcOffset()-this.utcOffset())*n,V=this-tt,ht=function(){return F.m(T,tt)};switch(G){case p:B=ht()/12;break;case d:B=ht();break;case f:B=ht()/3;break;case u:B=(V-D)/6048e5;break;case h:B=(V-D)/864e5;break;case l:B=V/i;break;case a:B=V/n;break;case o:B=V/r;break;default:B=V}return $?B:F.a(B)},I.daysInMonth=function(){return this.endOf(d).$D},I.$locale=function(){return S[this.$L]},I.locale=function(M,O){if(!M)return this.$L;var $=this.clone(),B=L(M,O,!0);return B&&($.$L=B),$},I.clone=function(){return F.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})(),W=z.prototype;return j.prototype=W,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",h],["$M",d],["$y",p],["$D",m]].forEach((function(P){W[P[1]]=function(I){return this.$g(I,P[0],P[1])}})),j.extend=function(P,I){return P.$i||(P(I,z,j),P.$i=!0),j},j.locale=L,j.isDayjs=A,j.unix=function(P){return j(1e3*P)},j.en=S[_],j.Ls=S,j.p={},j}))})(Xa)),Xa.exports}var ZA=QA();const JA=xd(ZA);var Hy=Object.defineProperty,v=(t,e)=>Hy(t,"name",{value:e,configurable:!0}),t3=(t,e)=>{for(var r in e)Hy(t,r,{get:e[r],enumerable:!0})},cn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},it={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},rp=v(function(t="fatal"){let e=cn.fatal;typeof t=="string"?t.toLowerCase()in cn&&(e=cn[t]):typeof t=="number"&&(e=t),it.trace=()=>{},it.debug=()=>{},it.info=()=>{},it.warn=()=>{},it.error=()=>{},it.fatal=()=>{},e<=cn.fatal&&(it.fatal=console.error?console.error.bind(console,Tr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Tr("FATAL"))),e<=cn.error&&(it.error=console.error?console.error.bind(console,Tr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Tr("ERROR"))),e<=cn.warn&&(it.warn=console.warn?console.warn.bind(console,Tr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Tr("WARN"))),e<=cn.info&&(it.info=console.info?console.info.bind(console,Tr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Tr("INFO"))),e<=cn.debug&&(it.debug=console.debug?console.debug.bind(console,Tr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Tr("DEBUG"))),e<=cn.trace&&(it.trace=console.debug?console.debug.bind(console,Tr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Tr("TRACE")))},"setLogLevel"),Tr=v(t=>`%c${JA().format("ss.SSS")} : ${t} : `,"format");const Ka={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 Ka.hue2rgb(s,i,t+1/3)*255;case"g":return Ka.hue2rgb(s,i,t)*255;case"b":return Ka.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,l=o>.5?a/(2-i-s):a/(i+s);if(n==="s")return l*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}}},e3={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},r3={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},It={channel:Ka,lang:e3,unit:r3},Ln={};for(let t=0;t<=255;t++)Ln[t]=It.unit.dec2hex(t);const We={ALL:0,RGB:1,HSL:2};class n3{constructor(){this.type=We.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=We.ALL}is(e){return this.type===e}}class i3{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new n3}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=We.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=It.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=It.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=It.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=It.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=It.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=It.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(We.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(We.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(We.HSL)&&r!==void 0?r:(this._ensureHSL(),It.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(We.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(We.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(We.RGB)&&r!==void 0?r:(this._ensureRGB(),It.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(We.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(We.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(We.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(We.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(We.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(We.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const mc=new i3({r:0,g:0,b:0,a:0},"transparent"),Zi={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(Zi.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,l=o?8:4,h=s?0:-1,u=o?255:15;return mc.set({r:(n>>l*(h+3)&u)*a,g:(n>>l*(h+2)&u)*a,b:(n>>l*(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?`#${Ln[Math.round(e)]}${Ln[Math.round(r)]}${Ln[Math.round(n)]}${Ln[Math.round(i*255)]}`:`#${Ln[Math.round(e)]}${Ln[Math.round(r)]}${Ln[Math.round(n)]}`}},si={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(si.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return It.channel.clamp.h(parseFloat(r)*.9);case"rad":return It.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return It.channel.clamp.h(parseFloat(r)*360)}}return It.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(si.re);if(!r)return;const[,n,i,s,o,a]=r;return mc.set({h:si._hue2deg(n),s:It.channel.clamp.s(parseFloat(i)),l:It.channel.clamp.l(parseFloat(s)),a:o?It.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(${It.lang.round(e)}, ${It.lang.round(r)}%, ${It.lang.round(n)}%, ${i})`:`hsl(${It.lang.round(e)}, ${It.lang.round(r)}%, ${It.lang.round(n)}%)`}},_o={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=_o.colors[t];if(e)return Zi.parse(e)},stringify:t=>{const e=Zi.stringify(t);for(const r in _o.colors)if(_o.colors[r]===e)return r}},po={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(po.re);if(!r)return;const[,n,i,s,o,a,l,h,u]=r;return mc.set({r:It.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:It.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:It.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:h?It.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(${It.lang.round(e)}, ${It.lang.round(r)}, ${It.lang.round(n)}, ${It.lang.round(i)})`:`rgb(${It.lang.round(e)}, ${It.lang.round(r)}, ${It.lang.round(n)})`}},Zr={format:{keyword:_o,hex:Zi,rgb:po,rgba:po,hsl:si,hsla:si},parse:t=>{if(typeof t!="string")return t;const e=Zi.parse(t)||po.parse(t)||si.parse(t)||_o.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(We.HSL)||t.data.r===void 0?si.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?po.stringify(t):Zi.stringify(t)},Uy=(t,e)=>{const r=Zr.parse(t);for(const n in e)r[n]=It.channel.clamp[n](e[n]);return Zr.stringify(r)},Fn=(t,e,r=0,n=1)=>{if(typeof t!="number")return Uy(t,{a:e});const i=mc.set({r:It.channel.clamp.r(t),g:It.channel.clamp.g(e),b:It.channel.clamp.b(r),a:It.channel.clamp.a(n)});return Zr.stringify(i)},s3=t=>{const{r:e,g:r,b:n}=Zr.parse(t),i=.2126*It.channel.toLinear(e)+.7152*It.channel.toLinear(r)+.0722*It.channel.toLinear(n);return It.lang.round(i)},o3=t=>s3(t)>=.5,Wr=t=>!o3(t),Yy=(t,e,r)=>{const n=Zr.parse(t),i=n[e],s=It.channel.clamp[e](i+r);return i!==s&&(n[e]=s),Zr.stringify(n)},K=(t,e)=>Yy(t,"l",e),Q=(t,e)=>Yy(t,"l",-e),E=(t,e)=>{const r=Zr.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return Uy(t,n)},a3=(t,e,r=50)=>{const{r:n,g:i,b:s,a:o}=Zr.parse(t),{r:a,g:l,b:h,a:u}=Zr.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,C=i*x+l*g,b=s*x+h*g,w=o*d+u*(1-d);return Fn(y,C,b,w)},U=(t,e=100)=>{const r=Zr.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,a3(r,t,e)};/*! @license DOMPurify 3.4.8 | (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.8/LICENSE */function vm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function l3(t){if(Array.isArray(t))return t}function c3(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,h=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){h=!0,i=u}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(h)throw i}}return a}}function h3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
307
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u3(t,e){return l3(t)||c3(t,e)||d3(t,e)||h3()}function d3(t,e){if(t){if(typeof t=="string")return vm(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vm(t,e):void 0}}const Gy=Object.entries,wm=Object.setPrototypeOf,p3=Object.isFrozen,f3=Object.getPrototypeOf,m3=Object.getOwnPropertyDescriptor;let nr=Object.freeze,jr=Object.seal,qi=Object.create,Vy=typeof Reflect<"u"&&Reflect,lu=Vy.apply,cu=Vy.construct;nr||(nr=function(e){return e});jr||(jr=function(e){return e});lu||(lu=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)});cu||(cu=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 Zn=je(Array.prototype.forEach),g3=je(Array.prototype.lastIndexOf),Sm=je(Array.prototype.pop),Ai=je(Array.prototype.push),x3=je(Array.prototype.splice),Ze=Array.isArray,fo=je(String.prototype.toLowerCase),fh=je(String.prototype.toString),Tm=je(String.prototype.match),Mi=je(String.prototype.replace),_m=je(String.prototype.indexOf),y3=je(String.prototype.trim),b3=je(Number.prototype.toString),C3=je(Boolean.prototype.toString),jm=typeof BigInt>"u"?null:je(BigInt.prototype.toString),Nm=typeof Symbol>"u"?null:je(Symbol.prototype.toString),xe=je(Object.prototype.hasOwnProperty),Zs=je(Object.prototype.toString),De=je(RegExp.prototype.test),Ii=k3(TypeError);function je(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 lu(t,e,n)}}function k3(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return cu(t,r)}}function zt(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fo;if(wm&&wm(t,null),!Ze(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(p3(e)||(e[n]=s),i=s)}t[i]=!0}return t}function v3(t){for(let e=0;e<t.length;e++)xe(t,e)||(t[e]=null);return t}function ze(t){const e=qi(null);for(const n of Gy(t)){var r=u3(n,2);const i=r[0],s=r[1];xe(t,i)&&(Ze(s)?e[i]=v3(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=ze(s):e[i]=s)}return e}function w3(t){switch(typeof t){case"string":return t;case"number":return b3(t);case"boolean":return C3(t);case"bigint":return jm?jm(t):"0";case"symbol":return Nm?Nm(t):"Symbol()";case"undefined":return Zs(t);case"function":case"object":{if(t===null)return Zs(t);const e=t,r=Yr(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:Zs(n)}return Zs(t)}default:return Zs(t)}}function Yr(t,e){for(;t!==null;){const n=m3(t,e);if(n){if(n.get)return je(n.get);if(typeof n.value=="function")return je(n.value)}t=f3(t)}function r(){return null}return r}function S3(t){try{return De(t,""),!0}catch{return!1}}const Em=nr(["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"]),mh=nr(["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"]),gh=nr(["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"]),T3=nr(["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"]),xh=nr(["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"]),_3=nr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Bm=nr(["#text"]),Lm=nr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),yh=nr(["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"]),Am=nr(["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"]),_a=nr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),j3=jr(/{{[\w\W]*|^[\w\W]*}}/g),N3=jr(/<%[\w\W]*|^[\w\W]*%>/g),E3=jr(/\${[\w\W]*/g),B3=jr(/^data-[\-\w.\u00B7-\uFFFF]+$/),L3=jr(/^aria-[\-\w]+$/),Mm=jr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),A3=jr(/^(?:\w+script|data):/i),M3=jr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),I3=jr(/^html$/i),F3=jr(/^[a-z][.\w]*(-[.\w]+)+$/i),Ur={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},D3=function(){return typeof window>"u"?null:window},P3=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}},Im=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Xy(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D3();const e=mt=>Xy(mt);if(e.version="3.4.8",e.removed=[],!t||!t.document||t.document.nodeType!==Ur.document||!t.Element)return e.isSupported=!1,e;let r=t.document;const n=r,i=n.currentScript;t.DocumentFragment;const s=t.HTMLTemplateElement,o=t.Node,a=t.Element,l=t.NodeFilter,h=t.NamedNodeMap;h===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,d=t.trustedTypes,f=a.prototype,p=Yr(f,"cloneNode"),m=Yr(f,"remove"),x=Yr(f,"nextSibling"),g=Yr(f,"childNodes"),y=Yr(f,"parentNode"),C=Yr(f,"shadowRoot"),b=Yr(f,"attributes"),w=o&&o.prototype?Yr(o.prototype,"nodeType"):null,_=o&&o.prototype?Yr(o.prototype,"nodeName"):null;if(typeof s=="function"){const mt=r.createElement("template");mt.content&&mt.content.ownerDocument&&(r=mt.content.ownerDocument)}let S,N="",A=0;const L=function(R){if(A>0)throw Ii('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');A++;try{return S.createHTML(R)}finally{A--}},j=r,F=j.implementation,z=j.createNodeIterator,W=j.createDocumentFragment,P=j.getElementsByTagName,I=n.importNode;let M=Im();e.isSupported=typeof Gy=="function"&&typeof y=="function"&&F&&F.createHTMLDocument!==void 0;const O=j3,$=N3,B=E3,T=B3,G=L3,tt=A3,D=M3,V=F3;let ht=Mm,ct=null;const Ft=zt({},[...Em,...mh,...gh,...xh,...Bm]);let _t=null;const lt=zt({},[...Lm,...yh,...Am,..._a]);let Y=Object.seal(qi(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}})),ot=null,kt=null;const Tt=Object.seal(qi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,le=!0,Zt=!1,$e=!0,Xt=!1,Re=!0,re=!1,Ae=!1,X=!1,nt=!1,Z=!1,dt=!1,H=!0,rt=!1;const ft="user-content-";let wt=!0,Ot=!1,pe={},ce=null;const Ne=zt({},["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 wr=null;const ye=zt({},["audio","video","img","source","image","track"]);let ve=null;const Me=zt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ie="http://www.w3.org/1998/Math/MathML",Gn="http://www.w3.org/2000/svg",Sr="http://www.w3.org/1999/xhtml";let Sn=Sr,Ps=!1,Os=null;const da=zt({},[Ie,Gn,Sr],fh);let $s=zt({},["mi","mo","mn","ms","mtext"]),Rs=zt({},["annotation-xml"]);const Vn=zt({},["title","style","font","a","script"]);let Xn=null;const ji=["application/xhtml+xml","text/html"],Fc="text/html";let he=null,Tn=null;const pa=r.createElement("form"),fa=function(R){return R instanceof RegExp||R instanceof Function},Ni=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Tn&&Tn===R)return;(!R||typeof R!="object")&&(R={}),R=ze(R),Xn=ji.indexOf(R.PARSER_MEDIA_TYPE)===-1?Fc:R.PARSER_MEDIA_TYPE,he=Xn==="application/xhtml+xml"?fh:fo,ct=xe(R,"ALLOWED_TAGS")&&Ze(R.ALLOWED_TAGS)?zt({},R.ALLOWED_TAGS,he):Ft,_t=xe(R,"ALLOWED_ATTR")&&Ze(R.ALLOWED_ATTR)?zt({},R.ALLOWED_ATTR,he):lt,Os=xe(R,"ALLOWED_NAMESPACES")&&Ze(R.ALLOWED_NAMESPACES)?zt({},R.ALLOWED_NAMESPACES,fh):da,ve=xe(R,"ADD_URI_SAFE_ATTR")&&Ze(R.ADD_URI_SAFE_ATTR)?zt(ze(Me),R.ADD_URI_SAFE_ATTR,he):Me,wr=xe(R,"ADD_DATA_URI_TAGS")&&Ze(R.ADD_DATA_URI_TAGS)?zt(ze(ye),R.ADD_DATA_URI_TAGS,he):ye,ce=xe(R,"FORBID_CONTENTS")&&Ze(R.FORBID_CONTENTS)?zt({},R.FORBID_CONTENTS,he):Ne,ot=xe(R,"FORBID_TAGS")&&Ze(R.FORBID_TAGS)?zt({},R.FORBID_TAGS,he):ze({}),kt=xe(R,"FORBID_ATTR")&&Ze(R.FORBID_ATTR)?zt({},R.FORBID_ATTR,he):ze({}),pe=xe(R,"USE_PROFILES")?R.USE_PROFILES&&typeof R.USE_PROFILES=="object"?ze(R.USE_PROFILES):R.USE_PROFILES:!1,ee=R.ALLOW_ARIA_ATTR!==!1,le=R.ALLOW_DATA_ATTR!==!1,Zt=R.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Xt=R.SAFE_FOR_TEMPLATES||!1,Re=R.SAFE_FOR_XML!==!1,re=R.WHOLE_DOCUMENT||!1,nt=R.RETURN_DOM||!1,Z=R.RETURN_DOM_FRAGMENT||!1,dt=R.RETURN_TRUSTED_TYPE||!1,X=R.FORCE_BODY||!1,H=R.SANITIZE_DOM!==!1,rt=R.SANITIZE_NAMED_PROPS||!1,wt=R.KEEP_CONTENT!==!1,Ot=R.IN_PLACE||!1,ht=S3(R.ALLOWED_URI_REGEXP)?R.ALLOWED_URI_REGEXP:Mm,Sn=typeof R.NAMESPACE=="string"?R.NAMESPACE:Sr,$s=xe(R,"MATHML_TEXT_INTEGRATION_POINTS")&&R.MATHML_TEXT_INTEGRATION_POINTS&&typeof R.MATHML_TEXT_INTEGRATION_POINTS=="object"?ze(R.MATHML_TEXT_INTEGRATION_POINTS):zt({},["mi","mo","mn","ms","mtext"]),Rs=xe(R,"HTML_INTEGRATION_POINTS")&&R.HTML_INTEGRATION_POINTS&&typeof R.HTML_INTEGRATION_POINTS=="object"?ze(R.HTML_INTEGRATION_POINTS):zt({},["annotation-xml"]);const et=xe(R,"CUSTOM_ELEMENT_HANDLING")&&R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING=="object"?ze(R.CUSTOM_ELEMENT_HANDLING):qi(null);if(Y=qi(null),xe(et,"tagNameCheck")&&fa(et.tagNameCheck)&&(Y.tagNameCheck=et.tagNameCheck),xe(et,"attributeNameCheck")&&fa(et.attributeNameCheck)&&(Y.attributeNameCheck=et.attributeNameCheck),xe(et,"allowCustomizedBuiltInElements")&&typeof et.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=et.allowCustomizedBuiltInElements),Xt&&(le=!1),Z&&(nt=!0),pe&&(ct=zt({},Bm),_t=qi(null),pe.html===!0&&(zt(ct,Em),zt(_t,Lm)),pe.svg===!0&&(zt(ct,mh),zt(_t,yh),zt(_t,_a)),pe.svgFilters===!0&&(zt(ct,gh),zt(_t,yh),zt(_t,_a)),pe.mathMl===!0&&(zt(ct,xh),zt(_t,Am),zt(_t,_a))),Tt.tagCheck=null,Tt.attributeCheck=null,xe(R,"ADD_TAGS")&&(typeof R.ADD_TAGS=="function"?Tt.tagCheck=R.ADD_TAGS:Ze(R.ADD_TAGS)&&(ct===Ft&&(ct=ze(ct)),zt(ct,R.ADD_TAGS,he))),xe(R,"ADD_ATTR")&&(typeof R.ADD_ATTR=="function"?Tt.attributeCheck=R.ADD_ATTR:Ze(R.ADD_ATTR)&&(_t===lt&&(_t=ze(_t)),zt(_t,R.ADD_ATTR,he))),xe(R,"ADD_URI_SAFE_ATTR")&&Ze(R.ADD_URI_SAFE_ATTR)&&zt(ve,R.ADD_URI_SAFE_ATTR,he),xe(R,"FORBID_CONTENTS")&&Ze(R.FORBID_CONTENTS)&&(ce===Ne&&(ce=ze(ce)),zt(ce,R.FORBID_CONTENTS,he)),xe(R,"ADD_FORBID_CONTENTS")&&Ze(R.ADD_FORBID_CONTENTS)&&(ce===Ne&&(ce=ze(ce)),zt(ce,R.ADD_FORBID_CONTENTS,he)),wt&&(ct["#text"]=!0),re&&zt(ct,["html","head","body"]),ct.table&&(zt(ct,["tbody"]),delete ot.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ii('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ii('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ut=S;S=R.TRUSTED_TYPES_POLICY;try{N=L("")}catch(Gt){throw S=ut,Gt}}else S===void 0&&R.TRUSTED_TYPES_POLICY!==null&&(S=P3(d,i)),S&&typeof N=="string"&&(N=L(""));(M.uponSanitizeElement.length>0||M.uponSanitizeAttribute.length>0)&&ct===Ft&&(ct=ze(ct)),M.uponSanitizeAttribute.length>0&&_t===lt&&(_t=ze(_t)),nr&&nr(R),Tn=R},zs=zt({},[...mh,...gh,...T3]),Ws=zt({},[...xh,..._3]),Dc=function(R){let et=y(R);(!et||!et.tagName)&&(et={namespaceURI:Sn,tagName:"template"});const ut=fo(R.tagName),Gt=fo(et.tagName);return Os[R.namespaceURI]?R.namespaceURI===Gn?et.namespaceURI===Sr?ut==="svg":et.namespaceURI===Ie?ut==="svg"&&(Gt==="annotation-xml"||$s[Gt]):!!zs[ut]:R.namespaceURI===Ie?et.namespaceURI===Sr?ut==="math":et.namespaceURI===Gn?ut==="math"&&Rs[Gt]:!!Ws[ut]:R.namespaceURI===Sr?et.namespaceURI===Gn&&!Rs[Gt]||et.namespaceURI===Ie&&!$s[Gt]?!1:!Ws[ut]&&(Vn[ut]||!zs[ut]):!!(Xn==="application/xhtml+xml"&&Os[R.namespaceURI]):!1},sr=function(R){Ai(e.removed,{element:R});try{y(R).removeChild(R)}catch{m(R)}},on=function(R,et){try{Ai(e.removed,{attribute:et.getAttributeNode(R),from:et})}catch{Ai(e.removed,{attribute:null,from:et})}if(et.removeAttribute(R),R==="is")if(nt||Z)try{sr(et)}catch{}else try{et.setAttribute(R,"")}catch{}},Xe=function(R){let et=null,ut=null;if(X)R="<remove></remove>"+R;else{const ne=Tm(R,/^[\r\n\t ]+/);ut=ne&&ne[0]}Xn==="application/xhtml+xml"&&Sn===Sr&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Gt=S?L(R):R;if(Sn===Sr)try{et=new u().parseFromString(Gt,Xn)}catch{}if(!et||!et.documentElement){et=F.createDocument(Sn,"template",null);try{et.documentElement.innerHTML=Ps?N:Gt}catch{}}const Rt=et.body||et.documentElement;return R&&ut&&Rt.insertBefore(r.createTextNode(ut),Rt.childNodes[0]||null),Sn===Sr?P.call(et,re?"html":"body")[0]:re?et.documentElement:Rt},qs=function(R){return z.call(R.ownerDocument||R,R,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},an=function(R){var et,ut;R.normalize();const Gt=z.call(R.ownerDocument||R,R,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let Rt=Gt.nextNode();for(;Rt;){let be=Rt.data;Zn([O,$,B],or=>{be=Mi(be,or," ")}),Rt.data=be,Rt=Gt.nextNode()}const ne=(et=(ut=R.querySelectorAll)===null||ut===void 0?void 0:ut.call(R,"template"))!==null&&et!==void 0?et:[];Zn(Array.from(ne),be=>{ln(be.content)&&an(be.content)})},_n=function(R){const et=_?_(R):null;return typeof et!="string"||he(et)!=="form"?!1:typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||R.attributes!==b(R)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function"||R.nodeType!==w(R)||R.childNodes!==g(R)},ln=function(R){if(!w||typeof R!="object"||R===null)return!1;try{return w(R)===Ur.documentFragment}catch{return!1}},Ei=function(R){if(!w||typeof R!="object"||R===null)return!1;try{return typeof w(R)=="number"}catch{return!1}};function Br(mt,R,et){Zn(mt,ut=>{ut.call(e,R,et,Tn)})}const ma=function(R){let et=null;if(Br(M.beforeSanitizeElements,R,null),_n(R))return sr(R),!0;const ut=he(_?_(R):R.nodeName);if(Br(M.uponSanitizeElement,R,{tagName:ut,allowedTags:ct}),Re&&R.hasChildNodes()&&!Ei(R.firstElementChild)&&De(/<[/\w!]/g,R.innerHTML)&&De(/<[/\w!]/g,R.textContent)||Re&&R.namespaceURI===Sr&&ut==="style"&&Ei(R.firstElementChild)||R.nodeType===Ur.progressingInstruction||Re&&R.nodeType===Ur.comment&&De(/<[/\w]/g,R.data))return sr(R),!0;if(ot[ut]||!(Tt.tagCheck instanceof Function&&Tt.tagCheck(ut))&&!ct[ut]){if(!ot[ut]&&Lr(ut)&&(Y.tagNameCheck instanceof RegExp&&De(Y.tagNameCheck,ut)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ut)))return!1;if(wt&&!ce[ut]){const Rt=y(R),ne=g(R);if(ne&&Rt){const be=ne.length;for(let or=be-1;or>=0;--or){const ar=p(ne[or],!0);Rt.insertBefore(ar,x(R))}}}return sr(R),!0}return(w?w(R):R.nodeType)===Ur.element&&!Dc(R)||(ut==="noscript"||ut==="noembed"||ut==="noframes")&&De(/<\/no(script|embed|frames)/i,R.innerHTML)?(sr(R),!0):(Xt&&R.nodeType===Ur.text&&(et=R.textContent,Zn([O,$,B],Rt=>{et=Mi(et,Rt," ")}),R.textContent!==et&&(Ai(e.removed,{element:R.cloneNode()}),R.textContent=et)),Br(M.afterSanitizeElements,R,null),!1)},ga=function(R,et,ut){if(kt[et]||H&&(et==="id"||et==="name")&&(ut in r||ut in pa))return!1;const Gt=_t[et]||Tt.attributeCheck instanceof Function&&Tt.attributeCheck(et,R);if(!(le&&!kt[et]&&De(T,et))){if(!(ee&&De(G,et))){if(!Gt||kt[et]){if(!(Lr(R)&&(Y.tagNameCheck instanceof RegExp&&De(Y.tagNameCheck,R)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(R))&&(Y.attributeNameCheck instanceof RegExp&&De(Y.attributeNameCheck,et)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(et,R))||et==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&De(Y.tagNameCheck,ut)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ut))))return!1}else if(!ve[et]){if(!De(ht,Mi(ut,D,""))){if(!((et==="src"||et==="xlink:href"||et==="href")&&R!=="script"&&_m(ut,"data:")===0&&wr[R])){if(!(Zt&&!De(tt,Mi(ut,D,"")))){if(ut)return!1}}}}}}return!0},Ke=zt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Lr=function(R){return!Ke[fo(R)]&&De(V,R)},xa=function(R){Br(M.beforeSanitizeAttributes,R,null);const et=R.attributes;if(!et||_n(R))return;const ut={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_t,forceKeepAttr:void 0};let Gt=et.length;for(;Gt--;){const Rt=et[Gt],ne=Rt.name,be=Rt.namespaceURI,or=Rt.value,ar=he(ne),Hs=or;let we=ne==="value"?Hs:y3(Hs);if(ut.attrName=ar,ut.attrValue=we,ut.keepAttr=!0,ut.forceKeepAttr=void 0,Br(M.uponSanitizeAttribute,R,ut),we=ut.attrValue,rt&&(ar==="id"||ar==="name")&&_m(we,ft)!==0&&(on(ne,R),we=ft+we),Re&&De(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,we)){on(ne,R);continue}if(ar==="attributename"&&Tm(we,"href")){on(ne,R);continue}if(ut.forceKeepAttr)continue;if(!ut.keepAttr){on(ne,R);continue}if(!$e&&De(/\/>/i,we)){on(ne,R);continue}Xt&&Zn([O,$,B],ba=>{we=Mi(we,ba," ")});const ya=he(R.nodeName);if(!ga(ya,ar,we)){on(ne,R);continue}if(S&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!be)switch(d.getAttributeType(ya,ar)){case"TrustedHTML":{we=L(we);break}case"TrustedScriptURL":{we=S.createScriptURL(we);break}}if(we!==Hs)try{be?R.setAttributeNS(be,ne,we):R.setAttribute(ne,we),_n(R)?sr(R):Sm(e.removed)}catch{on(ne,R)}}Br(M.afterSanitizeAttributes,R,null)},Kn=function(R){let et=null;const ut=qs(R);for(Br(M.beforeSanitizeShadowDOM,R,null);et=ut.nextNode();)if(Br(M.uponSanitizeShadowNode,et,null),ma(et),xa(et),ln(et.content)&&Kn(et.content),(w?w(et):et.nodeType)===Ur.element){const Rt=C?C(et):et.shadowRoot;ln(Rt)&&(Hr(Rt),Kn(Rt))}Br(M.afterSanitizeShadowDOM,R,null)},Hr=function(R){const et=w?w(R):R.nodeType;if(et===Ur.element){const Rt=C?C(R):R.shadowRoot;ln(Rt)&&(Hr(Rt),Kn(Rt))}const ut=g?g(R):R.childNodes;if(!ut)return;const Gt=[];Zn(ut,Rt=>{Ai(Gt,Rt)});for(const Rt of Gt)Hr(Rt);if(et===Ur.element){const Rt=_?_(R):null;if(typeof Rt=="string"&&he(Rt)==="template"){const ne=R.content;ln(ne)&&Hr(ne)}}};return e.sanitize=function(mt){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},et=null,ut=null,Gt=null,Rt=null;if(Ps=!mt,Ps&&(mt="<!-->"),typeof mt!="string"&&!Ei(mt)&&(mt=w3(mt),typeof mt!="string"))throw Ii("dirty is not a string, aborting");if(!e.isSupported)return mt;if(Ae||Ni(R),e.removed=[],typeof mt=="string"&&(Ot=!1),Ot){const or=_?_(mt):mt.nodeName;if(typeof or=="string"){const ar=he(or);if(!ct[ar]||ot[ar])throw Ii("root node is forbidden and cannot be sanitized in-place")}if(_n(mt))throw Ii("root node is clobbered and cannot be sanitized in-place");Hr(mt)}else if(Ei(mt))et=Xe("<!---->"),ut=et.ownerDocument.importNode(mt,!0),ut.nodeType===Ur.element&&ut.nodeName==="BODY"||ut.nodeName==="HTML"?et=ut:et.appendChild(ut),Hr(ut);else{if(!nt&&!Xt&&!re&&mt.indexOf("<")===-1)return S&&dt?L(mt):mt;if(et=Xe(mt),!et)return nt?null:dt?N:""}et&&X&&sr(et.firstChild);const ne=qs(Ot?mt:et);for(;Gt=ne.nextNode();)ma(Gt),xa(Gt),ln(Gt.content)&&Kn(Gt.content);if(Ot)return Xt&&an(mt),mt;if(nt){if(Xt&&an(et),Z)for(Rt=W.call(et.ownerDocument);et.firstChild;)Rt.appendChild(et.firstChild);else Rt=et;return(_t.shadowroot||_t.shadowrootmode)&&(Rt=I.call(n,Rt,!0)),Rt}let be=re?et.outerHTML:et.innerHTML;return re&&ct["!doctype"]&&et.ownerDocument&&et.ownerDocument.doctype&&et.ownerDocument.doctype.name&&De(I3,et.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+et.ownerDocument.doctype.name+`>
308
- `+be),Xt&&Zn([O,$,B],or=>{be=Mi(be,or," ")}),S&&dt?L(be):be},e.setConfig=function(){let mt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ni(mt),Ae=!0},e.clearConfig=function(){Tn=null,Ae=!1},e.isValidAttribute=function(mt,R,et){Tn||Ni({});const ut=he(mt),Gt=he(R);return ga(ut,Gt,et)},e.addHook=function(mt,R){typeof R=="function"&&Ai(M[mt],R)},e.removeHook=function(mt,R){if(R!==void 0){const et=g3(M[mt],R);return et===-1?void 0:x3(M[mt],et,1)[0]}return Sm(M[mt])},e.removeHooks=function(mt){M[mt]=[]},e.removeAllHooks=function(){M=Im()},e}var bs=Xy(),Ky=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,jo=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,O3=/\s*%%.*\n/gm,rs,Qy=(rs=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(rs,"UnknownDiagramError"),rs),gi={},np=v(function(t,e){t=t.replace(Ky,"").replace(jo,"").replace(O3,`
309
- `);for(const[r,{detector:n}]of Object.entries(gi))if(n(t,e))return r;throw new Qy(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),hu=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)Zy(e,r,n)},"registerLazyLoadedDiagrams"),Zy=v((t,e,r)=>{gi[t]&&it.warn(`Detector with key ${t} already exists. Overwriting.`),gi[t]={detector:e,loader:r},it.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),$3=v(t=>gi[t].loader,"getDiagramLoader"),uu=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=>uu(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]=uu(t[s],e[s],{depth:r-1,clobber:n})):(n||typeof t[s]!="object"&&typeof e[s]!="object")&&(t[s]=e[s])}),t)},"assignWithDepth"),Be=uu,rn="#ffffff",nn="#f2f2f2",At=v((t,e)=>e?E(t,{s:-40,l:10}):E(t,{s:-40,l:-10}),"mkBorder"),ns,R3=(ns=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,l,h,u,d,f,p,m,x,g,y,C,b,w,_,S,N,A,L,j,F,z,W,P,I,M,O,$,B;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||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||U(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||U(this.tertiaryColor),this.lineColor=this.lineColor||U(this.background),this.arrowheadColor=this.arrowheadColor||U(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?Q(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||Q(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||U(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||K(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||Q(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Q(this.mainBkg,10)):(this.rowOdd=this.rowOdd||K(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||K(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 T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=Q(this["cScale"+T],75);else for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=Q(this["cScale"+T],25);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleInv"+T]=this["cScaleInv"+T]||U(this["cScale"+T]);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this.darkMode?this["cScalePeer"+T]=this["cScalePeer"+T]||K(this["cScale"+T],10):this["cScalePeer"+T]=this["cScalePeer"+T]||Q(this["cScale"+T],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleLabel"+T]=this["cScaleLabel"+T]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let T=0;T<5;T++)this["surface"+T]=this["surface"+T]||E(this.mainBkg,{h:180,s:-15,l:e*(5+T*3)}),this["surfacePeer"+T]=this["surfacePeer"+T]||E(this.mainBkg,{h:180,s:-15,l:e*(8+T*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:((l=this.radar)==null?void 0:l.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.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((f=this.wardley)==null?void 0:f.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.axisColor)||this.lineColor,axisTextColor:((m=this.wardley)==null?void 0:m.axisTextColor)||this.primaryTextColor,gridColor:((x=this.wardley)==null?void 0:x.gridColor)||this.gridColor,componentFill:((g=this.wardley)==null?void 0:g.componentFill)||this.background,componentStroke:((y=this.wardley)==null?void 0:y.componentStroke)||this.lineColor,componentLabelColor:((C=this.wardley)==null?void 0:C.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((w=this.wardley)==null?void 0:w.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((_=this.wardley)==null?void 0:_.annotationStroke)||this.lineColor,annotationTextColor:((S=this.wardley)==null?void 0:S.annotationTextColor)||this.primaryTextColor,annotationFill:((N=this.wardley)==null?void 0:N.annotationFill)||this.background},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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((A=this.xyChart)==null?void 0:A.backgroundColor)||this.background,titleColor:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((j=this.xyChart)==null?void 0:j.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((F=this.xyChart)==null?void 0:F.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((z=this.xyChart)==null?void 0:z.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((W=this.xyChart)==null?void 0:W.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((P=this.xyChart)==null?void 0:P.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((I=this.xyChart)==null?void 0:I.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((O=this.xyChart)==null?void 0:O.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:(($=this.xyChart)==null?void 0:$.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((B=this.xyChart)==null?void 0:B.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?Q(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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn,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(ns,"Theme"),ns),z3=v(t=>{const e=new R3;return e.calculate(t),e},"getThemeVariables"),is,W3=(is=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=U(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=U(this.primaryColor),this.secondaryTextColor=U(this.secondaryColor),this.tertiaryTextColor=U(this.tertiaryColor),this.lineColor=U(this.background),this.textColor=U(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(U("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Fn(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=Q("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Q(this.sectionBkgColor,10),this.taskBorderColor=Fn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Fn(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||K(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Q(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,l,h,u,d,f,p,m,x,g,y,C,b,w,_,S,N,A,L,j,F,z,W,P,I,M,O,$;this.secondBkg=K(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=K(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=K(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=U(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 B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||U(this["cScale"+B]);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScalePeer"+B]=this["cScalePeer"+B]||K(this["cScale"+B],10);for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{h:30,s:-30,l:-(-10+B*4)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{h:30,s:-30,l:-(-7+B*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||this.scaleLabelColor;for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["pie"+B]=this["cScale"+B];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 B=0;B<8;B++)this["venn"+(B+1)]=this["venn"+(B+1)]??K(this["cScale"+B],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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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:((C=this.radar)==null?void 0:C.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:((S=this.radar)==null?void 0:S.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#ff6b6b",this.wardley={backgroundColor:((N=this.wardley)==null?void 0:N.backgroundColor)||this.background,axisColor:((A=this.wardley)==null?void 0:A.axisColor)||this.lineColor,axisTextColor:((L=this.wardley)==null?void 0:L.axisTextColor)||this.primaryTextColor,gridColor:((j=this.wardley)==null?void 0:j.gridColor)||this.gridColor,componentFill:((F=this.wardley)==null?void 0:F.componentFill)||this.mainBkg,componentStroke:((z=this.wardley)==null?void 0:z.componentStroke)||this.lineColor,componentLabelColor:((W=this.wardley)==null?void 0:W.componentLabelColor)||this.primaryTextColor,linkStroke:((P=this.wardley)==null?void 0:P.linkStroke)||this.lineColor,evolutionStroke:((I=this.wardley)==null?void 0:I.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((M=this.wardley)==null?void 0:M.annotationStroke)||this.lineColor,annotationTextColor:((O=this.wardley)==null?void 0:O.annotationTextColor)||this.primaryTextColor,annotationFill:(($=this.wardley)==null?void 0:$.annotationFill)||this.mainBkg},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?Q(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=K(this.secondaryColor,20),this.git1=K(this.pie2||this.secondaryColor,20),this.git2=K(this.pie3||this.tertiaryColor,20),this.git3=K(this.pie4||E(this.primaryColor,{h:-30}),20),this.git4=K(this.pie5||E(this.primaryColor,{h:-60}),20),this.git5=K(this.pie6||E(this.primaryColor,{h:-90}),10),this.git6=K(this.pie7||E(this.primaryColor,{h:60}),10),this.git7=K(this.pie8||E(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||U(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||U(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.emUiFill=this.emUiFill||"#2d2d2d",this.emUiStroke=this.emUiStroke||"#555",this.emProcessorFill=this.emProcessorFill||K("#5a3d5c",10),this.emProcessorStroke=this.emProcessorStroke||"#8a6d8c",this.emReadModelFill=this.emReadModelFill||K("#3d5a2d",10),this.emReadModelStroke=this.emReadModelStroke||"#6d8c5c",this.emCommandFill=this.emCommandFill||K("#2d3d5a",10),this.emCommandStroke=this.emCommandStroke||"#5c6d8c",this.emEventFill=this.emEventFill||K("#5a452d",10),this.emEventStroke=this.emEventStroke||"#8c755c",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||K(this.background,5),this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||K(this.background,12),this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||K(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||K(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(is,"Theme"),is),q3=v(t=>{const e=new W3;return e.calculate(t),e},"getThemeVariables"),ss,H3=(ss=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=At(this.primaryColor,this.darkMode),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=U(this.primaryColor),this.secondaryTextColor=U(this.secondaryColor),this.tertiaryTextColor=U(this.tertiaryColor),this.lineColor=U(this.background),this.textColor=U(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=At(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=Fn(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,l,h,u,d,f,p,m,x,g,y,C,b,w,_,S,N,A,L,j,F,z,W,P,I,M,O,$;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||Q(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Q(this.tertiaryColor,40);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScale"+B]=Q(this["cScale"+B],10),this["cScalePeer"+B]=this["cScalePeer"+B]||Q(this["cScale"+B],25);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||E(this["cScale"+B],{h:180});for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{h:30,l:-(5+B*5)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{h:30,l:-(7+B*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||U(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||U(this.labelTextColor);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||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||K(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||K(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((h=this.radar)==null?void 0:h.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((f=this.wardley)==null?void 0:f.axisColor)||this.lineColor,axisTextColor:((p=this.wardley)==null?void 0:p.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((C=this.wardley)==null?void 0:C.linkStroke)||this.lineColor,evolutionStroke:((b=this.wardley)==null?void 0:b.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((w=this.wardley)==null?void 0:w.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((S=this.wardley)==null?void 0:S.annotationFill)||this.background},this.xyChart={backgroundColor:((N=this.xyChart)==null?void 0:N.backgroundColor)||this.background,titleColor:((A=this.xyChart)==null?void 0:A.titleColor)||this.primaryTextColor,dataLabelColor:((L=this.xyChart)==null?void 0:L.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((j=this.xyChart)==null?void 0:j.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((F=this.xyChart)==null?void 0:F.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((z=this.xyChart)==null?void 0:z.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((W=this.xyChart)==null?void 0:W.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((P=this.xyChart)==null?void 0:P.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((I=this.xyChart)==null?void 0:I.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((M=this.xyChart)==null?void 0:M.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((O=this.xyChart)==null?void 0:O.yAxisLineColor)||this.primaryTextColor,plotColorPalette:(($=this.xyChart)==null?void 0:$.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=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.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.gitInv0=this.gitInv0||Q(U(this.git0),25),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||U(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||U(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(ss,"Theme"),ss),U3=v(t=>{const e=new H3;return e.calculate(t),e},"getThemeVariables"),os,Y3=(os=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=K("#cde498",10),this.primaryBorderColor=At(this.primaryColor,this.darkMode),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=U(this.primaryColor),this.secondaryTextColor=U(this.secondaryColor),this.tertiaryTextColor=U(this.primaryColor),this.lineColor=U(this.background),this.textColor=U(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,l,h,u,d,f,p,m,x,g,y,C,b,w,_,S,N,A,L,j,F,z,W,P,I,M,O,$;this.actorBorder=Q(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||Q(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Q(this.tertiaryColor,40);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScale"+B]=Q(this["cScale"+B],10),this["cScalePeer"+B]=this["cScalePeer"+B]||Q(this["cScale"+B],25);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||E(this["cScale"+B],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||this.scaleLabelColor;for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{h:30,s:-30,l:-(5+B*5)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{h:30,s:-30,l:-(8+B*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||K(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||K(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.radar)==null?void 0:l.graticuleOpacity)||.3,legendBoxSize:((h=this.radar)==null?void 0:h.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((f=this.wardley)==null?void 0:f.axisColor)||this.lineColor,axisTextColor:((p=this.wardley)==null?void 0:p.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((C=this.wardley)==null?void 0:C.linkStroke)||this.lineColor,evolutionStroke:((b=this.wardley)==null?void 0:b.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((w=this.wardley)==null?void 0:w.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((S=this.wardley)==null?void 0:S.annotationFill)||this.background},this.xyChart={backgroundColor:((N=this.xyChart)==null?void 0:N.backgroundColor)||this.background,titleColor:((A=this.xyChart)==null?void 0:A.titleColor)||this.primaryTextColor,dataLabelColor:((L=this.xyChart)==null?void 0:L.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((j=this.xyChart)==null?void 0:j.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((F=this.xyChart)==null?void 0:F.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((z=this.xyChart)==null?void 0:z.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((W=this.xyChart)==null?void 0:W.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((P=this.xyChart)==null?void 0:P.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((I=this.xyChart)==null?void 0:I.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((M=this.xyChart)==null?void 0:M.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((O=this.xyChart)==null?void 0:O.yAxisLineColor)||this.primaryTextColor,plotColorPalette:(($=this.xyChart)==null?void 0:$.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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||U(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||U(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(os,"Theme"),os),G3=v(t=>{const e=new Y3;return e.calculate(t),e},"getThemeVariables"),as,V3=(as=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=K(this.contrast,55),this.background="#ffffff",this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=At(this.primaryColor,this.darkMode),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=U(this.primaryColor),this.secondaryTextColor=U(this.secondaryColor),this.tertiaryTextColor=U(this.tertiaryColor),this.lineColor=U(this.background),this.textColor=U(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||K(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,l,h,u,d,f,p,m,x,g,y,C,b,w,_,S,N,A,L,j,F,z,W,P,I,M,O,$;this.secondBkg=K(this.contrast,55),this.border2=this.contrast,this.actorBorder=K(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 B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleInv"+B]=this["cScaleInv"+B]||U(this["cScale"+B]);for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this.darkMode?this["cScalePeer"+B]=this["cScalePeer"+B]||K(this["cScale"+B],10):this["cScalePeer"+B]=this["cScalePeer"+B]||Q(this["cScale"+B],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let B=0;B<this.THEME_COLOR_LIMIT;B++)this["cScaleLabel"+B]=this["cScaleLabel"+B]||this.scaleLabelColor;for(let B=0;B<5;B++)this["surface"+B]=this["surface"+B]||E(this.mainBkg,{l:-(5+B*5)}),this["surfacePeer"+B]=this["surfacePeer"+B]||E(this.mainBkg,{l:-(8+B*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=K(this.contrast,30),this.sectionBkgColor2=K(this.contrast,30),this.taskBorderColor=Q(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=K(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=Q(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 B=0;B<this.THEME_COLOR_LIMIT;B++)this["pie"+B]=this["cScale"+B];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 B=0;B<8;B++)this["venn"+(B+1)]=this["venn"+(B+1)]??this["cScale"+B];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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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:((C=this.radar)==null?void 0:C.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:((S=this.radar)==null?void 0:S.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((N=this.wardley)==null?void 0:N.backgroundColor)||this.background,axisColor:((A=this.wardley)==null?void 0:A.axisColor)||this.lineColor,axisTextColor:((L=this.wardley)==null?void 0:L.axisTextColor)||this.primaryTextColor,gridColor:((j=this.wardley)==null?void 0:j.gridColor)||this.gridColor,componentFill:((F=this.wardley)==null?void 0:F.componentFill)||this.background,componentStroke:((z=this.wardley)==null?void 0:z.componentStroke)||this.lineColor,componentLabelColor:((W=this.wardley)==null?void 0:W.componentLabelColor)||this.primaryTextColor,linkStroke:((P=this.wardley)==null?void 0:P.linkStroke)||this.lineColor,evolutionStroke:((I=this.wardley)==null?void 0:I.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((M=this.wardley)==null?void 0:M.annotationStroke)||this.lineColor,annotationTextColor:((O=this.wardley)==null?void 0:O.annotationTextColor)||this.primaryTextColor,annotationFill:(($=this.wardley)==null?void 0:$.annotationFill)||this.background},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=Q(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||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(as,"Theme"),as),X3=v(t=>{const e=new V3;return e.calculate(t),e},"getThemeVariables"),ls,K3=(ls=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=At(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,l,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||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||U(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||U(this.tertiaryColor),this.lineColor=this.lineColor||U(this.background),this.arrowheadColor=this.arrowheadColor||U(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?Q(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||Q(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||U(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||K(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]=Q(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Q(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||U(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||Q(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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?Q(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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(ls,"Theme"),ls),Q3=v(t=>{const e=new K3;return e.calculate(t),e},"getThemeVariables"),cs,Z3=(cs=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=U(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=U(this.primaryColor),this.secondaryTextColor=U(this.secondaryColor),this.tertiaryTextColor=U(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(U("#323D47"),10),this.border1="#ccc",this.border2=Fn(255,255,255,.25),this.arrowheadColor=U(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,l,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||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||U(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||U(this.tertiaryColor),this.lineColor=this.lineColor||U(this.background),this.arrowheadColor=this.arrowheadColor||U(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?Q(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||Q(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||U(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||K(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]=Q(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=Q(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||U(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||Q(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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?Q(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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(cs,"Theme"),cs),J3=v(t=>{const e=new Z3;return e.calculate(t),e},"getThemeVariables"),hs,tM=(hs=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=At("#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,l,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||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||U(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||U(this.tertiaryColor),this.lineColor=this.lineColor||U(this.background),this.arrowheadColor=this.arrowheadColor||U(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?Q(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||Q(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||U(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||K(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]=Q(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Q(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||U(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||Q(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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?Q(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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(hs,"Theme"),hs),eM=v(t=>{const e=new tM;return e.calculate(t),e},"getThemeVariables"),us,rM=(us=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=U(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=U(this.primaryColor),this.secondaryTextColor=U(this.secondaryColor),this.tertiaryTextColor=U(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(U("#323D47"),10),this.border1="#ccc",this.border2=Fn(255,255,255,.25),this.arrowheadColor=U(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,l,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||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||U(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||U(this.tertiaryColor),this.lineColor=this.lineColor||U(this.background),this.arrowheadColor=this.arrowheadColor||U(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?Q(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||Q(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||U(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||K(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]=Q(this["cScale"+p],75);else for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScale"+p]=Q(this["cScale"+p],25);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleInv"+p]=this["cScaleInv"+p]||U(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||Q(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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?Q(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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(us,"Theme"),us),nM=v(t=>{const e=new rM;return e.calculate(t),e},"getThemeVariables"),ds,iM=(ds=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=At(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,l,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||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||U(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||U(this.tertiaryColor),this.lineColor=this.lineColor||U(this.background),this.arrowheadColor=this.arrowheadColor||U(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?Q(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||Q(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||U(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||K(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]||U(this["cScale"+g]);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this.darkMode?this["cScalePeer"+g]=this["cScalePeer"+g]||K(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||Q(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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?Q(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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(ds,"Theme"),ds),sM=v(t=>{const e=new iM;return e.calculate(t),e},"getThemeVariables"),ps,oM=(ps=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=U(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=U(this.primaryColor),this.secondaryTextColor=U(this.secondaryColor),this.tertiaryTextColor=U(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(U("#323D47"),10),this.border1="#ccc",this.border2=Fn(255,255,255,.25),this.arrowheadColor=U(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,l,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||At(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||At(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||At(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||U(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||U(this.tertiaryColor),this.lineColor=this.lineColor||U(this.background),this.arrowheadColor=this.arrowheadColor||U(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?Q(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||Q(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||U(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||K(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]||U(this["cScale"+p]);for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this.darkMode?this["cScalePeer"+p]=this["cScalePeer"+p]||K(this["cScale"+p],10):this["cScalePeer"+p]=this["cScalePeer"+p]||Q(this["cScale"+p],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let p=0;p<this.THEME_COLOR_LIMIT;p++)this["cScaleLabel"+p]=Q(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||Wr(this.quadrant1Fill)?K(this.quadrant1Fill):Q(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:((l=this.xyChart)==null?void 0:l.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?Q(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=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.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.gitInv0=this.gitInv0||U(this.git0),this.gitInv1=this.gitInv1||U(this.git1),this.gitInv2=this.gitInv2||U(this.git2),this.gitInv3=this.gitInv3||U(this.git3),this.gitInv4=this.gitInv4||U(this.git4),this.gitInv5=this.gitInv5||U(this.git5),this.gitInv6=this.gitInv6||U(this.git6),this.gitInv7=this.gitInv7||U(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||rn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||nn}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(ps,"Theme"),ps),aM=v(t=>{const e=new oM;return e.calculate(t),e},"getThemeVariables"),pn={base:{getThemeVariables:z3},dark:{getThemeVariables:q3},default:{getThemeVariables:U3},forest:{getThemeVariables:G3},neutral:{getThemeVariables:X3},neo:{getThemeVariables:Q3},"neo-dark":{getThemeVariables:J3},redux:{getThemeVariables:eM},"redux-dark":{getThemeVariables:nM},"redux-color":{getThemeVariables:sM},"redux-dark-color":{getThemeVariables:aM}},Qe={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,hierarchicalNamespaces:!0},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:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},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,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},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},Jy={...Qe,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:pn.default.getThemeVariables(),sequence:{...Qe.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,hierarchicalNamespaces:!0},gantt:{...Qe.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Qe.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Qe.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:{...Qe.pie,useWidth:984},xyChart:{...Qe.xyChart,useWidth:void 0},requirement:{...Qe.requirement,useWidth:void 0},packet:{...Qe.packet},eventmodeling:{...Qe.eventmodeling},treeView:{...Qe.treeView,useWidth:void 0},radar:{...Qe.radar},ishikawa:{...Qe.ishikawa},sankey:{...Qe.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Qe.venn}},tb=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...tb(t[n],"")]:[...r,e+n],[]),"keyify"),lM=new Set(tb(Jy,"")),eb=Jy,vl=v(t=>{if(it.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>vl(e));return}for(const e of Object.keys(t)){if(it.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!lM.has(e)||t[e]==null){it.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){if(e==="nodeColors"){const n=/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i;for(const i of Object.keys(t[e]))(typeof t[e][i]!="string"||!n.test(t[e][i]))&&(it.debug("sanitize deleting invalid color:",i,t[e][i]),delete t[e][i])}else it.debug("sanitizing object",e),vl(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(it.debug("sanitizing css option",e),t[e]=rb(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]="")}it.debug("After sanitization",t)}},"sanitizeDirective"),rb=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"),Cs=Object.freeze(eb),kn=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),ur=Be({},Cs),wl,xi=[],No=Be({},Cs),gc=v((t,e)=>{let r=Be({},t),n={};for(const i of e)sb(i),n=Be(n,i);if(r=Be(r,n),n.theme&&n.theme in pn){const i=Be({},wl),s=Be(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in pn&&(r.themeVariables=pn[r.theme].getThemeVariables(s))}return No=r,ab(No),No},"updateCurrentConfig"),cM=v(t=>(ur=Be({},Cs),ur=Be(ur,t),t.theme&&pn[t.theme]&&(ur.themeVariables=pn[t.theme].getThemeVariables(t.themeVariables)),gc(ur,xi),ur),"setSiteConfig"),hM=v(t=>{wl=Be({},t)},"saveConfigFromInitialize"),uM=v(t=>(ur=Be(ur,t),gc(ur,xi),ur),"updateSiteConfig"),nb=v(()=>Be({},ur),"getSiteConfig"),ib=v(t=>(ab(t),Be(No,t),me()),"setConfig"),me=v(()=>Be({},No),"getConfig"),sb=v(t=>{t&&(["secure",...ur.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(it.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"&&sb(t[e])}))},"sanitize"),dM=v(t=>{var e;vl(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),xi.push(t),gc(ur,xi)},"addDirective"),Sl=v((t=ur)=>{xi=[],gc(t,xi)},"reset"),pM={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."},Fm={},ob=v(t=>{Fm[t]||(it.warn(pM[t]),Fm[t]=!0)},"issueWarning"),ab=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&ob("LAZY_LOAD_DEPRECATED")},"checkConfig"),xY=v(()=>{let t={};wl&&(t=Be(t,wl));for(const e of xi)t=Be(t,e);return t},"getUserDefinedConfig"),ir=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&ob("FLOWCHART_HTML_LABELS_DEPRECATED"),kn(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),ra=/<br\s*\/?>/gi,fM=v(t=>t?hb(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),mM=(()=>{let t=!1;return()=>{t||(lb(),t=!0)}})();function lb(){const t="data-temp-href-target";bs.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),bs.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(lb,"setupDompurifyHooks");var cb=v(t=>(mM(),bs.sanitize(t)),"removeScript"),Dm=v((t,e)=>{if(ir(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=cb(t):r!=="loose"&&(t=hb(t),t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=t.replace(/=/g,"&equals;"),t=bM(t))}return t},"sanitizeMore"),zr=v((t,e)=>t&&(e.dompurifyConfig?t=bs.sanitize(Dm(t,e),e.dompurifyConfig).toString():t=bs.sanitize(Dm(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),gM=v((t,e)=>typeof t=="string"?zr(t,e):t.flat().map(r=>zr(r,e)),"sanitizeTextOrArray"),xM=v(t=>ra.test(t),"hasBreaks"),yM=v(t=>t.split(ra),"splitBreaks"),bM=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),hb=v(t=>t.replace(ra,"#br#"),"breakToPlaceholder"),CM=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"),kM=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),vM=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),Pm=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];wM(s,o)&&(i=s+","+o,n++,r.pop())}r.push(SM(i))}return r.join("")},"parseGenericTypes"),du=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),wM=v((t,e)=>{const r=du(t,"~"),n=du(e,"~");return r===1&&n===1},"shouldCombineSets"),SM=v(t=>{const e=du(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"),Om=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),pu=/\$\$(.*)\$\$/g,Po=v(t=>{var e;return(((e=t.match(pu))==null?void 0:e.length)??0)>0},"hasKatex"),yY=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await ub(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"),TM=v(async(t,e)=>{if(!Po(t))return t;if(!(Om()||e.legacyMathML||e.forceLegacyMathML))return t.replace(pu,"MathML is unsupported in this environment.");{const{default:r}=await Yt(async()=>{const{default:i}=await import("./katex-C5jXJg4s.js");return{default:i}},[]),n=e.forceLegacyMathML||!Om()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(ra).map(i=>Po(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"),ub=v(async(t,e)=>zr(await TM(t,e),e),"renderKatexSanitized"),na={getRows:fM,sanitizeText:zr,sanitizeTextOrArray:gM,hasBreaks:xM,splitBreaks:yM,lineBreakRegex:ra,removeScript:cb,getUrl:CM,evaluate:kn,getMax:kM,getMin:vM},_M=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),jM=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"),db=v(function(t,e,r,n){const i=jM(e,r,n);_M(t,i)},"configureSvgSize"),NM=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;it.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;it.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,it.info(`Calculated bounds: ${a}x${l}`),db(e,l,a,n);const h=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;e.attr("viewBox",h)},"setupGraphViewbox"),Qa={};function fu(t){return[...t.cssRules].map(e=>e.cssText).join(`
310
- `)}v(fu,"cssStyleSheetToString");var EM=v((t,e,r,n)=>{let i="";return t in Qa&&Qa[t]?i=Qa[t]({...r,svgId:n}):it.warn(`No theme found for ${t}`),` & {
311
- font-family: ${r.fontFamily};
312
- font-size: ${r.fontSize};
313
- fill: ${r.textColor}
314
- }
315
- @keyframes edge-animation-frame {
316
- from {
317
- stroke-dashoffset: 0;
318
- }
319
- }
320
- @keyframes dash {
321
- to {
322
- stroke-dashoffset: 0;
323
- }
324
- }
325
- & .edge-animation-slow {
326
- stroke-dasharray: 9,5 !important;
327
- stroke-dashoffset: 900;
328
- animation: dash 50s linear infinite;
329
- stroke-linecap: round;
330
- }
331
- & .edge-animation-fast {
332
- stroke-dasharray: 9,5 !important;
333
- stroke-dashoffset: 900;
334
- animation: dash 20s linear infinite;
335
- stroke-linecap: round;
336
- }
337
- /* Classes common for multiple diagrams */
338
-
339
- & .error-icon {
340
- fill: ${r.errorBkgColor};
341
- }
342
- & .error-text {
343
- fill: ${r.errorTextColor};
344
- stroke: ${r.errorTextColor};
345
- }
346
-
347
- & .edge-thickness-normal {
348
- stroke-width: ${r.strokeWidth??1}px;
349
- }
350
- & .edge-thickness-thick {
351
- stroke-width: 3.5px
352
- }
353
- & .edge-pattern-solid {
354
- stroke-dasharray: 0;
355
- }
356
- & .edge-thickness-invisible {
357
- stroke-width: 0;
358
- fill: none;
359
- }
360
- & .edge-pattern-dashed{
361
- stroke-dasharray: 3;
362
- }
363
- .edge-pattern-dotted {
364
- stroke-dasharray: 2;
365
- }
366
-
367
- & .marker {
368
- fill: ${r.lineColor};
369
- stroke: ${r.lineColor};
370
- }
371
- & .marker.cross {
372
- stroke: ${r.lineColor};
373
- }
374
-
375
- & svg {
376
- font-family: ${r.fontFamily};
377
- font-size: ${r.fontSize};
378
- }
379
- & p {
380
- margin: 0
381
- }
382
-
383
- ${i}
384
- .node .neo-node {
385
- stroke: ${r.nodeBorder};
386
- }
387
-
388
- [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
389
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
390
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
391
- }
392
-
393
-
394
- [data-look="neo"].node path {
395
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
396
- stroke-width: ${r.strokeWidth??1}px;
397
- }
398
-
399
- [data-look="neo"].node .outer-path {
400
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
401
- }
402
-
403
- [data-look="neo"].node .neo-line path {
404
- stroke: ${r.nodeBorder};
405
- filter: none;
406
- }
407
-
408
- [data-look="neo"].node circle{
409
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
410
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
411
- }
412
-
413
- [data-look="neo"].node circle .state-start{
414
- fill: #000000;
415
- }
416
-
417
- [data-look="neo"].icon-shape .icon {
418
- fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
419
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
420
- }
421
-
422
- [data-look="neo"].icon-shape .icon-neo path {
423
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
424
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
425
- }
426
-
427
- ${e}
428
- `},"getStyles"),BM=v((t,e)=>{e!==void 0&&(Qa[t]=e)},"addStylesForDiagram"),LM=EM,pb={};t3(pb,{clear:()=>AM,getAccDescription:()=>DM,getAccTitle:()=>IM,getDiagramTitle:()=>OM,setAccDescription:()=>FM,setAccTitle:()=>MM,setDiagramTitle:()=>PM});var ip="",sp="",op="",ap=v(t=>zr(t,me()),"sanitizeText"),AM=v(()=>{ip="",op="",sp=""},"clear"),MM=v(t=>{ip=ap(t).replace(/^\s+/g,"")},"setAccTitle"),IM=v(()=>ip,"getAccTitle"),FM=v(t=>{op=ap(t).replace(/\n\s+/g,`
429
- `)},"setAccDescription"),DM=v(()=>op,"getAccDescription"),PM=v(t=>{sp=ap(t)},"setDiagramTitle"),OM=v(()=>sp,"getDiagramTitle"),$m=it,$M=rp,Kt=me,bY=ib,kY=Cs,lp=v(t=>zr(t,Kt()),"sanitizeText"),RM=NM,zM=v(()=>pb,"getCommonDb"),Tl={},_l=v((t,e,r)=>{var n;Tl[t]&&$m.warn(`Diagram with id ${t} already registered. Overwriting.`),Tl[t]=e,r&&Zy(t,r),BM(t,e.styles),(n=e.injectUtils)==null||n.call(e,$m,$M,Kt,lp,RM,zM(),()=>{})},"registerDiagram"),mu=v(t=>{if(t in Tl)return Tl[t];throw new WM(t)},"getDiagram"),fs,WM=(fs=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(fs,"DiagramNotFoundError"),fs),qM={value:()=>{}};function fb(){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 Za(r)}function Za(t){this._=t}function HM(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}})}Za.prototype=fb.prototype={constructor:Za,on:function(t,e){var r=this._,n=HM(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=UM(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]=Rm(r[i],t.name,e);else if(e==null)for(i in r)r[i]=Rm(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 Za(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 UM(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function Rm(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=qM,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var gu="http://www.w3.org/1999/xhtml";const zm={svg:"http://www.w3.org/2000/svg",xhtml:gu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),zm.hasOwnProperty(e)?{space:zm[e],local:t}:t}function YM(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===gu&&e.documentElement.namespaceURI===gu?e.createElement(t):e.createElementNS(r,t)}}function GM(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function mb(t){var e=xc(t);return(e.local?GM:YM)(e)}function VM(){}function cp(t){return t==null?VM:function(){return this.querySelector(t)}}function XM(t){typeof t!="function"&&(t=cp(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),l,h,u=0;u<o;++u)(l=s[u])&&(h=t.call(l,l.__data__,u,s))&&("__data__"in l&&(h.__data__=l.__data__),a[u]=h);return new vr(n,this._parents)}function KM(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function QM(){return[]}function gb(t){return t==null?QM:function(){return this.querySelectorAll(t)}}function ZM(t){return function(){return KM(t.apply(this,arguments))}}function JM(t){typeof t=="function"?t=ZM(t):t=gb(t);for(var e=this._groups,r=e.length,n=[],i=[],s=0;s<r;++s)for(var o=e[s],a=o.length,l,h=0;h<a;++h)(l=o[h])&&(n.push(t.call(l,l.__data__,h,o)),i.push(l));return new vr(n,i)}function xb(t){return function(){return this.matches(t)}}function yb(t){return function(e){return e.matches(t)}}var tI=Array.prototype.find;function eI(t){return function(){return tI.call(this.children,t)}}function rI(){return this.firstElementChild}function nI(t){return this.select(t==null?rI:eI(typeof t=="function"?t:yb(t)))}var iI=Array.prototype.filter;function sI(){return Array.from(this.children)}function oI(t){return function(){return iI.call(this.children,t)}}function aI(t){return this.selectAll(t==null?sI:oI(typeof t=="function"?t:yb(t)))}function lI(t){typeof t!="function"&&(t=xb(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]=[],l,h=0;h<o;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&a.push(l);return new vr(n,this._parents)}function bb(t){return new Array(t.length)}function cI(){return new vr(this._enter||this._groups.map(bb),this._parents)}function jl(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}jl.prototype={constructor:jl,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 hI(t){return function(){return t}}function uI(t,e,r,n,i,s){for(var o=0,a,l=e.length,h=s.length;o<h;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new jl(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function dI(t,e,r,n,i,s,o){var a,l,h=new Map,u=e.length,d=s.length,f=new Array(u),p;for(a=0;a<u;++a)(l=e[a])&&(f[a]=p=o.call(l,l.__data__,a,e)+"",h.has(p)?i[a]=l:h.set(p,l));for(a=0;a<d;++a)p=o.call(t,s[a],a,s)+"",(l=h.get(p))?(n[a]=l,l.__data__=s[a],h.delete(p)):r[a]=new jl(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&h.get(f[a])===l&&(i[a]=l)}function pI(t){return t.__data__}function fI(t,e){if(!arguments.length)return Array.from(this,pI);var r=e?dI:uI,n=this._parents,i=this._groups;typeof t!="function"&&(t=hI(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),h=0;h<s;++h){var u=n[h],d=i[h],f=d.length,p=mI(t.call(u,u&&u.__data__,h,n)),m=p.length,x=a[h]=new Array(m),g=o[h]=new Array(m),y=l[h]=new Array(f);r(u,d,x,g,y,p,e);for(var C=0,b=0,w,_;C<m;++C)if(w=x[C]){for(C>=b&&(b=C+1);!(_=g[b])&&++b<m;);w._next=_||null}}return o=new vr(o,n),o._enter=a,o._exit=l,o}function mI(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function gI(){return new vr(this._exit||this._groups.map(bb),this._parents)}function xI(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 yI(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),l=0;l<o;++l)for(var h=r[l],u=n[l],d=h.length,f=a[l]=new Array(d),p,m=0;m<d;++m)(p=h[m]||u[m])&&(f[m]=p);for(;l<i;++l)a[l]=r[l];return new vr(a,this._parents)}function bI(){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 CI(t){t||(t=kI);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,l=i[s]=new Array(a),h,u=0;u<a;++u)(h=o[u])&&(l[u]=h);l.sort(e)}return new vr(i,this._parents).order()}function kI(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function vI(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function wI(){return Array.from(this)}function SI(){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 TI(){let t=0;for(const e of this)++t;return t}function _I(){return!this.node()}function jI(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 NI(t){return function(){this.removeAttribute(t)}}function EI(t){return function(){this.removeAttributeNS(t.space,t.local)}}function BI(t,e){return function(){this.setAttribute(t,e)}}function LI(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function AI(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function MI(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 II(t,e){var r=xc(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?EI:NI:typeof e=="function"?r.local?MI:AI:r.local?LI:BI)(r,e))}function Cb(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function FI(t){return function(){this.style.removeProperty(t)}}function DI(t,e,r){return function(){this.style.setProperty(t,e,r)}}function PI(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function OI(t,e,r){return arguments.length>1?this.each((e==null?FI:typeof e=="function"?PI:DI)(t,e,r??"")):ks(this.node(),t)}function ks(t,e){return t.style.getPropertyValue(e)||Cb(t).getComputedStyle(t,null).getPropertyValue(e)}function $I(t){return function(){delete this[t]}}function RI(t,e){return function(){this[t]=e}}function zI(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function WI(t,e){return arguments.length>1?this.each((e==null?$I:typeof e=="function"?zI:RI)(t,e)):this.node()[t]}function kb(t){return t.trim().split(/^|\s+/)}function hp(t){return t.classList||new vb(t)}function vb(t){this._node=t,this._names=kb(t.getAttribute("class")||"")}vb.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 wb(t,e){for(var r=hp(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function Sb(t,e){for(var r=hp(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function qI(t){return function(){wb(this,t)}}function HI(t){return function(){Sb(this,t)}}function UI(t,e){return function(){(e.apply(this,arguments)?wb:Sb)(this,t)}}function YI(t,e){var r=kb(t+"");if(arguments.length<2){for(var n=hp(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?UI:e?qI:HI)(r,e))}function GI(){this.textContent=""}function VI(t){return function(){this.textContent=t}}function XI(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function KI(t){return arguments.length?this.each(t==null?GI:(typeof t=="function"?XI:VI)(t)):this.node().textContent}function QI(){this.innerHTML=""}function ZI(t){return function(){this.innerHTML=t}}function JI(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function tF(t){return arguments.length?this.each(t==null?QI:(typeof t=="function"?JI:ZI)(t)):this.node().innerHTML}function eF(){this.nextSibling&&this.parentNode.appendChild(this)}function rF(){return this.each(eF)}function nF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function iF(){return this.each(nF)}function sF(t){var e=typeof t=="function"?t:mb(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function oF(){return null}function aF(t,e){var r=typeof t=="function"?t:mb(t),n=e==null?oF:typeof e=="function"?e:cp(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function lF(){var t=this.parentNode;t&&t.removeChild(this)}function cF(){return this.each(lF)}function hF(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function uF(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function dF(t){return this.select(t?uF:hF)}function pF(t){return arguments.length?this.property("__data__",t):this.node().__data__}function fF(t){return function(e){t.call(this,e,this.__data__)}}function mF(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 gF(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 xF(t,e,r){return function(){var n=this.__on,i,s=fF(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 yF(t,e,r){var n=mF(t+""),i,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,h=a.length,u;l<h;++l)for(i=0,u=a[l];i<s;++i)if((o=n[i]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?xF:gF,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function Tb(t,e,r){var n=Cb(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 bF(t,e){return function(){return Tb(this,t,e)}}function CF(t,e){return function(){return Tb(this,t,e.apply(this,arguments))}}function kF(t,e){return this.each((typeof e=="function"?CF:bF)(t,e))}function*vF(){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 _b=[null];function vr(t,e){this._groups=t,this._parents=e}function ia(){return new vr([[document.documentElement]],_b)}function wF(){return this}vr.prototype=ia.prototype={constructor:vr,select:XM,selectAll:JM,selectChild:nI,selectChildren:aI,filter:lI,data:fI,enter:cI,exit:gI,join:xI,merge:yI,selection:wF,order:bI,sort:CI,call:vI,nodes:wI,node:SI,size:TI,empty:_I,each:jI,attr:II,style:OI,property:WI,classed:YI,text:KI,html:tF,raise:rF,lower:iF,append:sF,insert:aF,remove:cF,clone:dF,datum:pF,on:yF,dispatch:kF,[Symbol.iterator]:vF};function Wt(t){return typeof t=="string"?new vr([[document.querySelector(t)]],[document.documentElement]):new vr([[t]],_b)}function up(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function jb(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function sa(){}var Oo=.7,Nl=1/Oo,Ji="\\s*([+-]?\\d+)\\s*",$o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",SF=/^#([0-9a-f]{3,8})$/,TF=new RegExp(`^rgb\\(${Ji},${Ji},${Ji}\\)$`),_F=new RegExp(`^rgb\\(${Qr},${Qr},${Qr}\\)$`),jF=new RegExp(`^rgba\\(${Ji},${Ji},${Ji},${$o}\\)$`),NF=new RegExp(`^rgba\\(${Qr},${Qr},${Qr},${$o}\\)$`),EF=new RegExp(`^hsl\\(${$o},${Qr},${Qr}\\)$`),BF=new RegExp(`^hsla\\(${$o},${Qr},${Qr},${$o}\\)$`),Wm={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};up(sa,Ro,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:qm,formatHex:qm,formatHex8:LF,formatHsl:AF,formatRgb:Hm,toString:Hm});function qm(){return this.rgb().formatHex()}function LF(){return this.rgb().formatHex8()}function AF(){return Nb(this).formatHsl()}function Hm(){return this.rgb().formatRgb()}function Ro(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=SF.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?Um(e):r===3?new pr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?ja(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?ja(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=TF.exec(t))?new pr(e[1],e[2],e[3],1):(e=_F.exec(t))?new pr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=jF.exec(t))?ja(e[1],e[2],e[3],e[4]):(e=NF.exec(t))?ja(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=EF.exec(t))?Vm(e[1],e[2]/100,e[3]/100,1):(e=BF.exec(t))?Vm(e[1],e[2]/100,e[3]/100,e[4]):Wm.hasOwnProperty(t)?Um(Wm[t]):t==="transparent"?new pr(NaN,NaN,NaN,0):null}function Um(t){return new pr(t>>16&255,t>>8&255,t&255,1)}function ja(t,e,r,n){return n<=0&&(t=e=r=NaN),new pr(t,e,r,n)}function MF(t){return t instanceof sa||(t=Ro(t)),t?(t=t.rgb(),new pr(t.r,t.g,t.b,t.opacity)):new pr}function xu(t,e,r,n){return arguments.length===1?MF(t):new pr(t,e,r,n??1)}function pr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}up(pr,xu,jb(sa,{brighter(t){return t=t==null?Nl:Math.pow(Nl,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Oo:Math.pow(Oo,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new pr(ui(this.r),ui(this.g),ui(this.b),El(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:Ym,formatHex:Ym,formatHex8:IF,formatRgb:Gm,toString:Gm}));function Ym(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}`}function IF(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}${oi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gm(){const t=El(this.opacity);return`${t===1?"rgb(":"rgba("}${ui(this.r)}, ${ui(this.g)}, ${ui(this.b)}${t===1?")":`, ${t})`}`}function El(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ui(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function oi(t){return t=ui(t),(t<16?"0":"")+t.toString(16)}function Vm(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Dr(t,e,r,n)}function Nb(t){if(t instanceof Dr)return new Dr(t.h,t.s,t.l,t.opacity);if(t instanceof sa||(t=Ro(t)),!t)return new Dr;if(t instanceof Dr)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,l=(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/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new Dr(o,a,l,t.opacity)}function FF(t,e,r,n){return arguments.length===1?Nb(t):new Dr(t,e,r,n??1)}function Dr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}up(Dr,FF,jb(sa,{brighter(t){return t=t==null?Nl:Math.pow(Nl,t),new Dr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Oo:Math.pow(Oo,t),new Dr(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 pr(bh(t>=240?t-240:t+120,i,n),bh(t,i,n),bh(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Dr(Xm(this.h),Na(this.s),Na(this.l),El(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=El(this.opacity);return`${t===1?"hsl(":"hsla("}${Xm(this.h)}, ${Na(this.s)*100}%, ${Na(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Xm(t){return t=(t||0)%360,t<0?t+360:t}function Na(t){return Math.max(0,Math.min(1,t||0))}function bh(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 dp=t=>()=>t;function Eb(t,e){return function(r){return t+r*e}}function DF(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 vY(t,e){var r=e-t;return r?Eb(t,r>180||r<-180?r-360*Math.round(r/360):r):dp(isNaN(t)?e:t)}function PF(t){return(t=+t)==1?Bb:function(e,r){return r-e?DF(e,r,t):dp(isNaN(e)?r:e)}}function Bb(t,e){var r=e-t;return r?Eb(t,r):dp(isNaN(t)?e:t)}const Km=(function t(e){var r=PF(e);function n(i,s){var o=r((i=xu(i)).r,(s=xu(s)).r),a=r(i.g,s.g),l=r(i.b,s.b),h=Bb(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=h(u),i+""}}return n.gamma=t,n})(1);function An(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var yu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ch=new RegExp(yu.source,"g");function OF(t){return function(){return t}}function $F(t){return function(e){return t(e)+""}}function RF(t,e){var r=yu.lastIndex=Ch.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=yu.exec(t))&&(i=Ch.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,l.push({i:o,x:An(n,i)})),r=Ch.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?$F(l[0].x):OF(e):(e=l.length,function(h){for(var u=0,d;u<e;++u)a[(d=l[u]).i]=d.x(h);return a.join("")})}var Qm=180/Math.PI,bu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lb(t,e,r,n,i,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,l/=a),t*n<e*r&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*Qm,skewX:Math.atan(l)*Qm,scaleX:o,scaleY:a}}var Ea;function zF(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?bu:Lb(e.a,e.b,e.c,e.d,e.e,e.f)}function WF(t){return t==null||(Ea||(Ea=document.createElementNS("http://www.w3.org/2000/svg","g")),Ea.setAttribute("transform",t),!(t=Ea.transform.baseVal.consolidate()))?bu:(t=t.matrix,Lb(t.a,t.b,t.c,t.d,t.e,t.f))}function Ab(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:An(h,d)},{i:x-2,x:An(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:An(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:An(h,u)}):u&&d.push(i(d)+"skewX("+u+n)}function l(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:An(h,d)},{i:x-2,x:An(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),l(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 qF=Ab(zF,"px, ","px)","deg)"),HF=Ab(WF,", ",")",")"),vs=0,mo=0,Js=0,Mb=1e3,Bl,go,Ll=0,yi=0,yc=0,zo=typeof performance=="object"&&performance.now?performance:Date,Ib=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function pp(){return yi||(Ib(UF),yi=zo.now()+yc)}function UF(){yi=0}function Al(){this._call=this._time=this._next=null}Al.prototype=Fb.prototype={constructor:Al,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?pp():+r)+(e==null?0:+e),!this._next&&go!==this&&(go?go._next=this:Bl=this,go=this),this._call=t,this._time=r,Cu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cu())}};function Fb(t,e,r){var n=new Al;return n.restart(t,e,r),n}function YF(){pp(),++vs;for(var t=Bl,e;t;)(e=yi-t._time)>=0&&t._call.call(void 0,e),t=t._next;--vs}function Zm(){yi=(Ll=zo.now())+yc,vs=mo=0;try{YF()}finally{vs=0,VF(),yi=0}}function GF(){var t=zo.now(),e=t-Ll;e>Mb&&(yc-=e,Ll=t)}function VF(){for(var t,e=Bl,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:Bl=r);go=t,Cu(n)}function Cu(t){if(!vs){mo&&(mo=clearTimeout(mo));var e=t-yi;e>24?(t<1/0&&(mo=setTimeout(Zm,t-zo.now()-yc)),Js&&(Js=clearInterval(Js))):(Js||(Ll=zo.now(),Js=setInterval(GF,Mb)),vs=1,Ib(Zm))}}function Jm(t,e,r){var n=new Al;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var XF=fb("start","end","cancel","interrupt"),KF=[],Db=0,tg=1,ku=2,Ja=3,eg=4,vu=5,tl=6;function bc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;QF(t,r,{name:e,index:n,group:i,on:XF,tween:KF,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Db})}function fp(t,e){var r=qr(t,e);if(r.state>Db)throw new Error("too late; already scheduled");return r}function sn(t,e){var r=qr(t,e);if(r.state>Ja)throw new Error("too late; already running");return r}function qr(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function QF(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=Fb(s,0,r.time);function s(h){r.state=tg,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!==tg)return l();for(u in n)if(p=n[u],p.name===r.name){if(p.state===Ja)return Jm(o);p.state===eg?(p.state=tl,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete n[u]):+u<e&&(p.state=tl,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete n[u])}if(Jm(function(){r.state===Ja&&(r.state=eg,r.timer.restart(a,r.delay,r.time),a(h))}),r.state=ku,r.on.call("start",t,t.__data__,r.index,r.group),r.state===ku){for(r.state=Ja,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(l),r.state=vu,1),d=-1,f=i.length;++d<f;)i[d].call(t,u);r.state===vu&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=tl,r.timer.stop(),delete n[e];for(var h in n)return;delete t.__transition}}function ZF(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>ku&&n.state<vu,n.state=tl,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function JF(t){return this.each(function(){ZF(this,t)})}function t4(t,e){var r,n;return function(){var i=sn(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 e4(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var s=sn(this,t),o=s.tween;if(o!==n){i=(n=o).slice();for(var a={name:e,value:r},l=0,h=i.length;l<h;++l)if(i[l].name===e){i[l]=a;break}l===h&&i.push(a)}s.tween=i}}function r4(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=qr(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?t4:e4)(r,t,e))}function mp(t,e,r){var n=t._id;return t.each(function(){var i=sn(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return qr(i,n).value[e]}}function Pb(t,e){var r;return(typeof e=="number"?An:e instanceof Ro?Km:(r=Ro(e))?(e=r,Km):RF)(t,e)}function n4(t){return function(){this.removeAttribute(t)}}function i4(t){return function(){this.removeAttributeNS(t.space,t.local)}}function s4(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 o4(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 a4(t,e,r){var n,i,s;return function(){var o,a=r(this),l;return a==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=a+"",o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a)))}}function l4(t,e,r){var n,i,s;return function(){var o,a=r(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=a+"",o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a)))}}function c4(t,e){var r=xc(t),n=r==="transform"?HF:Pb;return this.attrTween(t,typeof e=="function"?(r.local?l4:a4)(r,n,mp(this,"attr."+t,e)):e==null?(r.local?i4:n4)(r):(r.local?o4:s4)(r,n,e))}function h4(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function u4(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function d4(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&u4(t,s)),r}return i._value=e,i}function p4(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&h4(t,s)),r}return i._value=e,i}function f4(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=xc(t);return this.tween(r,(n.local?d4:p4)(n,e))}function m4(t,e){return function(){fp(this,t).delay=+e.apply(this,arguments)}}function g4(t,e){return e=+e,function(){fp(this,t).delay=e}}function x4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?m4:g4)(e,t)):qr(this.node(),e).delay}function y4(t,e){return function(){sn(this,t).duration=+e.apply(this,arguments)}}function b4(t,e){return e=+e,function(){sn(this,t).duration=e}}function C4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?y4:b4)(e,t)):qr(this.node(),e).duration}function k4(t,e){if(typeof e!="function")throw new Error;return function(){sn(this,t).ease=e}}function v4(t){var e=this._id;return arguments.length?this.each(k4(e,t)):qr(this.node(),e).ease}function w4(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;sn(this,t).ease=r}}function S4(t){if(typeof t!="function")throw new Error;return this.each(w4(this._id,t))}function T4(t){typeof t!="function"&&(t=xb(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]=[],l,h=0;h<o;++h)(l=s[h])&&t.call(l,l.__data__,h,s)&&a.push(l);return new gn(n,this._parents,this._name,this._id)}function _4(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 l=e[a],h=r[a],u=l.length,d=o[a]=new Array(u),f,p=0;p<u;++p)(f=l[p]||h[p])&&(d[p]=f);for(;a<n;++a)o[a]=e[a];return new gn(o,this._parents,this._name,this._id)}function j4(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 N4(t,e,r){var n,i,s=j4(e)?fp:sn;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function E4(t,e){var r=this._id;return arguments.length<2?qr(this.node(),r).on.on(t):this.each(N4(r,t,e))}function B4(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function L4(){return this.on("end.remove",B4(this._id))}function A4(t){var e=this._name,r=this._id;typeof t!="function"&&(t=cp(t));for(var n=this._groups,i=n.length,s=new Array(i),o=0;o<i;++o)for(var a=n[o],l=a.length,h=s[o]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=t.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),h[f]=d,bc(h[f],e,r,f,h,qr(u,r)));return new gn(s,this._parents,e,r)}function M4(t){var e=this._name,r=this._id;typeof t!="function"&&(t=gb(t));for(var n=this._groups,i=n.length,s=[],o=[],a=0;a<i;++a)for(var l=n[a],h=l.length,u,d=0;d<h;++d)if(u=l[d]){for(var f=t.call(u,u.__data__,d,l),p,m=qr(u,r),x=0,g=f.length;x<g;++x)(p=f[x])&&bc(p,e,r,x,f,m);s.push(f),o.push(u)}return new gn(s,o,e,r)}var I4=ia.prototype.constructor;function F4(){return new I4(this._groups,this._parents)}function D4(t,e){var r,n,i;return function(){var s=ks(this,t),o=(this.style.removeProperty(t),ks(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function Ob(t){return function(){this.style.removeProperty(t)}}function P4(t,e,r){var n,i=r+"",s;return function(){var o=ks(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function O4(t,e,r){var n,i,s;return function(){var o=ks(this,t),a=r(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),ks(this,t))),o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a))}}function $4(t,e){var r,n,i,s="style."+e,o="end."+s,a;return function(){var l=sn(this,t),h=l.on,u=l.value[s]==null?a||(a=Ob(e)):void 0;(h!==r||i!==u)&&(n=(r=h).copy()).on(o,i=u),l.on=n}}function R4(t,e,r){var n=(t+="")=="transform"?qF:Pb;return e==null?this.styleTween(t,D4(t,n)).on("end.style."+t,Ob(t)):typeof e=="function"?this.styleTween(t,O4(t,n,mp(this,"style."+t,e))).each($4(this._id,t)):this.styleTween(t,P4(t,n,e),r).on("end.style."+t,null)}function z4(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function W4(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&z4(t,o,r)),n}return s._value=e,s}function q4(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,W4(t,e,r??""))}function H4(t){return function(){this.textContent=t}}function U4(t){return function(){var e=t(this);this.textContent=e??""}}function Y4(t){return this.tween("text",typeof t=="function"?U4(mp(this,"text",t)):H4(t==null?"":t+""))}function G4(t){return function(e){this.textContent=t.call(this,e)}}function V4(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&G4(i)),e}return n._value=t,n}function X4(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,V4(t))}function K4(){for(var t=this._name,e=this._id,r=$b(),n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,l,h=0;h<a;++h)if(l=o[h]){var u=qr(l,e);bc(l,t,r,h,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new gn(n,this._parents,t,r)}function Q4(){var t,e,r=this,n=r._id,i=r.size();return new Promise(function(s,o){var a={value:o},l={value:function(){--i===0&&s()}};r.each(function(){var h=sn(this,n),u=h.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),h.on=e}),i===0&&s()})}var Z4=0;function gn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function $b(){return++Z4}var hn=ia.prototype;gn.prototype={constructor:gn,select:A4,selectAll:M4,selectChild:hn.selectChild,selectChildren:hn.selectChildren,filter:T4,merge:_4,selection:F4,transition:K4,call:hn.call,nodes:hn.nodes,node:hn.node,size:hn.size,empty:hn.empty,each:hn.each,on:E4,attr:c4,attrTween:f4,style:R4,styleTween:q4,text:Y4,textTween:X4,remove:L4,tween:r4,delay:x4,duration:C4,ease:v4,easeVarying:S4,end:Q4,[Symbol.iterator]:hn[Symbol.iterator]};function J4(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var tD={time:null,delay:0,duration:250,ease:J4};function eD(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 rD(t){var e,r;t instanceof gn?(e=t._id,t=t._name):(e=$b(),(r=tD).time=pp(),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,l,h=0;h<a;++h)(l=o[h])&&bc(l,t,e,h,o,r||eD(l,e));return new gn(n,this._parents,t,e)}ia.prototype.interrupt=JF;ia.prototype.transition=rD;const wu=Math.PI,Su=2*wu,ei=1e-6,nD=Su-ei;function Rb(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function iD(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Rb;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 sD{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Rb:iD(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,l=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>ei)if(!(Math.abs(d*l-h*u)>ei)||!s)this._append`L${this._x1=e},${this._y1=r}`;else{let p=n-o,m=i-a,x=l*l+h*h,g=p*p+m*m,y=Math.sqrt(x),C=Math.sqrt(f),b=s*Math.tan((wu-Math.acos((x+f-g)/(2*y*C)))/2),w=b/C,_=b/y;Math.abs(w-1)>ei&&this._append`L${e+w*u},${r+w*d}`,this._append`A${s},${s},0,0,${+(d*p>u*m)},${this._x1=e+_*l},${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),l=n*Math.sin(i),h=e+a,u=r+l,d=1^o,f=o?i-s:s-i;this._x1===null?this._append`M${h},${u}`:(Math.abs(this._x1-h)>ei||Math.abs(this._y1-u)>ei)&&this._append`L${h},${u}`,n&&(f<0&&(f=f%Su+Su),f>nD?this._append`A${n},${n},0,1,${d},${e-a},${r-l}A${n},${n},0,1,${d},${this._x1=h},${this._y1=u}`:f>ei&&this._append`A${n},${n},0,${+(f>=wu)},${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 Fi(t){return function(){return t}}const wY=Math.abs,SY=Math.atan2,TY=Math.cos,_Y=Math.max,jY=Math.min,NY=Math.sin,EY=Math.sqrt,rg=1e-12,gp=Math.PI,ng=gp/2,BY=2*gp;function LY(t){return t>1?0:t<-1?gp:Math.acos(t)}function AY(t){return t>=1?ng:t<=-1?-ng:Math.asin(t)}function oD(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 sD(e)}function aD(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function zb(t){this._context=t}zb.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 Eo(t){return new zb(t)}function lD(t){return t[0]}function cD(t){return t[1]}function hD(t,e){var r=Fi(!0),n=null,i=Eo,s=null,o=oD(a);t=typeof t=="function"?t:t===void 0?lD:Fi(t),e=typeof e=="function"?e:e===void 0?cD:Fi(e);function a(l){var h,u=(l=aD(l)).length,d,f=!1,p;for(n==null&&(s=i(p=o())),h=0;h<=u;++h)!(h<u&&r(d=l[h],h,l))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+t(d,h,l),+e(d,h,l));if(p)return s=null,p+""||null}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:Fi(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Fi(+l),a):e},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Fi(!!l),a):r},a.curve=function(l){return arguments.length?(i=l,n!=null&&(s=i(n)),a):i},a.context=function(l){return arguments.length?(l==null?n=s=null:s=i(n=l),a):n},a}class Wb{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 qb(t){return new Wb(t,!0)}function Hb(t){return new Wb(t,!1)}function Rn(){}function Ml(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 Cc(t){this._context=t}Cc.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:Ml(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:Ml(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Tu(t){return new Cc(t)}function Ub(t){this._context=t}Ub.prototype={areaStart:Rn,areaEnd:Rn,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:Ml(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function uD(t){return new Ub(t)}function Yb(t){this._context=t}Yb.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:Ml(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function dD(t){return new Yb(t)}function Gb(t,e){this._basis=new Cc(t),this._beta=e}Gb.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,l;++a<=r;)l=a/r,this._basis.point(this._beta*t[a]+(1-this._beta)*(n+l*s),this._beta*e[a]+(1-this._beta)*(i+l*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const pD=(function t(e){function r(n){return e===1?new Cc(n):new Gb(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function Il(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 xp(t,e){this._context=t,this._k=(1-e)/6}xp.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:Il(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:Il(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 Vb=(function t(e){function r(n){return new xp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function yp(t,e){this._context=t,this._k=(1-e)/6}yp.prototype={areaStart:Rn,areaEnd:Rn,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:Il(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 fD=(function t(e){function r(n){return new yp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function bp(t,e){this._context=t,this._k=(1-e)/6}bp.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:Il(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 mD=(function t(e){function r(n){return new bp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function Cp(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>rg){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>rg){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 Xb(t,e){this._context=t,this._alpha=e}Xb.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:Cp(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 Kb=(function t(e){function r(n){return e?new Xb(n,e):new xp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function Qb(t,e){this._context=t,this._alpha=e}Qb.prototype={areaStart:Rn,areaEnd:Rn,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:Cp(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 gD=(function t(e){function r(n){return e?new Qb(n,e):new yp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function Zb(t,e){this._context=t,this._alpha=e}Zb.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:Cp(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 xD=(function t(e){function r(n){return e?new Zb(n,e):new bp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function Jb(t){this._context=t}Jb.prototype={areaStart:Rn,areaEnd:Rn,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 yD(t){return new Jb(t)}function ig(t){return t<0?-1:1}function sg(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(ig(s)+ig(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function og(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function kh(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 Fl(t){this._context=t}Fl.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:kh(this,this._t0,og(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,kh(this,og(this,r=sg(this,t,e)),r);break;default:kh(this,this._t0,r=sg(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function t1(t){this._context=new e1(t)}(t1.prototype=Object.create(Fl.prototype)).point=function(t,e){Fl.prototype.point.call(this,e,t)};function e1(t){this._context=t}e1.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 r1(t){return new Fl(t)}function n1(t){return new t1(t)}function i1(t){this._context=t}i1.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=ag(t),i=ag(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 ag(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 s1(t){return new i1(t)}function kc(t,e){this._context=t,this._t=e}kc.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 o1(t){return new kc(t,.5)}function a1(t){return new kc(t,0)}function l1(t){return new kc(t,1)}function xo(t,e,r){this.k=t,this.x=e,this.y=r}xo.prototype={constructor:xo,scale:function(t){return t===1?this:new xo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new xo(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+")"}};xo.prototype;var bD=v(t=>{var i;const{securityLevel:e}=Kt();let r=Wt("body");if(e==="sandbox"){const o=((i=Wt(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=Wt(o.body)}return r.select(`#${t}`)},"selectSvgElement");function kp(t){return typeof t>"u"||t===null}v(kp,"isNothing");function c1(t){return typeof t=="object"&&t!==null}v(c1,"isObject");function h1(t){return Array.isArray(t)?t:kp(t)?[]:[t]}v(h1,"toArray");function u1(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(u1,"extend");function d1(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(d1,"repeat");function p1(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(p1,"isNegativeZero");var CD=kp,kD=c1,vD=h1,wD=d1,SD=p1,TD=u1,Le={isNothing:CD,isObject:kD,toArray:vD,repeat:wD,isNegativeZero:SD,extend:TD};function vp(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+=`
430
-
431
- `+t.mark.snippet),n+" "+r):n}v(vp,"formatError");function ws(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=vp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}v(ws,"YAMLException$1");ws.prototype=Object.create(Error.prototype);ws.prototype.constructor=ws;ws.prototype.toString=v(function(e){return this.name+": "+vp(this,e)},"toString");var dr=ws;function el(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(el,"getLine");function rl(t,e){return Le.repeat(" ",e-t.length)+t}v(rl,"padStart");function f1(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="",l,h,u=Math.min(t.line+e.linesAfter,i.length).toString().length,d=e.maxLength-(e.indent+u+3);for(l=1;l<=e.linesBefore&&!(o-l<0);l++)h=el(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Le.repeat(" ",e.indent)+rl((t.line-l+1).toString(),u)+" | "+h.str+`
432
- `+a;for(h=el(t.buffer,n[o],i[o],t.position,d),a+=Le.repeat(" ",e.indent)+rl((t.line+1).toString(),u)+" | "+h.str+`
433
- `,a+=Le.repeat("-",e.indent+u+3+h.pos)+`^
434
- `,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)h=el(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Le.repeat(" ",e.indent)+rl((t.line+l+1).toString(),u)+" | "+h.str+`
435
- `;return a.replace(/\n$/,"")}v(f1,"makeSnippet");var _D=f1,jD=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],ND=["scalar","sequence","mapping"];function m1(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v(m1,"compileStyleAliases");function g1(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(jD.indexOf(r)===-1)throw new dr('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=m1(e.styleAliases||null),ND.indexOf(this.kind)===-1)throw new dr('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(g1,"Type$1");var Ye=g1;function _u(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(_u,"compileList");function x1(){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(x1,"compileMap");function Dl(t){return this.extend(t)}v(Dl,"Schema$1");Dl.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Ye)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 dr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ye))throw new dr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new dr("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 dr("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 Ye))throw new dr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Dl.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=_u(i,"implicit"),i.compiledExplicit=_u(i,"explicit"),i.compiledTypeMap=x1(i.compiledImplicit,i.compiledExplicit),i},"extend");var ED=Dl,BD=new Ye("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),LD=new Ye("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),AD=new Ye("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),MD=new ED({explicit:[BD,LD,AD]});function y1(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(y1,"resolveYamlNull");function b1(){return null}v(b1,"constructYamlNull");function C1(t){return t===null}v(C1,"isNull");var ID=new Ye("tag:yaml.org,2002:null",{kind:"scalar",resolve:y1,construct:b1,predicate:C1,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 k1(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(k1,"resolveYamlBoolean");function v1(t){return t==="true"||t==="True"||t==="TRUE"}v(v1,"constructYamlBoolean");function w1(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(w1,"isBoolean");var FD=new Ye("tag:yaml.org,2002:bool",{kind:"scalar",resolve:k1,construct:v1,predicate:w1,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 S1(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(S1,"isHexCode");function T1(t){return 48<=t&&t<=55}v(T1,"isOctCode");function _1(t){return 48<=t&&t<=57}v(_1,"isDecCode");function j1(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(!S1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!T1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!_1(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(j1,"resolveYamlInteger");function N1(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(N1,"constructYamlInteger");function E1(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Le.isNegativeZero(t)}v(E1,"isInteger");var DD=new Ye("tag:yaml.org,2002:int",{kind:"scalar",resolve:j1,construct:N1,predicate:E1,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"]}}),PD=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function B1(t){return!(t===null||!PD.test(t)||t[t.length-1]==="_")}v(B1,"resolveYamlFloat");function L1(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(L1,"constructYamlFloat");var OD=/^[-+]?[0-9]+e/;function A1(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(Le.isNegativeZero(t))return"-0.0";return r=t.toString(10),OD.test(r)?r.replace("e",".e"):r}v(A1,"representYamlFloat");function M1(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Le.isNegativeZero(t))}v(M1,"isFloat");var $D=new Ye("tag:yaml.org,2002:float",{kind:"scalar",resolve:B1,construct:L1,predicate:M1,represent:A1,defaultStyle:"lowercase"}),I1=MD.extend({implicit:[ID,FD,DD,$D]}),RD=I1,F1=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),D1=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 P1(t){return t===null?!1:F1.exec(t)!==null||D1.exec(t)!==null}v(P1,"resolveYamlTimestamp");function O1(t){var e,r,n,i,s,o,a,l=0,h=null,u,d,f;if(e=F1.exec(t),e===null&&(e=D1.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(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}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,l)),h&&f.setTime(f.getTime()-h),f}v(O1,"constructYamlTimestamp");function $1(t){return t.toISOString()}v($1,"representYamlTimestamp");var zD=new Ye("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:P1,construct:O1,instanceOf:Date,represent:$1});function R1(t){return t==="<<"||t===null}v(R1,"resolveYamlMerge");var WD=new Ye("tag:yaml.org,2002:merge",{kind:"scalar",resolve:R1}),wp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
436
- \r`;function z1(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=wp;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(z1,"resolveYamlBinary");function W1(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=wp,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(W1,"constructYamlBinary");function q1(t){var e="",r=0,n,i,s=t.length,o=wp;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(q1,"representYamlBinary");function H1(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(H1,"isBinary");var qD=new Ye("tag:yaml.org,2002:binary",{kind:"scalar",resolve:z1,construct:W1,predicate:H1,represent:q1}),HD=Object.prototype.hasOwnProperty,UD=Object.prototype.toString;function U1(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,UD.call(i)!=="[object Object]")return!1;for(s in i)if(HD.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(U1,"resolveYamlOmap");function Y1(t){return t!==null?t:[]}v(Y1,"constructYamlOmap");var YD=new Ye("tag:yaml.org,2002:omap",{kind:"sequence",resolve:U1,construct:Y1}),GD=Object.prototype.toString;function G1(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(G1,"resolveYamlPairs");function V1(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(V1,"constructYamlPairs");var VD=new Ye("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:G1,construct:V1}),XD=Object.prototype.hasOwnProperty;function X1(t){if(t===null)return!0;var e,r=t;for(e in r)if(XD.call(r,e)&&r[e]!==null)return!1;return!0}v(X1,"resolveYamlSet");function K1(t){return t!==null?t:{}}v(K1,"constructYamlSet");var KD=new Ye("tag:yaml.org,2002:set",{kind:"mapping",resolve:X1,construct:K1}),Q1=RD.extend({implicit:[zD,WD],explicit:[qD,YD,VD,KD]}),zn=Object.prototype.hasOwnProperty,Pl=1,Z1=2,J1=3,Ol=4,vh=1,QD=2,lg=3,ZD=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,JD=/[\x85\u2028\u2029]/,tP=/[,\[\]\{\}]/,tC=/^(?:!|!!|![a-z\-]+!)$/i,eC=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ju(t){return Object.prototype.toString.call(t)}v(ju,"_class");function $r(t){return t===10||t===13}v($r,"is_EOL");function Dn(t){return t===9||t===32}v(Dn,"is_WHITE_SPACE");function tr(t){return t===9||t===32||t===10||t===13}v(tr,"is_WS_OR_EOL");function ai(t){return t===44||t===91||t===93||t===123||t===125}v(ai,"is_FLOW_INDICATOR");function rC(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(rC,"fromHexCode");function nC(t){return t===120?2:t===117?4:t===85?8:0}v(nC,"escapedHexLen");function iC(t){return 48<=t&&t<=57?t-48:-1}v(iC,"fromDecimalCode");function Nu(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
437
- `: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(Nu,"simpleEscapeSequence");function sC(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v(sC,"charFromCodepoint");function Sp(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(Sp,"setProperty");var oC=new Array(256),aC=new Array(256);for(Jn=0;Jn<256;Jn++)oC[Jn]=Nu(Jn)?1:0,aC[Jn]=Nu(Jn);var Jn;function lC(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Q1,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(lC,"State$1");function Tp(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=_D(r),new dr(e,r)}v(Tp,"generateError");function St(t,e){throw Tp(t,e)}v(St,"throwError");function Wo(t,e){t.onWarning&&t.onWarning.call(null,Tp(t,e))}v(Wo,"throwWarning");var cg={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&St(e,"duplication of %YAML directive"),n.length!==1&&St(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&St(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&St(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Wo(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&St(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],tC.test(i)||St(e,"ill-formed tag handle (first argument) of the TAG directive"),zn.call(e.tagMap,i)&&St(e,'there is a previously declared suffix for "'+i+'" tag handle'),eC.test(s)||St(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{St(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function fn(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||St(t,"expected valid JSON character");else ZD.test(a)&&St(t,"the stream contains non-printable characters");t.result+=a}}v(fn,"captureSegment");function Eu(t,e,r,n){var i,s,o,a;for(Le.isObject(r)||St(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],zn.call(e,s)||(Sp(e,s,r[s]),n[s]=!0)}v(Eu,"mergeMappings");function li(t,e,r,n,i,s,o,a,l){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])&&St(t,"nested arrays are not supported inside keys"),typeof i=="object"&&ju(i[h])==="[object Object]"&&(i[h]="[object Object]");if(typeof i=="object"&&ju(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)Eu(t,e,s[h],r);else Eu(t,e,s,r);else!t.json&&!zn.call(r,i)&&zn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,St(t,"duplicated mapping key")),Sp(e,i,s),delete r[i];return e}v(li,"storeMappingPair");function vc(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++):St(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v(vc,"readLineBreak");function ke(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;Dn(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($r(i))for(vc(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&&Wo(t,"deficient indentation"),n}v(ke,"skipSeparationSpace");function oa(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||tr(r)))}v(oa,"testDocumentSeparator");function wc(t,e){e===1?t.result+=" ":e>1&&(t.result+=Le.repeat(`
438
- `,e-1))}v(wc,"writeFoldedLines");function cC(t,e,r){var n,i,s,o,a,l,h,u,d=t.kind,f=t.result,p;if(p=t.input.charCodeAt(t.position),tr(p)||ai(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),tr(i)||r&&ai(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),tr(i)||r&&ai(i))break}else if(p===35){if(n=t.input.charCodeAt(t.position-1),tr(n))break}else{if(t.position===t.lineStart&&oa(t)||r&&ai(p))break;if($r(p))if(l=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=l,t.lineStart=h,t.lineIndent=u;break}}a&&(fn(t,s,o,!1),wc(t,t.line-l),s=o=t.position,a=!1),Dn(p)||(o=t.position+1),p=t.input.charCodeAt(++t.position)}return fn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=f,!1)}v(cC,"readPlainScalar");function hC(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(fn(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 $r(r)?(fn(t,n,i,!0),wc(t,ke(t,!1,e)),n=i=t.position):t.position===t.lineStart&&oa(t)?St(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);St(t,"unexpected end of the stream within a single quoted scalar")}v(hC,"readSingleQuotedScalar");function uC(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 fn(t,r,t.position,!0),t.position++,!0;if(a===92){if(fn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),$r(a))ke(t,!1,e);else if(a<256&&oC[a])t.result+=aC[a],t.position++;else if((o=nC(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=rC(a))>=0?s=(s<<4)+o:St(t,"expected hexadecimal character");t.result+=sC(s),t.position++}else St(t,"unknown escape sequence");r=n=t.position}else $r(a)?(fn(t,r,n,!0),wc(t,ke(t,!1,e)),r=n=t.position):t.position===t.lineStart&&oa(t)?St(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}St(t,"unexpected end of the stream within a double quoted scalar")}v(uC,"readDoubleQuotedScalar");function dC(t,e){var r=!0,n,i,s,o=t.tag,a,l=t.anchor,h,u,d,f,p,m=Object.create(null),x,g,y,C;if(C=t.input.charCodeAt(t.position),C===91)u=93,p=!1,a=[];else if(C===123)u=125,p=!0,a={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),C=t.input.charCodeAt(++t.position);C!==0;){if(ke(t,!0,e),C=t.input.charCodeAt(t.position),C===u)return t.position++,t.tag=o,t.anchor=l,t.kind=p?"mapping":"sequence",t.result=a,!0;r?C===44&&St(t,"expected the node content, but found ','"):St(t,"missed comma between flow collection entries"),g=x=y=null,d=f=!1,C===63&&(h=t.input.charCodeAt(t.position+1),tr(h)&&(d=f=!0,t.position++,ke(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,bi(t,e,Pl,!1,!0),g=t.tag,x=t.result,ke(t,!0,e),C=t.input.charCodeAt(t.position),(f||t.line===n)&&C===58&&(d=!0,C=t.input.charCodeAt(++t.position),ke(t,!0,e),bi(t,e,Pl,!1,!0),y=t.result),p?li(t,a,m,g,x,y,n,i,s):d?a.push(li(t,null,m,g,x,y,n,i,s)):a.push(x),ke(t,!0,e),C=t.input.charCodeAt(t.position),C===44?(r=!0,C=t.input.charCodeAt(++t.position)):r=!1}St(t,"unexpected end of the stream within a flow collection")}v(dC,"readFlowCollection");function pC(t,e){var r,n,i=vh,s=!1,o=!1,a=e,l=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)vh===i?i=d===43?lg:QD:St(t,"repeat of a chomping mode identifier");else if((u=iC(d))>=0)u===0?St(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?St(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(Dn(d)){do d=t.input.charCodeAt(++t.position);while(Dn(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!$r(d)&&d!==0)}for(;d!==0;){for(vc(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),$r(d)){l++;continue}if(t.lineIndent<a){i===lg?t.result+=Le.repeat(`
439
- `,s?1+l:l):i===vh&&s&&(t.result+=`
440
- `);break}for(n?Dn(d)?(h=!0,t.result+=Le.repeat(`
441
- `,s?1+l:l)):h?(h=!1,t.result+=Le.repeat(`
442
- `,l+1)):l===0?s&&(t.result+=" "):t.result+=Le.repeat(`
443
- `,l):t.result+=Le.repeat(`
444
- `,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!$r(d)&&d!==0;)d=t.input.charCodeAt(++t.position);fn(t,r,t.position,!1)}return!0}v(pC,"readBlockScalar");function Bu(t,e){var r,n=t.tag,i=t.anchor,s=[],o,a=!1,l;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=s),l=t.input.charCodeAt(t.position);l!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,St(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!tr(o))));){if(a=!0,t.position++,ke(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,bi(t,e,J1,!1,!0),s.push(t.result),ke(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)St(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(Bu,"readBlockSequence");function fC(t,e,r){var n,i,s,o,a,l,h=t.tag,u=t.anchor,d={},f=Object.create(null),p=null,m=null,x=null,g=!1,y=!1,C;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=d),C=t.input.charCodeAt(t.position);C!==0;){if(!g&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,St(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(C===63||C===58)&&tr(n))C===63?(g&&(li(t,d,f,p,m,null,o,a,l),p=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):St(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,C=n;else{if(o=t.line,a=t.lineStart,l=t.position,!bi(t,r,Z1,!1,!0))break;if(t.line===s){for(C=t.input.charCodeAt(t.position);Dn(C);)C=t.input.charCodeAt(++t.position);if(C===58)C=t.input.charCodeAt(++t.position),tr(C)||St(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(li(t,d,f,p,m,null,o,a,l),p=m=x=null),y=!0,g=!1,i=!1,p=t.tag,m=t.result;else if(y)St(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=h,t.anchor=u,!0}else if(y)St(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,l=t.position),bi(t,e,Ol,!0,i)&&(g?m=t.result:x=t.result),g||(li(t,d,f,p,m,x,o,a,l),p=m=x=null),ke(t,!0,-1),C=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&C!==0)St(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&li(t,d,f,p,m,null,o,a,l),y&&(t.tag=h,t.anchor=u,t.kind="mapping",t.result=d),y}v(fC,"readBlockMapping");function mC(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&&St(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)):St(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!tr(o);)o===33&&(n?St(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),tC.test(i)||St(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),tP.test(s)&&St(t,"tag suffix cannot contain flow indicator characters")}s&&!eC.test(s)&&St(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{St(t,"tag name is malformed: "+s)}return r?t.tag=s:zn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:St(t,'undeclared tag handle "'+i+'"'),!0}v(mC,"readTagProperty");function gC(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&St(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!tr(r)&&!ai(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&St(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(gC,"readAnchorProperty");function xC(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&&!tr(n)&&!ai(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&St(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),zn.call(t.anchorMap,r)||St(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],ke(t,!0,-1),!0}v(xC,"readAlias");function bi(t,e,r,n,i){var s,o,a,l=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=Ol===r||J1===r,n&&ke(t,!0,-1)&&(h=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;mC(t)||gC(t);)ke(t,!0,-1)?(h=!0,a=s,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=h||i),(l===1||Ol===r)&&(Pl===r||Z1===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&(Bu(t,g)||fC(t,g,x))||dC(t,x)?u=!0:(o&&pC(t,x)||hC(t,x)||uC(t,x)?u=!0:xC(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&St(t,"alias node should not have any properties")):cC(t,x,Pl===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&Bu(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"&&St(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(zn.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||St(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&St(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)):St(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(bi,"composeNode");function yC(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&&!tr(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&St(t,"directive name must not be less than one character in length");o!==0;){for(;Dn(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!$r(o));break}if($r(o))break;for(r=t.position;o!==0&&!tr(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&vc(t),zn.call(cg,n)?cg[n](t,n,i):Wo(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&&St(t,"directives end mark is expected"),bi(t,t.lineIndent-1,Ol,!1,!0),ke(t,!0,-1),t.checkLineBreaks&&JD.test(t.input.slice(e,t.position))&&Wo(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&oa(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,ke(t,!0,-1));return}if(t.position<t.length-1)St(t,"end of the stream or a document separator is expected");else return}v(yC,"readDocument");function _p(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
445
- `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new lC(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,St(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;)yC(r);return r.documents}v(_p,"loadDocuments");function eP(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=_p(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(eP,"loadAll$1");function bC(t,e){var r=_p(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new dr("expected a single document in the stream, but found more")}}v(bC,"load$1");var rP=bC,nP={load:rP},CC=Object.prototype.toString,kC=Object.prototype.hasOwnProperty,jp=65279,iP=9,qo=10,sP=13,oP=32,aP=33,lP=34,Lu=35,cP=37,hP=38,uP=39,dP=42,vC=44,pP=45,$l=58,fP=61,mP=62,gP=63,xP=64,wC=91,SC=93,yP=96,TC=123,bP=124,_C=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 CP=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],kP=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function jC(t,e){var r,n,i,s,o,a,l;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)),l=t.compiledTypeMap.fallback[o],l&&kC.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}v(jC,"compileStyleMap");function NC(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 dr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Le.repeat("0",n-e.length)+e}v(NC,"encodeHex");var vP=1,Ho=2;function EC(t){this.schema=t.schema||Q1,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Le.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=jC(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==='"'?Ho:vP,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(EC,"State");function Au(t,e){for(var r=Le.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
446
- `,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
447
- `&&(s+=r),s+=o;return s}v(Au,"indentString");function Rl(t,e){return`
448
- `+Le.repeat(" ",t.indent*e)}v(Rl,"generateNextLine");function BC(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(BC,"testImplicitResolving");function Uo(t){return t===oP||t===iP}v(Uo,"isWhitespace");function Ss(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==jp||65536<=t&&t<=1114111}v(Ss,"isPrintable");function Mu(t){return Ss(t)&&t!==jp&&t!==sP&&t!==qo}v(Mu,"isNsCharOrWhitespace");function Iu(t,e,r){var n=Mu(t),i=n&&!Uo(t);return(r?n:n&&t!==vC&&t!==wC&&t!==SC&&t!==TC&&t!==_C)&&t!==Lu&&!(e===$l&&!i)||Mu(e)&&!Uo(e)&&t===Lu||e===$l&&i}v(Iu,"isPlainSafe");function LC(t){return Ss(t)&&t!==jp&&!Uo(t)&&t!==pP&&t!==gP&&t!==$l&&t!==vC&&t!==wC&&t!==SC&&t!==TC&&t!==_C&&t!==Lu&&t!==hP&&t!==dP&&t!==aP&&t!==bP&&t!==fP&&t!==mP&&t!==uP&&t!==lP&&t!==cP&&t!==xP&&t!==yP}v(LC,"isPlainSafeFirst");function AC(t){return!Uo(t)&&t!==$l}v(AC,"isPlainSafeLast");function Gi(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(Gi,"codePointAt");function Np(t){var e=/^\n* /;return e.test(t)}v(Np,"needIndentIndicator");var MC=1,Fu=2,IC=3,FC=4,Hi=5;function DC(t,e,r,n,i,s,o,a){var l,h=0,u=null,d=!1,f=!1,p=n!==-1,m=-1,x=LC(Gi(t,0))&&AC(Gi(t,t.length-1));if(e||o)for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Gi(t,l),!Ss(h))return Hi;x=x&&Iu(h,u,a),u=h}else{for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Gi(t,l),h===qo)d=!0,p&&(f=f||l-m-1>n&&t[m+1]!==" ",m=l);else if(!Ss(h))return Hi;x=x&&Iu(h,u,a),u=h}f=f||p&&l-m-1>n&&t[m+1]!==" "}return!d&&!f?x&&!o&&!i(t)?MC:s===Ho?Hi:Fu:r>9&&Np(t)?Hi:o?s===Ho?Hi:Fu:f?FC:IC}v(DC,"chooseScalarStyle");function PC(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===Ho?'""':"''";if(!t.noCompatMode&&(CP.indexOf(e)!==-1||kP.test(e)))return t.quotingType===Ho?'"'+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 l(h){return BC(t,h)}switch(v(l,"testAmbiguity"),DC(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case MC:return e;case Fu:return"'"+e.replace(/'/g,"''")+"'";case IC:return"|"+Du(e,t.indent)+Pu(Au(e,s));case FC:return">"+Du(e,t.indent)+Pu(Au(OC(e,o),s));case Hi:return'"'+$C(e)+'"';default:throw new dr("impossible error: invalid scalar style")}})()}v(PC,"writeScalar");function Du(t,e){var r=Np(t)?String(e):"",n=t[t.length-1]===`
449
- `,i=n&&(t[t.length-2]===`
450
- `||t===`
451
- `),s=i?"+":n?"":"-";return r+s+`
452
- `}v(Du,"blockHeader");function Pu(t){return t[t.length-1]===`
453
- `?t.slice(0,-1):t}v(Pu,"dropEndingNewline");function OC(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var h=t.indexOf(`
454
- `);return h=h!==-1?h:t.length,r.lastIndex=h,Ou(t.slice(0,h),e)})(),i=t[0]===`
455
- `||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
456
- `:"")+Ou(l,e),i=s}return n}v(OC,"foldString");function Ou(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,n,i=0,s,o=0,a=0,l="";n=r.exec(t);)a=n.index,a-i>e&&(s=o>i?o:a,l+=`
457
- `+t.slice(i,s),i=s+1),o=a;return l+=`
458
- `,t.length-i>e&&o>i?l+=t.slice(i,o)+`
459
- `+t.slice(o+1):l+=t.slice(i),l.slice(1)}v(Ou,"foldLine");function $C(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=Gi(t,i),n=Ve[r],!n&&Ss(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||NC(r);return e}v($C,"escapeString");function RC(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)),(Jr(t,e,a,!1,!1)||typeof a>"u"&&Jr(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}v(RC,"writeFlowSequence");function $u(t,e,r,n){var i="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(Jr(t,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&Jr(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Rl(t,e)),t.dump&&qo===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v($u,"writeBlockSequence");function zC(t,e,r){var n="",i=t.tag,s=Object.keys(r),o,a,l,h,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],h=r[l],t.replacer&&(h=t.replacer.call(r,l,h)),Jr(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Jr(t,e,h,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}v(zC,"writeFlowMapping");function WC(t,e,r,n){var i="",s=t.tag,o=Object.keys(r),a,l,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 dr("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!n||i!=="")&&(f+=Rl(t,e)),h=o[a],u=r[h],t.replacer&&(u=t.replacer.call(r,h,u)),Jr(t,e+1,h,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&qo===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,d&&(f+=Rl(t,e)),Jr(t,e+1,u,!0,d)&&(t.dump&&qo===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,i+=f));t.tag=s,t.dump=i||"{}"}v(WC,"writeBlockMapping");function Ru(t,e,r){var n,i,s,o,a,l;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(l=t.styleMap[a.tag]||a.defaultStyle,CC.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(kC.call(a.represent,l))n=a.represent[l](e,l);else throw new dr("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}v(Ru,"detectType");function Jr(t,e,r,n,i,s,o){t.tag=null,t.dump=r,Ru(t,r,!1)||Ru(t,r,!0);var a=CC.call(t.dump),l=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?(WC(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(zC(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?$u(t,e-1,t.dump,i):$u(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(RC(t,e,t.dump),f&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&PC(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new dr("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(Jr,"writeNode");function qC(t,e){var r=[],n=[],i,s;for(zl(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v(qC,"getDuplicateReferences");function zl(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)zl(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)zl(t[n[i]],e,r)}v(zl,"inspectNode");function wP(t,e){e=e||{};var r=new EC(e);r.noRefs||qC(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Jr(r,0,n,!0,!0)?r.dump+`
460
- `:""}v(wP,"dump$1");function SP(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(SP,"renamed");var TP=I1,_P=nP.load;/*! Bundled license information:
461
-
462
- js-yaml/dist/js-yaml.mjs:
463
- (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
464
- */var to=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"),qe={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},hg={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function yo(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=de(t),e=de(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(yo,"calculateDeltaAndAngle");var de=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),jP=v(t=>({x:v(function(e,r,n){let i=0;const s=de(n[0]).x<de(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(qe,t.arrowTypeStart)){const{angle:p,deltaX:m}=yo(n[0],n[1]);i=qe[t.arrowTypeStart]*Math.cos(p)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(qe,t.arrowTypeEnd)){const{angle:p,deltaX:m}=yo(n[n.length-1],n[n.length-2]);i=qe[t.arrowTypeEnd]*Math.cos(p)*(m>=0?1:-1)}const o=Math.abs(de(e).x-de(n[n.length-1]).x),a=Math.abs(de(e).y-de(n[n.length-1]).y),l=Math.abs(de(e).x-de(n[0]).x),h=Math.abs(de(e).y-de(n[0]).y),u=qe[t.arrowTypeStart],d=qe[t.arrowTypeEnd],f=1;if(o<d&&o>0&&a<d){let p=d+f-o;p*=s==="right"?-1:1,i-=p}if(l<u&&l>0&&h<u){let p=u+f-l;p*=s==="right"?-1:1,i+=p}return de(e).x+i},"x"),y:v(function(e,r,n){let i=0;const s=de(n[0]).y<de(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(qe,t.arrowTypeStart)){const{angle:p,deltaY:m}=yo(n[0],n[1]);i=qe[t.arrowTypeStart]*Math.abs(Math.sin(p))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(qe,t.arrowTypeEnd)){const{angle:p,deltaY:m}=yo(n[n.length-1],n[n.length-2]);i=qe[t.arrowTypeEnd]*Math.abs(Math.sin(p))*(m>=0?1:-1)}const o=Math.abs(de(e).y-de(n[n.length-1]).y),a=Math.abs(de(e).x-de(n[n.length-1]).x),l=Math.abs(de(e).y-de(n[0]).y),h=Math.abs(de(e).x-de(n[0]).x),u=qe[t.arrowTypeStart],d=qe[t.arrowTypeEnd],f=1;if(o<d&&o>0&&a<d){let p=d+f-o;p*=s==="up"?-1:1,i-=p}if(l<u&&l>0&&h<u){let p=u+f-l;p*=s==="up"?-1:1,i+=p}return de(e).y+i},"y")}),"getLineFunctionsWithOffset"),Ba={},Ee={},ug;function NP(){return ug||(ug=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.BLANK_URL=Ee.relativeFirstCharacters=Ee.whitespaceEscapeCharsRegex=Ee.urlSchemeRegex=Ee.ctrlCharactersRegex=Ee.htmlCtrlEntityRegex=Ee.htmlEntitiesRegex=Ee.invalidProtocolRegex=void 0,Ee.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,Ee.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,Ee.htmlCtrlEntityRegex=/&(newline|tab);/gi,Ee.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Ee.urlSchemeRegex=/^.+(:|&colon;)/gim,Ee.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Ee.relativeFirstCharacters=[".","/"],Ee.BLANK_URL="about:blank"),Ee}var dg;function EP(){if(dg)return Ba;dg=1,Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.sanitizeUrl=s;var t=NP();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(l,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,l=i(o.trim());do l=r(l).replace(t.htmlCtrlEntityRegex,"").replace(t.ctrlCharactersRegex,"").replace(t.whitespaceEscapeCharsRegex,"").trim(),l=i(l),a=l.match(t.ctrlCharactersRegex)||l.match(t.htmlEntitiesRegex)||l.match(t.htmlCtrlEntityRegex)||l.match(t.whitespaceEscapeCharsRegex);while(a&&a.length>0);var h=l;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 Ba}var BP=EP();function wh(t){var r;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const n=t[Symbol.toStringTag];return n==null||!((r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&r.writable)?!1:t.toString()===`[object ${n}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function LP(){}function HC(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Ep(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const AP="[object RegExp]",UC="[object String]",YC="[object Number]",GC="[object Boolean]",VC="[object Arguments]",MP="[object Symbol]",IP="[object Date]",FP="[object Map]",DP="[object Set]",PP="[object Array]",OP="[object ArrayBuffer]",$P="[object Object]",RP="[object DataView]",zP="[object Uint8Array]",WP="[object Uint8ClampedArray]",qP="[object Uint16Array]",HP="[object Uint32Array]",UP="[object Int8Array]",YP="[object Int16Array]",GP="[object Int32Array]",VP="[object Float32Array]",XP="[object Float64Array]",pg=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();function Bp(t){return typeof pg.Buffer<"u"&&pg.Buffer.isBuffer(t)}function KP(t){return Number.isSafeInteger(t)&&t>=0}function XC(t){return t!=null&&typeof t!="function"&&KP(t.length)}function QP(t){return t==="__proto__"}function Lp(t){return t==null||typeof t!="object"&&typeof t!="function"}function Ap(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ZP(t,e){return Vi(t,void 0,t,new Map,e)}function Vi(t,e,r,n=new Map,i=void 0){const s=i==null?void 0:i(t,e,r,n);if(s!==void 0)return s;if(Lp(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){const o=new Array(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Vi(t[a],a,r,n,i);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;n.set(t,o);for(const[a,l]of t)o.set(a,Vi(l,a,r,n,i));return o}if(t instanceof Set){const o=new Set;n.set(t,o);for(const a of t)o.add(Vi(a,void 0,r,n,i));return o}if(Bp(t))return t.subarray();if(Ap(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Vi(t[a],a,r,n,i);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return n.set(t,o),Mr(o,t,r,n,i),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return n.set(t,o),Mr(o,t,r,n,i),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return n.set(t,o),Mr(o,t,r,n,i),o}if(t instanceof Error){const o=structuredClone(t);return n.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,o.constructor=t.constructor,Mr(o,t,r,n,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return n.set(t,o),Mr(o,t,r,n,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return n.set(t,o),Mr(o,t,r,n,i),o}if(t instanceof String){const o=new String(t.valueOf());return n.set(t,o),Mr(o,t,r,n,i),o}if(typeof t=="object"&&JP(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),Mr(o,t,r,n,i),o}return t}function Mr(t,e,r=t,n,i){const s=[...Object.keys(e),...HC(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=Vi(e[a],a,r,n,i))}}function JP(t){switch(Ep(t)){case VC:case PP:case OP:case RP:case GC:case IP:case VP:case XP:case UP:case YP:case GP:case FP:case YC:case $P:case AP:case DP:case UC:case MP:case zP:case WP:case qP:case HP:return!0;default:return!1}}function tO(t,e){return ZP(t,(r,n,i,s)=>{if(typeof t=="object"){if(Ep(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Mr(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case YC:case UC:case GC:{const o=new t.constructor(t==null?void 0:t.valueOf());return Mr(o,t),o}case VC:{const o={};return Mr(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function fg(t){return tO(t)}function zu(t){return t!==null&&typeof t=="object"&&Ep(t)==="[object Arguments]"}function Wu(t){return typeof t=="object"&&t!==null}function eO(t){return Wu(t)&&XC(t)}function aa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");const r=function(...n){const i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);const o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(aa.Cache||Map),r}aa.Cache=Map;function nl(t){return Ap(t)}function rO(t){const e=t==null?void 0:t.constructor;return t===(typeof e=="function"?e.prototype:Object.prototype)}function nO(t){if(Lp(t))return t;if(Array.isArray(t)||Ap(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t);if(e==null)return Object.assign(Object.create(e),t);const r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const n=new r(t);return n.lastIndex=t.lastIndex,n}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){let n;return t instanceof AggregateError?n=new r(t.errors,t.message,{cause:t.cause}):n=new r(t.message,{cause:t.cause}),n.stack=t.stack,Object.assign(n,t),n}return typeof File<"u"&&t instanceof File?new r([t],t.name,{type:t.type,lastModified:t.lastModified}):typeof t=="object"?Object.assign(Object.create(e),t):t}function iO(t,...e){const r=e.slice(0,-1),n=e[e.length-1];let i=t;for(let s=0;s<r.length;s++){const o=r[s];i=il(i,o,n,new Map)}return i}function il(t,e,r,n){if(Lp(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return nO(n.get(e));if(n.set(e,t),Array.isArray(e)){e=e.slice();for(let s=0;s<e.length;s++)e[s]=e[s]??void 0}const i=[...Object.keys(e),...HC(e)];for(let s=0;s<i.length;s++){const o=i[s];if(QP(o))continue;let a=e[o],l=t[o];if(zu(a)&&(a={...a}),zu(l)&&(l={...l}),Bp(a)&&(a=fg(a)),Array.isArray(a))if(Array.isArray(l)){const u=[],d=Reflect.ownKeys(l);for(let f=0;f<d.length;f++){const p=d[f];u[p]=l[p]}l=u}else if(eO(l)){const u=[];for(let d=0;d<l.length;d++)u[d]=l[d];l=u}else l=[];const h=r(l,a,o,t,e,n);h!==void 0?t[o]=h:Array.isArray(a)||Wu(l)&&Wu(a)&&(wh(l)||wh(a)||nl(l)||nl(a))?t[o]=il(l,a,r,n):l==null&&wh(a)?t[o]=il({},a,r,n):l==null&&nl(a)?t[o]=fg(a):(l===void 0||a!==void 0)&&(t[o]=a)}return t}function sO(t,...e){return iO(t,...e,LP)}function mg(t){if(t==null)return!0;if(XC(t))return typeof t.splice!="function"&&typeof t!="string"&&!Bp(t)&&!nl(t)&&!zu(t)?!1:t.length===0;if(typeof t=="object"){if(t instanceof Map||t instanceof Set)return t.size===0;const e=Object.keys(t);return rO(t)?e.filter(r=>r!=="constructor").length===0:e.length===0}return!0}var oO="​",aO={curveBasis:Tu,curveBasisClosed:uD,curveBasisOpen:dD,curveBumpX:qb,curveBumpY:Hb,curveBundle:pD,curveCardinalClosed:fD,curveCardinalOpen:mD,curveCardinal:Vb,curveCatmullRomClosed:gD,curveCatmullRomOpen:xD,curveCatmullRom:Kb,curveLinear:Eo,curveLinearClosed:yD,curveMonotoneX:r1,curveMonotoneY:n1,curveNatural:s1,curveStep:o1,curveStepAfter:l1,curveStepBefore:a1},lO=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,cO=v(function(t,e){const r=KC(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);vl(o),n=Be(n,[...o])}else n=r.args;if(!n)return;let i=np(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),KC=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${lO.source})(?=[}][%]{2}).*
465
- `,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),it.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=jo.exec(t))!==null;)if(s.index===jo.lastIndex&&jo.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],l=s[3]?s[3].trim():s[4]?JSON.parse(s[4].trim()):null;o.push({type:a,args:l})}return o.length===0?{type:t,args:null}:o.length===1?o[0]:o}catch(i){return it.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),hO=v(function(t){return t.replace(jo,"")},"removeDirectives"),uO=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function Mp(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return aO[r]??e}v(Mp,"interpolateToCurve");function QC(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?BP.sanitizeUrl(r):r}v(QC,"formatUrl");var dO=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){it.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function Ip(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(Ip,"distance");function ZC(t){let e,r=0;t.forEach(i=>{r+=Ip(i,e),e=i});const n=r/2;return Fp(t,n)}v(ZC,"traverseEdge");function JC(t){return t.length===1?t[0]:ZC(t)}v(JC,"calcLabelPosition");var gg=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),Fp=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=Ip(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:gg((1-o)*r.x+o*i.x,5),y:gg((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),pO=v((t,e,r)=>{it.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=Fp(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 tk(t,e,r){const n=structuredClone(r);it.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=Fp(n,i),o=10+t*.5,a=Math.atan2(n[0].y-s.y,n[0].x-s.x),l={x:0,y:0};return e==="start_left"?(l.x=Math.sin(a+Math.PI)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a+Math.PI)*o+(n[0].y+s.y)/2):e==="end_right"?(l.x=Math.sin(a-Math.PI)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a-Math.PI)*o+(n[0].y+s.y)/2-5):e==="end_left"?(l.x=Math.sin(a)*o+(n[0].x+s.x)/2-5,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2-5):(l.x=Math.sin(a)*o+(n[0].x+s.x)/2,l.y=-Math.cos(a)*o+(n[0].y+s.y)/2),l}v(tk,"calcTerminalLabelPosition");function ek(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(ek,"getStylesFromArray");var xg=0,fO=v(()=>(xg++,"id-"+Math.random().toString(36).substr(2,12)+"-"+xg),"generateId");function rk(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(rk,"makeRandomHex");var mO=v(t=>rk(t.length),"random"),gO=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"),xO=v(function(t,e){const r=e.text.replace(na.lineBreakRegex," "),[,n]=Sc(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"),yO=aa((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),na.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const l=xn(`${o} `,r),h=xn(s,r);if(l>e){const{hyphenatedStrings:f,remainingWord:p}=bO(o,e,"-",r);i.push(s,...f),s=p}else h+l>=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}`),bO=aa((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,l)=>{const h=`${o}${a}`;if(xn(h,n)>=e){const d=l+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 nk(t,e){return Dp(t,e).height}v(nk,"calculateTextHeight");function xn(t,e){return Dp(t,e).width}v(xn,"calculateTextWidth");var Dp=aa((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=Sc(r),o=["sans-serif",n],a=t.split(na.lineBreakRegex),l=[],h=Wt("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=gO();g.text=x||oO;const y=xO(u,g).style("font-size",s).style("font-weight",i).style("font-family",f),C=(y._groups||y)[0][0].getBBox();if(C.width===0&&C.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,C.width)),p=Math.round(C.height),m.height+=p,m.lineHeight=Math.round(Math.max(m.lineHeight,p))}l.push(m)}u.remove();const d=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[d]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),ms,CO=(ms=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},v(ms,"InitIDGenerator"),ms),La,kO=v(function(t){return La=La||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),La.innerHTML=t,unescape(La.textContent)},"entityDecode");function Pp(t){return"str"in t}v(Pp,"isDetailedError");var vO=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"),Sc=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 Op(t,e){return sO({},t,e)}v(Op,"cleanAndMerge");var Pr={assignWithDepth:Be,wrapLabel:yO,calculateTextHeight:nk,calculateTextWidth:xn,calculateTextDimensions:Dp,cleanAndMerge:Op,detectInit:cO,detectDirective:KC,isSubstringInArray:uO,interpolateToCurve:Mp,calcLabelPosition:JC,calcCardinalityPosition:pO,calcTerminalLabelPosition:tk,formatUrl:QC,getStylesFromArray:ek,generateId:fO,random:mO,runFunc:dO,entityDecode:kO,insertTitle:vO,isLabelCoordinateInPath:ik,parseFontSize:Sc,InitIDGenerator:CO},wO=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"),Ci=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),MY=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function Fe(t){return t??null}v(Fe,"handleUndefinedAttr");function ik(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(ik,"isLabelCoordinateInPath");var $p=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 sk(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=Kt().fontSize?Kt().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[h=eb.fontSize]=Sc(a),u=h*l+"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(sk,"configureLabelImages");var SO=v(t=>{const{handDrawnSeed:e}=Kt();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Ms=v(t=>{const e=TO([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),TO=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"),ok=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"),bt=v(t=>{const{stylesArray:e}=Ms(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];ok(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"),xt=v((t,e)=>{var l;const{themeVariables:r,handDrawnSeed:n}=Kt(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Ms(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:((l=o.get("stroke-width"))==null?void 0:l.replace("px",""))||1.3,fillLineDash:[0,0],strokeLineDash:_O(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),_O=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 jO=Object.freeze({left:0,top:0,width:16,height:16}),Wl=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),ak=Object.freeze({...jO,...Wl}),NO=Object.freeze({...ak,body:"",hidden:!1}),EO=Object.freeze({width:null,height:null}),BO=Object.freeze({...EO,...Wl}),LO=(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(),l=i.pop(),h={provider:i.length>0?i[0]:n,prefix:l,name:a};return Sh(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 Sh(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return Sh(a,r)?a:null}return null},Sh=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function AO(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 yg(t,e){const r=AO(t,e);for(const n in NO)n in Wl?n in t&&!(n in r)&&(r[n]=Wl[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function MO(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,l=a&&s(a);l&&(i[o]=[a].concat(l))}return i[o]}return(e||Object.keys(r).concat(Object.keys(n))).forEach(s),i}function bg(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=yg(n[a]||i[a],s)}return o(e),r.forEach(o),yg(t,s)}function IO(t,e){if(t.icons[e])return bg(t,e,[]);const r=MO(t,[e])[e];return r?bg(t,e,r):null}const FO=/(-?[0-9.]*[0-9]+[0-9.]*)/g,DO=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Cg(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(FO);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=DO.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 PO(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 OO(t,e){return t?"<defs>"+t+"</defs>"+e:e}function $O(t,e,r){const n=PO(t);return OO(n.defs,e+n.content+r)}const RO=t=>t==="unset"||t==="undefined"||t==="none";function zO(t,e){const r={...ak,...t},n={...BO,...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,C=x.vFlip;let b=x.rotate;y?C?b+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):C&&(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=$O(s,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=n.width,a=n.height,l=i.width,h=i.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?h:a,u=Cg(d,l/h)):(u=o==="auto"?l:o,d=a===null?Cg(u,h/l):a==="auto"?h:a);const f={},p=(x,g)=>{RO(g)||(f[x]=g.toString())};p("width",u),p("height",d);const m=[i.left,i.top,l,h];return f.viewBox=m.join(" "),{attributes:f,viewBox:m,body:s}}const WO=/\sid="(\S+)"/g,kg=new Map;function qO(t){t=t.replace(/[0-9]+$/,"")||"a";const e=kg.get(t)||0;return kg.set(t,e+1),e?`${t}${e}`:t}function HO(t){const e=[];let r;for(;r=WO.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=qO(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 UO(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 Rp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ti=Rp();function lk(t){Ti=t}var Bo={exec:()=>null};function Qt(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(er.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var YO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),er={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")},GO=/^(?:[ \t]*(?:\n|$))+/,VO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,XO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,la=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,KO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,zp=/(?:[*+-]|\d{1,9}[.)])/,ck=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hk=Qt(ck).replace(/bull/g,zp).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(),QO=Qt(ck).replace(/bull/g,zp).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(),Wp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ZO=/^[^\n]+/,qp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,JO=Qt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",qp).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),t$=Qt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,zp).getRegex(),Tc="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",Hp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,e$=Qt("^ {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",Hp).replace("tag",Tc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),uk=Qt(Wp).replace("hr",la).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",Tc).getRegex(),r$=Qt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",uk).getRegex(),Up={blockquote:r$,code:VO,def:JO,fences:XO,heading:KO,hr:la,html:e$,lheading:hk,list:t$,newline:GO,paragraph:uk,table:Bo,text:ZO},vg=Qt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",la).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",Tc).getRegex(),n$={...Up,lheading:QO,table:vg,paragraph:Qt(Wp).replace("hr",la).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vg).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",Tc).getRegex()},i$={...Up,html:Qt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Hp).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:Bo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Qt(Wp).replace("hr",la).replace("heading",` *#{1,6} *[^
466
- ]`).replace("lheading",hk).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},s$=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,o$=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dk=/^( {2,}|\\)\n(?!\s*$)/,a$=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_c=/[\p{P}\p{S}]/u,Yp=/[\s\p{P}\p{S}]/u,pk=/[^\s\p{P}\p{S}]/u,l$=Qt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Yp).getRegex(),fk=/(?!~)[\p{P}\p{S}]/u,c$=/(?!~)[\s\p{P}\p{S}]/u,h$=/(?:[^\s\p{P}\p{S}]|~)/u,u$=Qt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",YO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),mk=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,d$=Qt(mk,"u").replace(/punct/g,_c).getRegex(),p$=Qt(mk,"u").replace(/punct/g,fk).getRegex(),gk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",f$=Qt(gk,"gu").replace(/notPunctSpace/g,pk).replace(/punctSpace/g,Yp).replace(/punct/g,_c).getRegex(),m$=Qt(gk,"gu").replace(/notPunctSpace/g,h$).replace(/punctSpace/g,c$).replace(/punct/g,fk).getRegex(),g$=Qt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,pk).replace(/punctSpace/g,Yp).replace(/punct/g,_c).getRegex(),x$=Qt(/\\(punct)/,"gu").replace(/punct/g,_c).getRegex(),y$=Qt(/^<(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(),b$=Qt(Hp).replace("(?:-->|$)","-->").getRegex(),C$=Qt("^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",b$).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ql=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,k$=Qt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ql).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xk=Qt(/^!?\[(label)\]\[(ref)\]/).replace("label",ql).replace("ref",qp).getRegex(),yk=Qt(/^!?\[(ref)\](?:\[\])?/).replace("ref",qp).getRegex(),v$=Qt("reflink|nolink(?!\\()","g").replace("reflink",xk).replace("nolink",yk).getRegex(),wg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gp={_backpedal:Bo,anyPunctuation:x$,autolink:y$,blockSkip:u$,br:dk,code:o$,del:Bo,emStrongLDelim:d$,emStrongRDelimAst:f$,emStrongRDelimUnd:g$,escape:s$,link:k$,nolink:yk,punctuation:l$,reflink:xk,reflinkSearch:v$,tag:C$,text:a$,url:Bo},w$={...Gp,link:Qt(/^!?\[(label)\]\((.*?)\)/).replace("label",ql).getRegex(),reflink:Qt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ql).getRegex()},qu={...Gp,emStrongRDelimAst:m$,emStrongLDelim:p$,url:Qt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",wg).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:Qt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",wg).getRegex()},S$={...qu,br:Qt(dk).replace("{2,}","*").getRegex(),text:Qt(qu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Aa={normal:Up,gfm:n$,pedantic:i$},eo={normal:Gp,gfm:qu,breaks:S$,pedantic:w$},T$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Sg=t=>T$[t];function Gr(t,e){if(e){if(er.escapeTest.test(t))return t.replace(er.escapeReplace,Sg)}else if(er.escapeTestNoEncode.test(t))return t.replace(er.escapeReplaceNoEncode,Sg);return t}function Tg(t){try{t=encodeURI(t).replace(er.percentDecode,"%")}catch{return null}return t}function _g(t,e){var s;let r=t.replace(er.findPipe,(o,a,l)=>{let h=!1,u=a;for(;--u>=0&&l[u]==="\\";)h=!h;return h?"|":" |"}),n=r.split(er.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(er.slashPipe,"|");return n}function ro(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 _$(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 jg(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 l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:s,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function j$(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
467
- `).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(`
468
- `)}var Hl=class{constructor(e){Jt(this,"options");Jt(this,"rules");Jt(this,"lexer");this.options=e||Ti}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:ro(n,`
469
- `)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=j$(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=ro(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:ro(r[0],`
470
- `)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=ro(r[0],`
471
- `).split(`
472
- `),i="",s="",o=[];for(;n.length>0;){let a=!1,l=[],h;for(h=0;h<n.length;h++)if(this.rules.other.blockquoteStart.test(n[h]))l.push(n[h]),a=!0;else if(!a)l.push(n[h]);else break;n=n.slice(h);let u=l.join(`
473
- `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
474
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
475
- ${u}`:u,s=s?`${s}
476
- ${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+`
477
- `+n.join(`
478
- `),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+`
479
- `+n.join(`
480
- `),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(`
481
- `);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(`
482
- `,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),p=e.split(`
483
- `,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+`
484
- `,e=e.substring(p.length+1),h=!0),!h){let C=this.rules.other.nextBulletRegex(x),b=this.rules.other.hrRegex(x),w=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),S=this.rules.other.htmlBeginRegex(x);for(;e;){let N=e.split(`
485
- `,1)[0],A;if(p=N,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),A=p):A=p.replace(this.rules.other.tabCharGlobal," "),w.test(p)||_.test(p)||S.test(p)||C.test(p)||b.test(p))break;if(A.search(this.rules.other.nonSpaceChar)>=x||!p.trim())d+=`
486
- `+A.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+=`
487
- `+p}!m&&!p.trim()&&(m=!0),u+=N+`
488
- `,e=e.substring(N.length+1),f=A.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 l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.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=_g(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(`
489
- `):[],o={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let l of i)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<n.length;l++)o.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:o.align[l]});for(let l of s)o.rows.push(_g(l,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)===`
490
- `?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=ro(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=_$(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)),jg(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 jg(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,l=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]){l+=a;continue}else if((i[5]||i[6])&&s%3&&!((s+a)%3)){h+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+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}}}},Ir=class Hu{constructor(e){Jt(this,"tokens");Jt(this,"options");Jt(this,"state");Jt(this,"tokenizer");Jt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ti,this.options.tokenizer=this.options.tokenizer||new Hl,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:er,block:Aa.normal,inline:eo.normal};this.options.pedantic?(r.block=Aa.pedantic,r.inline=eo.pedantic):this.options.gfm&&(r.block=Aa.gfm,this.options.breaks?r.inline=eo.breaks:r.inline=eo.gfm),this.tokenizer.rules=r}static get rules(){return{block:Aa,inline:eo}}static lex(e,r){return new Hu(r).lex(e)}static lexInline(e,r){return new Hu(r).inlineTokens(e)}lex(e){e=e.replace(er.carriageReturn,`
491
- `),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(er.tabCharGlobal," ").replace(er.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+=`
492
- `: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(`
493
- `)?"":`
494
- `)+a.raw,h.text+=`
495
- `+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(`
496
- `)?"":`
497
- `)+a.raw,h.text+=`
498
- `+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 l=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&&(l=e.substring(0,h+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let h=r.at(-1);n&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
499
- `)?"":`
500
- `)+a.raw,h.text+=`
501
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):r.push(a),n=l.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(`
502
- `)?"":`
503
- `)+a.raw,h.text+=`
504
- `+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 l,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=(l=this.options.hooks)==null?void 0:l.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(C=>{y=C.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}},Ul=class{constructor(e){Jt(this,"options");Jt(this,"parser");this.options=e||Ti}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(er.notSpaceStart))==null?void 0:o[0],s=e.replace(er.endingNewline,"")+`
505
- `;return i?'<pre><code class="language-'+Gr(i)+'">'+(n?s:Gr(s,!0))+`</code></pre>
506
- `:"<pre><code>"+(n?s:Gr(s,!0))+`</code></pre>
507
- `}blockquote({tokens:e}){return`<blockquote>
508
- ${this.parser.parse(e)}</blockquote>
509
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
510
- `}hr(e){return`<hr>
511
- `}list(e){let r=e.ordered,n=e.start,i="";for(let a=0;a<e.items.length;a++){let l=e.items[a];i+=this.listitem(l)}let s=r?"ol":"ul",o=r&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
512
- `+i+"</"+s+`>
513
- `}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+" "+Gr(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>
514
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
515
- `}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>
516
- <thead>
517
- `+r+`</thead>
518
- `+i+`</table>
519
- `}tablerow({text:e}){return`<tr>
520
- ${e}</tr>
521
- `}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
522
- `}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>${Gr(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=Tg(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+Gr(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=Tg(e);if(s===null)return Gr(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${Gr(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Gr(e.text)}},Vp=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""}},Fr=class Uu{constructor(e){Jt(this,"options");Jt(this,"renderer");Jt(this,"textRenderer");this.options=e||Ti,this.options.renderer=this.options.renderer||new Ul,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Vp}static parse(e,r){return new Uu(r).parse(e)}static parseInline(e,r){return new Uu(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 l=a;switch(l.type){case"space":{n+=this.renderer.space(l);continue}case"hr":{n+=this.renderer.hr(l);continue}case"heading":{n+=this.renderer.heading(l);continue}case"code":{n+=this.renderer.code(l);continue}case"table":{n+=this.renderer.table(l);continue}case"blockquote":{n+=this.renderer.blockquote(l);continue}case"list":{n+=this.renderer.list(l);continue}case"html":{n+=this.renderer.html(l);continue}case"def":{n+=this.renderer.def(l);continue}case"paragraph":{n+=this.renderer.paragraph(l);continue}case"text":{let h=l,u=this.renderer.text(h);for(;o+1<e.length&&e[o+1].type==="text";)h=e[++o],u+=`
523
- `+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 "'+l.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 l=a;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=r.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},Ga,bo=(Ga=class{constructor(e){Jt(this,"options");Jt(this,"block");this.options=e||Ti}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Ir.lex:Ir.lexInline}provideParser(){return this.block?Fr.parse:Fr.parseInline}},Jt(Ga,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Jt(Ga,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ga),N$=class{constructor(...e){Jt(this,"defaults",Rp());Jt(this,"options",this.setOptions);Jt(this,"parse",this.parseMarkdown(!0));Jt(this,"parseInline",this.parseMarkdown(!1));Jt(this,"Parser",Fr);Jt(this,"Renderer",Ul);Jt(this,"TextRenderer",Vp);Jt(this,"Lexer",Ir);Jt(this,"Tokenizer",Hl);Jt(this,"Hooks",bo);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 l of a.header)n=n.concat(this.walkTokens(l.tokens,r));for(let l of a.rows)for(let h of l)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(l=>{let h=a[l].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 l=s.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}: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 Ul(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,l=n.renderer[a],h=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=h.apply(s,u)),d||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Hl(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,l=n.tokenizer[a],h=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=h.apply(s,u)),d}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new bo;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,l=n.hooks[a],h=s[a];bo.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&bo.passThroughHooksRespectAsync.has(o))return(async()=>{let f=await l.call(s,u);return h.call(s,f)})();let d=l.call(s,u);return h.call(s,d)}:s[a]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await l.apply(s,u);return f===!1&&(f=await h.apply(s,u)),f})();let d=l.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 l=[];return l.push(o.call(this,a)),s&&(l=l.concat(s.call(this,a))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,r){return Ir.lex(e,r??this.defaults)}parser(e,r){return Fr.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,l=await(s.hooks?await s.hooks.provideLexer():e?Ir.lex:Ir.lexInline)(a,s),h=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(h,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?Fr.parse:Fr.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?Ir.lex:Ir.lexInline)(r,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():e?Fr.parse:Fr.parseInline)(a,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,r){return n=>{if(n.message+=`
524
- Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Gr(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},ki=new N$;function te(t,e){return ki.parse(t,e)}te.options=te.setOptions=function(t){return ki.setOptions(t),te.defaults=ki.defaults,lk(te.defaults),te};te.getDefaults=Rp;te.defaults=Ti;te.use=function(...t){return ki.use(...t),te.defaults=ki.defaults,lk(te.defaults),te};te.walkTokens=function(t,e){return ki.walkTokens(t,e)};te.parseInline=ki.parseInline;te.Parser=Fr;te.parser=Fr.parse;te.Renderer=Ul;te.TextRenderer=Vp;te.Lexer=Ir;te.lexer=Ir.lex;te.Tokenizer=Hl;te.Hooks=bo;te.parse=te;te.options;te.setOptions;te.use;te.walkTokens;te.parseInline;Fr.parse;Ir.lex;function bk(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,l){var h=l.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(`
525
- [ ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(a){return a.replace(s,`
526
- `)})}n[0]=n[0].replace(/^\r?\n/,"");var o=n[0];return e.forEach(function(a,l){var h=o.match(/(?:^|\n)( *)$/),u=h?h[1]:"",d=a;typeof a=="string"&&a.includes(`
527
- `)&&(d=String(a).split(`
528
- `).map(function(f,p){return p===0?f:""+u+f}).join(`
529
- `)),o+=d+n[l+1]}),o}var E$={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},Yu=new Map,Ck=new Map,B$=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(it.debug("Registering icon pack:",e.name),"loader"in e)Ck.set(e.name,e.loader);else if("icons"in e)Yu.set(e.name,e.icons);else throw it.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),kk=v(async(t,e)=>{const r=LO(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=Yu.get(n);if(!i){const o=Ck.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},Yu.set(n,i)}catch(a){throw it.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=IO(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),L$=v(async t=>{try{return await kk(t),!0}catch{return!1}},"isIconAvailable"),ca=v(async(t,e,r)=>{let n;try{n=await kk(t,e==null?void 0:e.fallbackPrefix)}catch(o){it.error(o),n=E$}const i=zO(n,e),s=UO(HO(i.body),{...i.attributes,...r});return zr(s,me())},"getIconSVG");function vk(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
530
- `).replace(/\n{2,}/g,`
531
- `);return bk(n)}v(vk,"preprocessMarkdown");function wk(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(wk,"nonMarkdownToLines");function Sk(t,e={}){const r=vk(t,e),n=te.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
532
- `).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(f=>{f=f.replace(/&#39;/g,"'"),f&&i[s].push({content:f,type:l})})}):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 l;a.type==="paragraph"?(l=a.tokens)==null||l.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(Sk,"markdownToLines");function Tk(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(Tk,"nonMarkdownToHTML");function _k(t,{markdownAutoWrap:e}={}){const r=te.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:(it.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(_k,"markdownToHTML");function jk(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(jk,"splitTextToChars");function Nk(t,e){const r=jk(e.content);return Xp(t,[],r,e.type)}v(Nk,"splitWordToFitWidth");function Xp(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}])?Xp(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v(Xp,"splitWordToFitWidthRecursion");function Ek(t,e){if(t.some(({content:r})=>r.includes(`
533
- `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return Yl(t,e)}v(Ek,"splitLineToFitWidth");function Yl(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 Yl(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=Nk(e,s);r.push([a]),l.content&&t.unshift(l)}return Yl(t,e,r)}v(Yl,"splitLineToFitWidthRecursion");function Gu(t,e){e&&t.attr("style",e)}v(Gu,"applyStyle");var Ng=16384;async function Bk(t,e,r,n,i=!1,s=me()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,Ng)}px`),o.attr("height",`${Math.min(10*r,Ng)}px`);const a=o.append("xhtml:div"),l=Po(e.label)?await ub(e.label.replace(na.lineBreakRegex,`
534
- `),s):zr(e.label,s),h=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),Gu(u,e.labelStyle),u.attr("class",`${h} ${n}`),Gu(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(Bk,"addHtmlSpan");function jc(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(jc,"createTspan");function Lk(t,e,r){const n=t.append("text"),i=jc(n,1,e);Nc(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(Lk,"computeWidthOfText");function A$(t,e,r){var o;const n=t.append("text"),i=jc(n,1,e);Nc(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(A$,"computeDimensionOfText");function Ak(t,e,r,n=!1,i=!1){const o=e.append("g"),a=o.insert("rect").attr("class","background").attr("style","stroke: none"),l=o.append("text").attr("y","-10.1");i&&l.attr("text-anchor","middle");let h=0;for(const u of r){const d=v(p=>Lk(o,1.1,p)<=t,"checkWidth"),f=d(u)?[u]:Ek(u,d);for(const p of f){const m=jc(l,h,1.1,i);Nc(m,p),h++}}if(n){const u=l.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 l.node()}v(Ak,"createFormattedText");function Vu(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(Vu,"decodeHTMLEntities");function Nc(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(Vu(r.content)):i.text(" "+Vu(r.content))})}v(Nc,"updateTextContentAndStyles");async function Mk(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await L$(a)?await ca(a,void 0,{class:"label-icon"}):`<i class='${zr(i,e).replace(":"," ")}'></i>`})()),i));const n=await Promise.all(r);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}v(Mk,"replaceIconSubstring");var vn=v(async(t,e="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:s=!0,markdown:o=!0,isNode:a=!0,width:l=200,addSvgBackground:h=!1}={},u)=>{if(it.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",h),s){const d=o?_k(e,u):Tk(e),f=await Mk(Ci(d),u),p=e.replace(/\\\\/g,"\\"),m={isNode:a,label:Po(e)?p:f,labelStyle:r.replace("fill:","color:")};return await Bk(t,m,l,i,h,u)}else{const d=Ci(e.replace(/<br\s*\/?>/g,"<br/>")),f=o?Sk(d.replace("<br>","<br/>"),u):wk(d),p=Ak(l,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:");Wt(p).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Wt(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:");Wt(p).select("text").attr("style",x)}return n?Wt(p).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Wt(p).selectAll("tspan.text-outer-tspan").classed("row",!0),p}},"createText");function Th(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 l of t){const[h,u]=l;l[0]=(h-n)*o-(u-i)*a+n,l[1]=(h-n)*a+(u-i)*o+i}}}function M$(t,e){return t[0]===e[0]&&t[1]===e[1]}function I$(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)Th(h,a,i);const l=(function(h,u,d){const f=[];for(const C of h){const b=[...C];M$(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 C of f)for(let b=0;b<C.length-1;b++){const w=C[b],_=C[b+1];if(w[1]!==_[1]){const S=Math.min(w[1],_[1]);m.push({ymin:S,ymax:Math.max(w[1],_[1]),x:S===w[1]?w[0]:_[0],islope:(_[0]-w[0])/(_[1]-w[1])})}}if(m.sort(((C,b)=>C.ymin<b.ymin?-1:C.ymin>b.ymin?1:C.x<b.x?-1:C.x>b.x?1:C.ymax===b.ymax?0:(C.ymax-b.ymax)/Math.abs(C.ymax-b.ymax))),!m.length)return p;let x=[],g=m[0].ymin,y=0;for(;x.length||m.length;){if(m.length){let C=-1;for(let b=0;b<m.length&&!(m[b].ymin>g);b++)C=b;m.splice(0,C+1).forEach((b=>{x.push({s:g,edge:b})}))}if(x=x.filter((C=>!(C.edge.ymax<=g))),x.sort(((C,b)=>C.edge.x===b.edge.x?0:(C.edge.x-b.edge.x)/Math.abs(C.edge.x-b.edge.x))),(d!==1||y%u==0)&&x.length>1)for(let C=0;C<x.length;C+=2){const b=C+1;if(b>=x.length)break;const w=x[C].edge,_=x[b].edge;p.push([[Math.round(w.x),g],[Math.round(_.x),g]])}g+=d,x.forEach((C=>{C.edge.x=C.edge.x+d*C.edge.islope})),y++}return p})(o,s,n);if(i){for(const h of o)Th(h,a,-i);(function(h,u,d){const f=[];h.forEach((p=>f.push(...p))),Th(f,u,d)})(l,a,-i)}return l}function ha(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),I$(t,i,n,s||1)}class Kp{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=ha(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 Ec(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 F$ extends Kp{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=ha(e,Object.assign({},r,{hachureGap:n})),s=Math.PI/180*r.hachureAngle,o=[],a=.5*n*Math.cos(s),l=.5*n*Math.sin(s);for(const[h,u]of i)Ec([h,u])&&o.push([[h[0]-a,h[1]+l],[...u]],[[h[0]+a,h[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(o,r)}}}class D$ extends Kp{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 P${constructor(e){this.helper=e}fillPolygons(e,r){const n=ha(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 l=Ec(a),h=l/i,u=Math.ceil(h)-1,d=l-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,C=this.helper.ellipse(g,y,s,s,r);n.push(...C.ops)}}return{type:"fillSketch",ops:n}}}class O${constructor(e){this.helper=e}fillPolygons(e,r){const n=ha(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=Ec(o),l=Math.floor(a/(n+i)),h=(a+i-l*(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<l;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 $${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=ha(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=Ec(s),a=Math.round(o/(2*r));let l=s[0],h=s[1];l[0]>h[0]&&(l=s[1],h=s[0]);const u=Math.atan((h[1]-l[1])/(h[0]-l[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=[l[0]+f*Math.cos(u),l[1]+f*Math.sin(u)],g=[l[0]+p*Math.cos(u),l[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 cr={};class R${constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const z$=0,_h=1,Eg=2,Ma={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 jh(t,e){return t.type===e}function Qp(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:z$,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:_h,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:Eg,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!jh(s,Eg);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return Qp("M0,0"+t);i++,o=Ma[s.text],n=s.text}else jh(s,_h)?o=Ma[n]:(i++,o=Ma[s.text],n=s.text);if(!(i+o<r.length))throw new Error("Path data ended short");for(let l=i;l<i+o;l++){const h=r[l];if(!jh(h,_h))throw new Error("Param not a number: "+n+","+h.text);a[a.length]=+h.text}if(typeof Ma[n]!="number")throw new Error("Bad segment: "+n);{const l={key:n,data:a};e.push(l),i+=o,s=r[i],n==="M"&&(n="L"),n==="m"&&(n="l")}}return e}function Ik(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 l=a.map(((h,u)=>u%2?h+r:h+e));s.push({key:"C",data:l}),e=l[4],r=l[5];break}case"Q":s.push({key:"Q",data:[...a]}),e=a[2],r=a[3];break;case"q":{const l=a.map(((h,u)=>u%2?h+r:h+e));s.push({key:"Q",data:l}),e=l[2],r=l[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 l=a.map(((h,u)=>u%2?h+r:h+e));s.push({key:"S",data:l}),e=l[2],r=l[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 Fk(t){const e=[];let r="",n=0,i=0,s=0,o=0,a=0,l=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],l=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-l)):(d=n,f=i),e.push({key:"C",data:[d,f,...u]}),a=u[0],l=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-l)):(p=n,m=i);const x=n+2*(p-n)/3,g=i+2*(m-i)/3,y=d+2*(p-d)/3,C=f+2*(m-f)/3;e.push({key:"C",data:[x,g,y,C,d,f]}),a=p,l=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,C=m+2*(f-m)/3;e.push({key:"C",data:[x,g,y,C,p,m]}),a=d,l=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)&&(Dk(n,i,g,y,d,f,p,m,x).forEach((function(C){e.push({key:"C",data:C})})),n=g,i=y);break}case"Z":e.push({key:"Z",data:[]}),n=s,i=o}r=h}return e}function no(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function Dk(t,e,r,n,i,s,o,a,l,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]=no(t,e,-u),[r,n]=no(r,n,-u);const W=(t-r)/2,P=(e-n)/2;let I=W*W/(i*i)+P*P/(s*s);I>1&&(I=Math.sqrt(I),i*=I,s*=I);const M=i*i,O=s*s,$=M*O-M*P*P-O*W*W,B=M*P*P+O*W*W,T=(a===l?-1:1)*Math.sqrt(Math.abs($/B));x=T*i*P/s+(t+r)/2,g=T*-s*W/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),l&&p>m&&(p-=2*Math.PI),!l&&m>p&&(m-=2*Math.PI)}let y=m-p;if(Math.abs(y)>120*Math.PI/180){const W=m,P=r,I=n;m=l&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=Dk(r=x+i*Math.cos(m),n=g+s*Math.sin(m),P,I,i,s,o,0,l,[m,W,x,g])}y=m-p;const C=Math.cos(p),b=Math.sin(p),w=Math.cos(m),_=Math.sin(m),S=Math.tan(y/4),N=4/3*i*S,A=4/3*s*S,L=[t,e],j=[t+N*b,e-A*C],F=[r+N*_,n-A*w],z=[r,n];if(j[0]=2*L[0]-j[0],j[1]=2*L[1]-j[1],h)return[j,F,z].concat(f);{f=[j,F,z].concat(f);const W=[];for(let P=0;P<f.length;P+=3){const I=no(f[P][0],f[P][1],u),M=no(f[P+1][0],f[P+1][1],u),O=no(f[P+2][0],f[P+2][1],u);W.push([I[0],I[1],M[0],M[1],O[0],O[1]])}return W}}const W$={randOffset:function(t,e){return Lt(t,e)},randOffsetWithRange:function(t,e,r){return Gl(t,e,r)},ellipse:function(t,e,r,n,i){const s=Ok(r,n,i);return Xu(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Wn(t,e,r,n,i,!0)}};function Pk(t,e,r,n,i){return{type:"path",ops:Wn(t,e,r,n,i)}}function sl(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Wn(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Wn(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?Pk(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function q$(t,e,r,n,i){return(function(s,o){return sl(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function Bg(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=Ia(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:Ia(r[0],1.5*(1+.22*e.roughness),Mg(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=Ia(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:Ia(o,1.5*(1+.22*e.roughness),Mg(e));for(const h of a)h.op!=="move"&&n.push(h);for(const h of l)h.op!=="move"&&i.push(h)}}return{type:"path",ops:n.concat(i)}}return{type:"path",ops:[]}}function Ok(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 l=1-r.curveFitting;return o+=Lt(o*l,r),a+=Lt(a*l,r),{increment:s,rx:o,ry:a}}function Xu(t,e,r,n){const[i,s]=Ig(n.increment,t,e,n.rx,n.ry,1,n.increment*Gl(.1,Gl(.4,1,r),r),r);let o=Vl(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=Ig(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=Vl(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function Lg(t,e,r,n,i,s,o,a,l){const h=t,u=e;let d=Math.abs(r/2),f=Math.abs(n/2);d+=Lt(.01*d,l),f+=Lt(.01*f,l);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/l.curveStepCount,g=Math.min(x/2,(m-p)/2),y=Fg(g,h,u,d,f,p,m,1,l);if(!l.disableMultiStroke){const C=Fg(g,h,u,d,f,p,m,1.5,l);y.push(...C)}return o&&(a?y.push(...Wn(h,u,h+d*Math.cos(p),u+f*Math.sin(p),l),...Wn(h,u,h+d*Math.cos(m),u+f*Math.sin(m),l)):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 Ag(t,e){const r=Fk(Ik(Qp(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(...Wn(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[l,h,u,d,f,p]=a;n.push(...H$(l,h,u,d,f,p,s,e)),s=[f,p];break}case"Z":n.push(...Wn(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function Nh(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 Di(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!cr[i])switch(i){case"zigzag":cr[i]||(cr[i]=new F$(n));break;case"cross-hatch":cr[i]||(cr[i]=new D$(n));break;case"dots":cr[i]||(cr[i]=new P$(n));break;case"dashed":cr[i]||(cr[i]=new O$(n));break;case"zigzag-line":cr[i]||(cr[i]=new $$(n));break;default:i="hachure",cr[i]||(cr[i]=new Kp(n))}return cr[i]})(e,W$).fillPolygons(t,e)}function Mg(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function $k(t){return t.randomizer||(t.randomizer=new R$(t.seed||0)),t.randomizer.next()}function Gl(t,e,r,n=1){return r.roughness*n*($k(r)*(e-t)+t)}function Lt(t,e,r=1){return Gl(-t,t,e,r)}function Wn(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=Ku(t,e,r,n,i,!0,!1);if(o)return a;const l=Ku(t,e,r,n,i,!0,!0);return a.concat(l)}function Ku(t,e,r,n,i,s,o){const a=Math.pow(t-r,2)+Math.pow(e-n,2),l=Math.sqrt(a);let h=1;h=l<200?1:l>500?.4:-.0016668*l+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>a&&(u=l/10);const d=u/2,f=.2+.2*$k(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),C=i.preserveVertices;return o?x.push({op:"move",data:[t+(C?0:g()),e+(C?0:g())]}):x.push({op:"move",data:[t+(C?0:Lt(u,i,h)),e+(C?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+(C?0:g()),n+(C?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+(C?0:y()),n+(C?0:y())]}),x}function Ia(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 Vl(n,null,r)}function Vl(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 l=t[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*t[a+1][0]-o*t[a-1][0])/6,l[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(...Ku(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function Ig(t,e,r,n,i,s,o,a){const l=[],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)];l.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)];l.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,l]}function Fg(t,e,r,n,i,s,o,a,l){const h=s+Lt(.1,l),u=[];u.push([Lt(a,l)+e+.9*n*Math.cos(h-t),Lt(a,l)+r+.9*i*Math.sin(h-t)]);for(let d=h;d<=o;d+=t)u.push([Lt(a,l)+e+n*Math.cos(d),Lt(a,l)+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)]),Vl(u,null,l)}function H$(t,e,r,n,i,s,o,a){const l=[],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?l.push({op:"move",data:[o[0],o[1]]}):l.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)],l.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 l}function io(t){return[...t]}function Dg(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(io(t[0]),io(t[1]),io(t[2]),io(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(io(i[0]));for(let a=1;a+2<i.length;a++){const l=i[a];s[0]=[l[0],l[1]],s[1]=[l[0]+(o*i[a+1][0]-o*i[a-1][0])/6,l[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 ol(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function U$(t,e,r){const n=ol(e,r);if(n===0)return ol(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)),ol(t,ri(e,r,i))}function ri(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function Qu(t,e,r,n){const i=n||[];if((function(a,l){const h=a[l+0],u=a[l+1],d=a[l+2],f=a[l+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(ol(s,o))>1&&i.push(a)):i.push(a),i.push(t[e+3])}else{const l=t[e+0],h=t[e+1],u=t[e+2],d=t[e+3],f=ri(l,h,.5),p=ri(h,u,.5),m=ri(u,d,.5),x=ri(f,p,.5),g=ri(p,m,.5),y=ri(x,g,.5);Qu([l,f,x,y],0,r,i),Qu([y,g,m,d],0,r,i)}var s,o;return i}function Y$(t,e){return Xl(t,0,t.length,e)}function Xl(t,e,r,n,i){const s=i||[],o=t[e],a=t[r-1];let l=0,h=1;for(let u=e+1;u<r-1;++u){const d=U$(t[u],o,a);d>l&&(l=d,h=u)}return Math.sqrt(l)>n?(Xl(t,e,h+1,n,s),Xl(t,h,r,n,s)):(s.length||s.push(o),s.push(a)),s}function Eh(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)Qu(t,3*s,e,n);return r&&r>0?Xl(n,0,n.length,r):n}const xr="none";class Kl{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",[Pk(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=q$(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(Nh([h],o)):a.push(Di([h],o))}return o.stroke!==xr&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=Ok(n,i,o),h=Xu(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=Xu(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push(Di([h.estimatedPoints],o));return o.stroke!==xr&&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",[sl(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,l){const h=this._o(l),u=[],d=Lg(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=Lg(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,C){const b=f,w=p;let _=Math.abs(m/2),S=Math.abs(x/2);_+=Lt(.01*_,C),S+=Lt(.01*S,C);let N=g,A=y;for(;N<0;)N+=2*Math.PI,A+=2*Math.PI;A-N>2*Math.PI&&(N=0,A=2*Math.PI);const L=(A-N)/C.curveStepCount,j=[];for(let F=N;F<=A;F+=L)j.push([b+_*Math.cos(F),w+S*Math.sin(F)]);return j.push([b+_*Math.cos(A),w+S*Math.sin(A)]),j.push([b,w]),Di([j],C)})(e,r,n,i,s,o,h));return h.stroke!==xr&&u.push(d),this._d("arc",u,h)}curve(e,r){const n=this._o(r),i=[],s=Bg(e,n);if(n.fill&&n.fill!==xr)if(n.fillStyle==="solid"){const o=Bg(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 l=typeof a[0][0]=="number"?[a]:a;for(const h of l)h.length<3?o.push(...h):h.length===3?o.push(...Eh(Dg([h[0],h[0],h[1],h[2]]),10,(1+n.roughness)/2)):o.push(...Eh(Dg(h),10,(1+n.roughness)/2))}o.length&&i.push(Di([o],n))}return n.stroke!==xr&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=sl(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(Nh([e],n)):i.push(Di([e],n))),n.stroke!==xr&&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!==xr,o=n.stroke!==xr,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,f){const p=Fk(Ik(Qp(u))),m=[];let x=[],g=[0,0],y=[];const C=()=>{y.length>=4&&x.push(...Eh(y,d)),y=[]},b=()=>{C(),x.length&&(m.push(x),x=[])};for(const{key:_,data:S}of p)switch(_){case"M":b(),g=[S[0],S[1]],x.push(g);break;case"L":C(),x.push([S[0],S[1]]);break;case"C":if(!y.length){const N=x.length?x[x.length-1]:g;y.push([N[0],N[1]])}y.push([S[0],S[1]]),y.push([S[2],S[3]]),y.push([S[4],S[5]]);break;case"Z":C(),x.push([g[0],g[1]])}if(b(),!f)return m;const w=[];for(const _ of m){const S=Y$(_,f);S.length&&w.push(S)}return w})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),h=Ag(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=Ag(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(Nh(l,n));else i.push(Di(l,n));return o&&(a?l.forEach((u=>{i.push(sl(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:xr};break;case"fillPath":o={d:this.opsToPath(s),stroke:xr,strokeWidth:0,fill:n.fill||xr};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||xr,strokeWidth:n,fill:xr}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class G${constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new Kl(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,l){const h=this.gen.arc(e,r,n,i,s,o,a,l);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 Fa="http://www.w3.org/2000/svg";class V${constructor(e,r){this.svg=e,this.gen=new Kl(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(Fa,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(Fa,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=i.createElementNS(Fa,"path"),l.setAttribute("d",this.opsToPath(a,o)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),e.shape!=="curve"&&e.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(i,a,n)}l&&s.appendChild(l)}return s}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);const s=e.createElementNS(Fa,"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,l){const h=this.gen.arc(e,r,n,i,s,o,a,l);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 gt={canvas:(t,e)=>new G$(t,e),svg:(t,e)=>new V$(t,e),generator:t=>new Kl(t),newSeed:()=>Kl.newSeed()},Bt=v(async(t,e,r)=>{var p,m;let n;const i=e.useHtmlLabels||kn((p=Kt())==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",Fe(e.labelStyle));let a;e.label===void 0?a="":a=typeof e.label=="string"?e.label:e.label[0];const l=!!e.icon||!!e.img,h=e.labelType==="markdown",u=await vn(o,zr(Ci(a),Kt()),{useHtmlLabels:i,width:e.width||((m=Kt().flowchart)==null?void 0:m.wrappingWidth),classes:h?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:h},Kt());let d=u.getBBox();const f=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=Wt(u);await sk(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"),Bh=v(async(t,e,r)=>{var l,h;const n=r.useHtmlLabels??ir(Kt()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await vn(i,zr(Ci(e),Kt()),{useHtmlLabels:n,width:r.width||((h=(l=Kt())==null?void 0:l.flowchart)==null?void 0:h.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let o=s.getBBox();const a=r.padding/2;if(ir(Kt())){const u=s.children[0],d=Wt(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"),Ct=v((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),Et=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Ut(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Ut,"createPathFromPoints");function qn(t,e,r,n,i,s){const o=[],l=r-t,h=n-e,u=l/s,d=2*Math.PI/u,f=e+h/2;for(let p=0;p<=50;p++){const m=p/50,x=t+m*l,g=f+i*Math.sin(d*(x-t));o.push({x,y:g})}return o}v(qn,"generateFullSineWavePoints");function Yo(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(Yo,"generateCirclePoints");function Zu(t){const e=Array.from(t.childNodes).filter(l=>l.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),n=e.map(l=>l.getAttribute("d")).filter(l=>l!==null).join(" ");r.setAttribute("d",n);const i=e.find(l=>l.getAttribute("fill")!=="none"),s=e.find(l=>l.getAttribute("stroke")!=="none"),o=v((l,h)=>(l==null?void 0:l.getAttribute(h))??void 0,"getAttr");if(i){const l={fill:o(i,"fill"),"fill-opacity":o(i,"fill-opacity")??"1"};Object.entries(l).forEach(([h,u])=>{u&&r.setAttribute(h,u)})}if(s){const l={stroke:o(s,"stroke"),"stroke-width":o(s,"stroke-width")??"1","stroke-opacity":o(s,"stroke-opacity")??"1"};Object.entries(l).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(Zu,"mergePaths");var X$=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,l,h;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),l=s===0?0:a*i/s,h=a):(i<0&&(o=-o),l=o,h=i===0?0:o*s/i),{x:r+l,y:n+h}},"intersectRect"),Is=X$,K$=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=Kt(),a=ir(o);return await vn(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),Mn=K$,Yn=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"),Rk=v(async(t,e)=>{it.info("Creating subgraph rect for ",e.id,e);const r=Kt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=bt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=ir(r),p=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await vn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width}):m=await Mn(p,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(ir(r)){const N=m.children[0],A=Wt(m);x=N.getBoundingClientRect(),A.attr("width",x.width),A.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,C=e.x-g/2,b=e.y-y/2;it.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const N=gt.svg(d),A=xt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),L=N.path(Yn(C,b,g,y,0),A);w=d.insert(()=>(it.debug("Rough node insert CXC",L),L),":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",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",C).attr("y",b).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=$p(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const N=p.select("span");N&&N.attr("style",a)}const S=w.node().getBBox();return e.offsetX=0,e.width=S.width,e.height=S.height,e.offsetY=x.height-e.padding/2,e.intersect=function(N){return Is(e,N)},{cluster:d,labelBBox:x}},"rect"),Q$=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 Is(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),Z$=v(async(t,e)=>{const r=Kt(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:s,compositeBackground:o,compositeTitleBackground:a,nodeBorder:l}=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 Mn(d,e.label,e.labelStyle,void 0,!0);let m=p.getBBox();if(ir(r)){const L=p.children[0],j=Wt(p);m=L.getBoundingClientRect(),j.attr("width",m.width),j.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 C=e.height+x,b=e.height+x-m.height-6,w=e.x-y/2,_=e.y-C/2;e.width=y;const S=e.y-e.height/2-g+m.height+2;let N;if(e.look==="handDrawn"){const L=e.cssClasses.includes("statediagram-cluster-alt"),j=gt.svg(h),F=e.rx||e.ry?j.path(Yn(w,_,y,C,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):j.rectangle(w,_,y,C,{seed:i});N=h.insert(()=>F,":first-child");const z=j.rectangle(w,S,y,b,{fill:L?s:o,fillStyle:L?"hachure":"solid",stroke:l,seed:i});N=h.insert(()=>F,":first-child"),f=h.insert(()=>z)}else N=u.insert("rect",":first-child"),N.attr("class","outer").attr("x",w).attr("y",_).attr("width",y).attr("height",C).attr("data-look",e.look),f.attr("class","inner").attr("x",w).attr("y",S).attr("width",y).attr("height",b);d.attr("transform",`translate(${e.x-m.width/2}, ${_+1-(ir(r)?0:3)})`);const A=N.node().getBBox();return e.height=A.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(L){return Is(e,L)},{cluster:h,labelBBox:m}},"roundedWithTitle"),J$=v(async(t,e)=>{it.info("Creating subgraph rect for ",e.id,e);const r=Kt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=bt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=ir(r),p=d.insert("g").attr("class","cluster-label "),m=await vn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width});let x=m.getBBox();if(ir(r)){const N=m.children[0],A=Wt(m);x=N.getBoundingClientRect(),A.attr("width",x.width),A.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,C=e.x-g/2,b=e.y-y/2;it.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const N=gt.svg(d),A=xt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),L=N.path(Yn(C,b,g,y,e.rx),A);w=d.insert(()=>(it.debug("Rough node insert CXC",L),L),":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",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",C).attr("y",b).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:_}=$p(r);if(p.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const N=p.select("span");N&&N.attr("style",a)}const S=w.node().getBBox();return e.offsetX=0,e.width=S.width,e.height=S.height,e.offsetY=x.height-e.padding/2,e.intersect=function(N){return Is(e,N)},{cluster:d,labelBBox:x}},"kanbanSection"),tR=v((t,e)=>{const r=Kt(),{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"),l=0*e.padding,h=e.width+l;e.diff=-e.padding;const u=e.height+l,d=e.x-h/2,f=e.y-u/2;e.width=h;let p;if(e.look==="handDrawn"){const g=gt.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 Is(e,x)},{cluster:o,labelBBox:{}}},"divider"),eR=Rk,rR={rect:Rk,squareRect:eR,roundedWithTitle:Z$,noteGroup:Q$,divider:tR,kanbanSection:J$},zk=new Map,nR=v(async(t,e)=>{const r=e.shape||"rect",n=await rR[r](t,e);return zk.set(e.id,n),n},"insertCluster"),$Y=v(()=>{zk=new Map},"clear");function Wk(t,e){return t.intersect(e)}v(Wk,"intersectNode");var iR=Wk;function qk(t,e,r,n){var i=t.x,s=t.y,o=i-n.x,a=s-n.y,l=Math.sqrt(e*e*a*a+r*r*o*o),h=Math.abs(e*r*o/l);n.x<i&&(h=-h);var u=Math.abs(e*r*a/l);return n.y<s&&(u=-u),{x:i+h,y:s+u}}v(qk,"intersectEllipse");var Hk=qk;function Uk(t,e,r){return Hk(t,e,e,r)}v(Uk,"intersectCircle");var sR=Uk;function Yk(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,l=i*n.x+s*n.y+o,h=1e-6;if(a!==0&&l!==0&&Ju(a,l))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&&Ju(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 C=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:C,y:b}}}v(Yk,"intersectLine");function Ju(t,e){return t*e>0}v(Ju,"sameSign");var oR=Yk;function Gk(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 l=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=oR(t,r,{x:l+d.x,y:h+d.y},{x:l+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(Gk,"intersectPolygon");var aR=Gk,pt={node:iR,circle:sR,ellipse:Hk,polygon:aR,rect:Is};function Vk(t,e){const{labelStyles:r}=bt(e);e.labelStyle=r;const n=Et(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,l=gt.svg(s),h=xt(e,{fill:"black",stroke:"none",fillStyle:"solid"});e.look!=="handDrawn"&&(h.roughness=0);const u=l.circle(0,0,o*2,h),d=s.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",Fe(a)),Ct(e,d),e.intersect=function(f){return it.info("Circle intersect",e,o,f),pt.circle(e,o,f)},s}v(Vk,"anchor");function td(t,e,r,n,i,s,o){const l=(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=l+g*s*Math.sin(u)*(o?-1:1),C=h-g*i*Math.cos(u)*(o?-1:1),b=Math.atan2((e-C)/s,(t-y)/i);let _=Math.atan2((n-C)/s,(r-y)/i)-b;o&&_<0&&(_+=2*Math.PI),!o&&_>0&&(_-=2*Math.PI);const S=[];for(let N=0;N<20;N++){const A=N/19,L=b+A*_,j=y+i*Math.cos(L),F=C+s*Math.sin(L);S.push({x:j,y:F})}return S}v(td,"generateArcPoints");function Xk(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(Xk,"calculateArcSagitta");async function Kk(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=v(L=>L+o,"calcTotalHeight"),l=v(L=>{const j=L/2;return[j/(2.5+L/50),j]},"calcEllipseRadius"),{shapeSvg:h,bbox:u}=await Bt(t,e,Et(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[f,p]=l(d),m=Xk(d,f,p),g=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2+m-m,y=d,{cssStyles:C}=e,b=[{x:g/2,y:-y/2},{x:-g/2,y:-y/2},...td(-g/2,-y/2,-g/2,y/2,f,p,!1),{x:g/2,y:y/2},...td(g/2,y/2,g/2,-y/2,f,p,!0)],w=gt.svg(h),_=xt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const S=Ut(b),N=w.path(S,_),A=h.insert(()=>N,":first-child");return A.attr("class","basic label-container outer-path"),C&&e.look!=="handDrawn"&&A.selectAll("path").attr("style",C),n&&e.look!=="handDrawn"&&A.selectAll("path").attr("style",n),A.attr("transform",`translate(${f/2}, 0)`),Ct(e,A),e.intersect=function(L){return pt.polygon(e,b,L)},h}v(Kk,"bowTieRect");function wn(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(wn,"insertPolygonShape");var Da=12;async function Qk(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?28:i,o=e.look==="neo"?24:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s+Da),u=((e==null?void 0:e.height)??l.height)+(e.look==="neo"?o*2:o),d=0,f=h,p=-u,m=0,x=[{x:d+Da,y:p},{x:f,y:p},{x:f,y:m},{x:d,y:m},{x:d,y:p+Da},{x:d+Da,y:p}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const C=gt.svg(a),b=xt(e,{}),w=Ut(x),_=C.path(w,b);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),y&&g.attr("style",y)}else g=wn(a,h,u,x);return n&&g.attr("style",n),Ct(e,g),e.intersect=function(C){return pt.polygon(e,x,C)},a}v(Qk,"card");function Zk(t,e){const{nodeStyles:r}=bt(e);e.label="";const n=t.insert("g").attr("class",Et(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=gt.svg(n),l=xt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=Ut(o),u=a.path(h,l),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 pt.polygon(e,o,f)},n}v(Zk,"choice");async function Zp(t,e,r){const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await Bt(t,e,Et(e)),l=16,h=(r==null?void 0:r.padding)??a,u=e.look==="neo"?o.width/2+l*2:o.width/2+h;let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const p=gt.svg(s),m=xt(e,{}),x=p.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",Fe(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 Ct(e,d),e.calcIntersect=function(p,m){const x=p.width/2;return pt.circle(p,x,m)},e.intersect=function(p){return it.info("Circle intersect",e,u,p),pt.circle(e,u,p)},s}v(Zp,"circle");function Jk(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}
535
- M ${i.x},${i.y} L ${o.x},${o.y}`}v(Jk,"createLine");function tv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r,e.label="";const i=t.insert("g").attr("class",Et(e)).attr("id",e.domId??e.id),s=Math.max(30,(e==null?void 0:e.width)??0),{cssStyles:o}=e,a=gt.svg(i),l=xt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=a.circle(0,0,s*2,l),u=Jk(s),d=a.path(u,l),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),Ct(e,f),e.intersect=function(p){return it.info("crossedCircle intersect",e,{radius:s,point:p}),pt.circle(e,s,p)},i}v(tv,"crossedCircle");function un(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(un,"generateCirclePoints");async function ev(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,h=s.width+a,u=s.height+l,d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...un(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...un(h/2+d*2,-d,d,20,-180,-270),...un(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...un(h/2,u/2,d,20,0,90)],m=[{x:h/2,y:-u/2-d},{x:-h/2,y:-u/2-d},...un(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...un(h/2+h*.1,-d,d,20,-180,-270),...un(h/2+h*.1,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...un(h/2,u/2,d,20,0,90),{x:-h/2,y:u/2+d},{x:h/2,y:u/2+d}],x=gt.svg(i),g=xt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Ut(p).replace("Z",""),b=x.path(C,g),w=Ut(m),_=x.path(w,{...g}),S=i.insert("g",":first-child");return S.insert(()=>_,":first-child").attr("stroke-opacity",0),S.insert(()=>b,":first-child"),S.attr("class","text"),f&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),S.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))})`),Ct(e,S),e.intersect=function(N){return pt.polygon(e,m,N)},i}v(ev,"curlyBraceLeft");function dn(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(dn,"generateCirclePoints");async function rv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,h=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:f}=e,p=[...dn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...dn(h/2+d*2,-d,d,20,-180,-270),...dn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...dn(h/2,u/2,d,20,0,90)],m=[{x:-h/2,y:-u/2-d},{x:h/2,y:-u/2-d},...dn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...dn(h/2+d*2,-d,d,20,-180,-270),...dn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...dn(h/2,u/2,d,20,0,90),{x:h/2,y:u/2+d},{x:-h/2,y:u/2+d}],x=gt.svg(i),g=xt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Ut(p).replace("Z",""),b=x.path(C,g),w=Ut(m),_=x.path(w,{...g}),S=i.insert("g",":first-child");return S.insert(()=>_,":first-child").attr("stroke-opacity",0),S.insert(()=>b,":first-child"),S.attr("class","text"),f&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),S.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))})`),Ct(e,S),e.intersect=function(N){return pt.polygon(e,m,N)},i}v(rv,"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 nv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,h=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),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=gt.svg(i),y=xt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=Ut(p).replace("Z",""),w=g.path(b,y),S=Ut(m).replace("Z",""),N=g.path(S,y),A=Ut(x),L=g.path(A,{...y}),j=i.insert("g",":first-child");return j.insert(()=>L,":first-child").attr("stroke-opacity",0),j.insert(()=>w,":first-child"),j.insert(()=>N,":first-child"),j.attr("class","text"),f&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",n),j.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))})`),Ct(e,j),e.intersect=function(F){return pt.polygon(e,x,F)},i}v(nv,"curlyBraces");async function iv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=20,l=5,{shapeSvg:h,bbox:u}=await Bt(t,e,Et(e)),d=Math.max(a,(u.width+s*2)*1.25,(e==null?void 0:e.width)??0),f=Math.max(l,u.height+o*2,(e==null?void 0:e.height)??0),p=f/2,{cssStyles:m}=e,x=gt.svg(h),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,C=f,b=y-p,w=C/4,_=[{x:b,y:0},{x:w,y:0},{x:0,y:C/2},{x:w,y:C},{x:b,y:C},...Yo(-b,-C/2,p,50,270,90)],S=Ut(_),N=x.path(S,g),A=h.insert(()=>N,":first-child");return A.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&A.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&A.selectChildren("path").attr("style",n),A.attr("transform",`translate(${-d/2}, ${-f/2})`),Ct(e,A),e.intersect=function(L){return pt.polygon(e,_,L)},h}v(iv,"curvedTrapezoid");var lR=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"),cR=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"),hR=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Pg=8,Og=8;async function sv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<Og&&(e.width=Og);const C=g/2/(2.5+g/50);e.height=(e.height??0)-s-C*3,e.height<Pg&&(e.height=Pg)}const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,Et(e)),u=(e.width?e.width:l.width)+o,d=u/2,f=d/(2.5+u/50),p=(e.height?e.height:l.height)+s+f;let m;const{cssStyles:x}=e;if(e.look==="handDrawn"){const g=gt.svg(a),y=cR(0,0,u,p,d,f),C=hR(0,f,u,p,d,f),b=xt(e,{}),w=g.path(y,b),_=g.path(C,xt(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=lR(0,0,u,p,d,f);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",Fe(x)).attr("style",n)}return m.attr("label-offset-y",f),m.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),Ct(e,m),h.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+(e.padding??0)/1.5-(l.y-(l.top??0))})`),e.intersect=function(g){const y=pt.rect(e,g),C=y.x-(e.x??0);if(d!=0&&(Math.abs(C)<(e.width??0)/2||Math.abs(C)==(e.width??0)/2&&Math.abs(y.y-(e.y??0))>(e.height??0)/2-f)){let b=f*f*(1-C*C/(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(sv,"cylinder");async function Fs(t,e,r){const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await Bt(t,e,Et(e)),a=Math.max(o.width+r.labelPaddingX*2,(e==null?void 0:e.width)||0),l=Math.max(o.height+r.labelPaddingY*2,(e==null?void 0:e.height)||0),h=-a/2,u=-l/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=gt.svg(s),g=xt(e,{}),y=f||p?x.path(Yn(h,u,a,l,f||0),g):x.rectangle(h,u,a,l,g);d=s.insert(()=>y,":first-child"),d.attr("class","basic label-container").attr("style",Fe(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",Fe(f)).attr("ry",Fe(p)).attr("x",h).attr("y",u).attr("width",a).attr("height",l);return Ct(e,d),e.calcIntersect=function(x,g){return pt.rect(x,g)},e.intersect=function(x){return pt.rect(e,x)},s}v(Fs,"drawRect");async function ov(t,e){const{cssClasses:r,labelPaddingX:n,labelPaddingY:i,padding:s,width:o,height:a}=e,l={rx:0,ry:0,labelPaddingX:n??(s??0)*2,labelPaddingY:i??s??0},h=await Fs(t,e,l);if(e.look==="handDrawn"){const p=gt.svg(h),m=xt(e,{}),x=h.select(".basic.label-container > path:nth-child(2)"),g=x.node();if(!g)return h;let y=null;if(g instanceof SVGGraphicsElement)y=g.getBBox();else return h;return h.insert(()=>p.line(y.x,y.y,y.x+y.width,y.y,m),".basic.label-container g.label"),h.insert(()=>p.line(y.x,y.y+y.height,y.x+y.width,y.y+y.height,m),".basic.label-container g.label"),x.remove(),h}const u=h.select(".basic.label-container"),d=(Number(u.attr("width"))||o)??0,f=(Number(u.attr("height"))||a)??0;return d>0&&f>0&&u.attr("stroke-dasharray",`${d} ${f}`),h}v(ov,"datastore");async function av(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l}=await Bt(t,e,Et(e)),h=a.width+i,u=a.height+s,d=u*.2,f=-h/2,p=-u/2-d/2,{cssStyles:m}=e,x=gt.svg(o),g=xt(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}],C=x.polygon(y.map(w=>[w.x,w.y]),g),b=o.insert(()=>C,":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),l.attr("transform",`translate(${f+(e.padding??0)/2-(a.x-(a.left??0))}, ${p+d+(e.padding??0)/2-(a.y-(a.top??0))})`),Ct(e,b),e.intersect=function(w){return pt.rect(e,w)},o}v(av,"dividedRectangle");async function lv(t,e){var p,m;const{labelStyles:r,nodeStyles:n}=bt(e),i=e.look==="neo"?12:5;e.labelStyle=r;const s=e.padding??0,o=e.look==="neo"?16:s,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=(e!=null&&e.width?(e==null?void 0:e.width)/2:l.width/2)+(o??0),u=h-i;let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const x=gt.svg(a),g=xt(e,{roughness:.2,strokeWidth:2.5}),y=xt(e,{roughness:.2,strokeWidth:1.5}),C=x.circle(0,0,h*2,g),b=x.circle(0,0,u*2,y);d=a.insert("g",":first-child"),d.attr("class",Fe(e.cssClasses)).attr("style",Fe(f)),(p=d.node())==null||p.appendChild(C),(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 Ct(e,d),e.intersect=function(x){return it.info("DoubleCircle intersect",e,h,x),pt.circle(e,h,x)},a}v(lv,"doublecircle");function cv(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=bt(e);e.label="",e.labelStyle=n;const s=t.insert("g").attr("class",Et(e)).attr("id",e.domId??e.id),o=7,{cssStyles:a}=e,l=gt.svg(s),{nodeBorder:h}=r,u=xt(e,{fillStyle:"solid"});e.look!=="handDrawn"&&(u.roughness=0);const d=l.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),Ct(e,f),e.intersect=function(p){return it.info("filledCircle intersect",e,{radius:o,point:p}),pt.circle(e,o,p)},s}v(cv,"filledCircle");var $g=10,Rg=10;async function hv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<$g&&(e.height=$g),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<Rg&&(e.width=Rg));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(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=gt.svg(o),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Ut(f),y=m.path(g,x),C=o.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`).attr("class","outer-path");return p&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",p),n&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",n),e.width=h,e.height=u,Ct(e,C),l.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 it.info("Triangle intersect",e,f,b),pt.polygon(e,f,b)},o}v(hv,"flippedTriangle");function uv(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=bt(e);e.label="";const o=t.insert("g").attr("class",Et(e)).attr("id",e.domId??e.id),{cssStyles:a}=e;let l=Math.max(70,(e==null?void 0:e.width)??0),h=Math.max(10,(e==null?void 0:e.height)??0);r==="LR"&&(l=Math.max(10,(e==null?void 0:e.width)??0),h=Math.max(70,(e==null?void 0:e.height)??0));const u=-1*l/2,d=-1*h/2,f=gt.svg(o),p=xt(e,{stroke:i.lineColor,fill:i.lineColor});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const m=f.rectangle(u,d,l,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),Ct(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 pt.rect(e,y)},o}v(uv,"forkJoin");async function dv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l,bbox:h}=await Bt(t,e,Et(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=gt.svg(l),x=xt(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},...Yo(-u/2+f,0,f,50,90,270),{x:u/2-f,y:d/2},{x:-u/2,y:d/2}],y=Ut(g),C=m.path(y,x),b=l.insert(()=>C,":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),Ct(e,b),e.intersect=function(w){return it.info("Pill intersect",e,{radius:f,point:w}),pt.polygon(e,g,w)},l}v(dv,"halfRoundedRectangle");var uR=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 pv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e),i=e.look==="neo"?3.5:4;e.labelStyle=r;const s=e.padding??0,o=70,a=32,l=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)-l}const{shapeSvg:u,bbox:d}=await Bt(t,e,Et(e)),f=(e!=null&&e.height?e==null?void 0:e.height:d.height)+l,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 C=gt.svg(u),b=xt(e,{}),w=uR(0,0,m,f,p),_=C.path(w,b);g=u.insert(()=>_,":first-child").attr("transform",`translate(${-m/2}, ${f/2})`),y&&g.attr("style",y)}else g=wn(u,m,f,x);return n&&g.attr("style",n),e.width=m,e.height=f,Ct(e,g),e.intersect=function(C){return pt.polygon(e,x,C)},u}v(pv,"hexagon");async function fv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await Bt(t,e,Et(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,l=gt.svg(i),h=xt(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=Ut(u),f=l.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})`),Ct(e,p),e.intersect=function(m){return it.info("Pill intersect",e,{points:u}),pt.polygon(e,u,m)},i}v(fv,"hourglass");async function mv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:h,bbox:u,label:d}=await Bt(t,e,"icon-shape default"),f=e.pos==="t",p=a,m=a,{nodeBorder:x}=r,{stylesMap:g}=Ms(e),y=-m/2,C=-p/2,b=e.label?8:0,w=gt.svg(h),_=xt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const S=w.rectangle(y,C,m,p,_),N=Math.max(m,u.width),A=p+u.height+b,L=w.rectangle(-N/2,-A/2,N,A,{..._,fill:"transparent",stroke:"none"}),j=h.insert(()=>S,":first-child"),F=h.insert(()=>L);if(e.icon){const z=h.append("g");z.html(`<g>${await ca(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const W=z.node().getBBox(),P=W.width,I=W.height,M=W.x,O=W.y;z.attr("transform",`translate(${-P/2-M},${f?u.height/2+b/2-I/2-O:-u.height/2-b/2-I/2-O})`),z.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-A/2:A/2-u.height})`),j.attr("transform",`translate(0,${f?u.height/2+b/2:-u.height/2-b/2})`),Ct(e,F),e.intersect=function(z){if(it.info("iconSquare intersect",e,z),!e.label)return pt.rect(e,z);const W=e.x??0,P=e.y??0,I=e.height??0;let M=[];return f?M=[{x:W-u.width/2,y:P-I/2},{x:W+u.width/2,y:P-I/2},{x:W+u.width/2,y:P-I/2+u.height+b},{x:W+m/2,y:P-I/2+u.height+b},{x:W+m/2,y:P+I/2},{x:W-m/2,y:P+I/2},{x:W-m/2,y:P-I/2+u.height+b},{x:W-u.width/2,y:P-I/2+u.height+b}]:M=[{x:W-m/2,y:P-I/2},{x:W+m/2,y:P-I/2},{x:W+m/2,y:P-I/2+p},{x:W+u.width/2,y:P-I/2+p},{x:W+u.width/2/2,y:P+I/2},{x:W-u.width/2,y:P+I/2},{x:W-u.width/2,y:P-I/2+p},{x:W-m/2,y:P-I/2+p}],pt.polygon(e,M,z)},h}v(mv,"icon");async function gv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:h,bbox:u,label:d}=await Bt(t,e,"icon-shape default"),f=20,p=e.label?8:0,m=e.pos==="t",{nodeBorder:x,mainBkg:g}=r,{stylesMap:y}=Ms(e),C=gt.svg(h),b=xt(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 ca(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const S=_.node().getBBox(),N=S.width,A=S.height,L=S.x,j=S.y,F=Math.max(N,A)*Math.SQRT2+f*2,z=C.circle(0,0,F,b),W=Math.max(F,u.width),P=F+u.height+p,I=C.rectangle(-W/2,-P/2,W,P,{...b,fill:"transparent",stroke:"none"}),M=h.insert(()=>z,":first-child"),O=h.insert(()=>I);return _.attr("transform",`translate(${-N/2-L},${m?u.height/2+p/2-A/2-j:-u.height/2-p/2-A/2-j})`),_.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})`),M.attr("transform",`translate(0,${m?u.height/2+p/2:-u.height/2-p/2})`),Ct(e,O),e.intersect=function($){return it.info("iconSquare intersect",e,$),pt.rect(e,$)},h}v(gv,"iconCircle");async function xv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:h,bbox:u,halfPadding:d,label:f}=await Bt(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:C}=Ms(e),b=-x/2,w=-m/2,_=e.label?8:0,S=gt.svg(h),N=xt(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const A=C.get("fill");N.stroke=A??y;const L=S.path(Yn(b,w,x,m,5),N),j=Math.max(x,u.width),F=m+u.height+_,z=S.rectangle(-j/2,-F/2,j,F,{...N,fill:"transparent",stroke:"none"}),W=h.insert(()=>L,":first-child").attr("class","icon-shape2"),P=h.insert(()=>z);if(e.icon){const I=h.append("g");I.html(`<g>${await ca(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const M=I.node().getBBox(),O=M.width,$=M.height,B=M.x,T=M.y;I.attr("transform",`translate(${-O/2-B},${p?u.height/2+_/2-$/2-T:-u.height/2-_/2-$/2-T})`),I.attr("style",`color: ${C.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-F/2:F/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),Ct(e,P),e.intersect=function(I){if(it.info("iconSquare intersect",e,I),!e.label)return pt.rect(e,I);const M=e.x??0,O=e.y??0,$=e.height??0;let B=[];return p?B=[{x:M-u.width/2,y:O-$/2},{x:M+u.width/2,y:O-$/2},{x:M+u.width/2,y:O-$/2+u.height+_},{x:M+x/2,y:O-$/2+u.height+_},{x:M+x/2,y:O+$/2},{x:M-x/2,y:O+$/2},{x:M-x/2,y:O-$/2+u.height+_},{x:M-u.width/2,y:O-$/2+u.height+_}]:B=[{x:M-x/2,y:O-$/2},{x:M+x/2,y:O-$/2},{x:M+x/2,y:O-$/2+m},{x:M+u.width/2,y:O-$/2+m},{x:M+u.width/2/2,y:O+$/2},{x:M-u.width/2,y:O+$/2},{x:M-u.width/2,y:O-$/2+m},{x:M-x/2,y:O-$/2+m}],pt.polygon(e,B,I)},h}v(xv,"iconRounded");async function yv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=bt(e);e.labelStyle=i;const s=e.assetHeight??48,o=e.assetWidth??48,a=Math.max(s,o),l=n==null?void 0:n.wrappingWidth;e.width=Math.max(a,l??0);const{shapeSvg:h,bbox:u,halfPadding:d,label:f}=await Bt(t,e,"icon-shape default"),p=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:C}=Ms(e),b=-x/2,w=-m/2,_=e.label?8:0,S=gt.svg(h),N=xt(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const A=C.get("fill");N.stroke=A??y;const L=S.path(Yn(b,w,x,m,.1),N),j=Math.max(x,u.width),F=m+u.height+_,z=S.rectangle(-j/2,-F/2,j,F,{...N,fill:"transparent",stroke:"none"}),W=h.insert(()=>L,":first-child"),P=h.insert(()=>z);if(e.icon){const I=h.append("g");I.html(`<g>${await ca(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const M=I.node().getBBox(),O=M.width,$=M.height,B=M.x,T=M.y;I.attr("transform",`translate(${-O/2-B},${p?u.height/2+_/2-$/2-T:-u.height/2-_/2-$/2-T})`),I.attr("style",`color: ${C.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-F/2:F/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),Ct(e,P),e.intersect=function(I){if(it.info("iconSquare intersect",e,I),!e.label)return pt.rect(e,I);const M=e.x??0,O=e.y??0,$=e.height??0;let B=[];return p?B=[{x:M-u.width/2,y:O-$/2},{x:M+u.width/2,y:O-$/2},{x:M+u.width/2,y:O-$/2+u.height+_},{x:M+x/2,y:O-$/2+u.height+_},{x:M+x/2,y:O+$/2},{x:M-x/2,y:O+$/2},{x:M-x/2,y:O-$/2+u.height+_},{x:M-u.width/2,y:O-$/2+u.height+_}]:B=[{x:M-x/2,y:O-$/2},{x:M+x/2,y:O-$/2},{x:M+x/2,y:O-$/2+m},{x:M+u.width/2,y:O-$/2+m},{x:M+u.width/2/2,y:O+$/2},{x:M-u.width/2,y:O+$/2},{x:M-u.width/2,y:O-$/2+m},{x:M-x/2,y:O-$/2+m}],pt.polygon(e,B,I)},h}v(yv,"iconSquare");async function bv(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}=bt(e);e.labelStyle=o;const a=r==null?void 0:r.wrappingWidth;e.defaultWidth=r==null?void 0:r.wrappingWidth;const l=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:l,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 Bt(t,e,"image-shape default"),m=e.pos==="t",x=-h/2,g=-u/2,y=e.label?8:0,C=gt.svg(d),b=xt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const w=C.rectangle(x,g,h,u,b),_=Math.max(h,f.width),S=u+f.height+y,N=C.rectangle(-_/2,-S/2,_,S,{...b,fill:"none",stroke:"none"}),A=d.insert(()=>w,":first-child"),L=d.insert(()=>N);if(e.img){const j=d.append("image");j.attr("href",e.img),j.attr("width",h),j.attr("height",u),j.attr("preserveAspectRatio","none"),j.attr("transform",`translate(${-h/2},${m?S/2-u:-S/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})`),A.attr("transform",`translate(0,${m?f.height/2+y/2:-f.height/2-y/2})`),Ct(e,L),e.intersect=function(j){if(it.info("iconSquare intersect",e,j),!e.label)return pt.rect(e,j);const F=e.x??0,z=e.y??0,W=e.height??0;let P=[];return m?P=[{x:F-f.width/2,y:z-W/2},{x:F+f.width/2,y:z-W/2},{x:F+f.width/2,y:z-W/2+f.height+y},{x:F+h/2,y:z-W/2+f.height+y},{x:F+h/2,y:z+W/2},{x:F-h/2,y:z+W/2},{x:F-h/2,y:z-W/2+f.height+y},{x:F-f.width/2,y:z-W/2+f.height+y}]:P=[{x:F-h/2,y:z-W/2},{x:F+h/2,y:z-W/2},{x:F+h/2,y:z-W/2+u},{x:F+f.width/2,y:z-W/2+u},{x:F+f.width/2/2,y:z+W/2},{x:F-f.width/2,y:z+W/2},{x:F-f.width/2,y:z-W/2+u},{x:F-h/2,y:z-W/2+u}],pt.polygon(e,P,j)},d}v(bv,"imageSquare");async function Cv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=Math.max(l.width+(o??0)*2,(e==null?void 0:e.width)??0),u=Math.max(l.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=gt.svg(a),x=xt(e,{}),g=Ut(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=wn(a,h,u,d);return n&&f.attr("style",n),e.width=h,e.height=u,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(Cv,"inv_trapezoid");async function kv(t,e){const{shapeSvg:r,bbox:n,label:i}=await Bt(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))})`),Ct(e,s),e.intersect=function(l){return pt.rect(e,l)},r}v(kv,"labelRect");async function vv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.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=gt.svg(a),x=xt(e,{}),g=Ut(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=wn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(vv,"lean_left");async function wv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=i,o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.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=gt.svg(a),x=xt(e,{}),g=Ut(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=wn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(wv,"lean_right");function Sv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.label="",e.labelStyle=r;const i=t.insert("g").attr("class",Et(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),l=7,h=[{x:o,y:0},{x:0,y:a+l/2},{x:o-2*l,y:a+l/2},{x:0,y:2*a},{x:o,y:a-l/2},{x:2*l,y:a-l/2}],u=gt.svg(i),d=xt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=Ut(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})`),Ct(e,m),e.intersect=function(x){return it.info("lightningBolt intersect",e,x),pt.polygon(e,h,x)},i}v(Sv,"lightningBolt");var dR=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"),pR=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"),fR=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),zg=10,Wg=10;async function Tv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<Wg&&(e.width=Wg);const b=y/2/(2.5+y/50);e.height=(e.height??0)-o-b*3,e.height<zg&&(e.height=zg)}const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,Et(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=u/2,f=d/(2.5+u/50),p=(e!=null&&e.height?e==null?void 0:e.height:l.height)+f+o*2,m=p*.1;let x;const{cssStyles:g}=e;if(e.look==="handDrawn"){const y=gt.svg(a),C=pR(0,0,u,p,d,f,m),b=fR(0,f,u,p,d,f),w=xt(e,{}),_=y.path(C,w),S=y.path(b,w);a.insert(()=>S,":first-child").attr("class","line"),x=a.insert(()=>_,":first-child"),x.attr("class","basic label-container"),g&&x.attr("style",g)}else{const y=dR(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",Fe(g)).attr("style",n)}return x.attr("label-offset-y",f),x.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),Ct(e,x),h.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+f-(l.y-(l.top??0))})`),e.intersect=function(y){const C=pt.rect(e,y),b=C.x-(e.x??0);if(d!=0&&(Math.abs(b)<(e.width??0)/2||Math.abs(b)==(e.width??0)/2&&Math.abs(C.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),C.y+=w}return C},a}v(Tv,"linedCylinder");async function _v(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l,label:h}=await Bt(t,e,Et(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+(s??0)*2,d=(e!=null&&e.height?e==null?void 0:e.height:l.height)+(o??0)*2,f=e.look==="neo"?d/4:d/8,p=d+f,{cssStyles:m}=e,x=gt.svg(a),g=xt(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},...qn(-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}],C=x.polygon(y.map(w=>[w.x,w.y]),g),b=a.insert(()=>C,":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-(l.x-(l.left??0))},${-d/2+(e.padding??0)-f/2-(l.y-(l.top??0))})`),Ct(e,b),e.intersect=function(w){return pt.polygon(e,y,w)},a}v(_v,"linedWaveEdgedRect");async function jv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l,bbox:h,label:u}=await Bt(t,e,Et(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,C=gt.svg(l),b=xt(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 S=Ut(w);let N=C.path(S,b);const A=Ut(_);let L=C.path(A,b);e.look!=="handDrawn"&&(N=Zu(N),L=Zu(L));const j=l.insert("g",":first-child");return j.insert(()=>N),j.insert(()=>L),j.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&j.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))})`),Ct(e,j),e.intersect=function(F){return pt.polygon(e,w,F)},l}v(jv,"multiRect");async function Nv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(e)),a=e.padding??0,l=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)-l*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)+l*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:C}=e,b=qn(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}],S=[{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}],N=gt.svg(i),A=xt(e,{});e.look!=="handDrawn"&&(A.roughness=0,A.fillStyle="solid");const L=Ut(_),j=N.path(L,A),F=Ut(S),z=N.path(F,A),W=i.insert(()=>j,":first-child");return W.insert(()=>z),W.attr("class","basic label-container outer-path"),C&&e.look!=="handDrawn"&&W.selectAll("path").attr("style",C),n&&e.look!=="handDrawn"&&W.selectAll("path").attr("style",n),W.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))})`),Ct(e,W),e.intersect=function(P){return pt.polygon(e,_,P)},i}v(Nv,"multiWaveEdgedRectangle");async function Ev(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n,e.useHtmlLabels||ir(me())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(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=gt.svg(o),x=xt(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"),l.attr("class","label noteLabel"),p&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",p),i&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",i),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),Ct(e,y),e.intersect=function(C){return pt.rect(e,C)},o}v(Ev,"note");var mR=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 Bv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Bt(t,e,Et(e)),o=s.width+(e.padding??0),a=s.height+(e.padding??0),l=o+a,h=.5,u=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}];let d;const{cssStyles:f}=e;if(e.look==="handDrawn"){const p=gt.svg(i),m=xt(e,{}),x=mR(0,0,l),g=p.path(x,m);d=i.insert(()=>g,":first-child").attr("transform",`translate(${-l/2+h}, ${l/2})`),f&&d.attr("style",f)}else d=wn(i,l,l,u),d.attr("transform",`translate(${-l/2+h}, ${l/2})`);return n&&d.attr("style",n),Ct(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=pt.polygon(p,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(p){return this.calcIntersect(e,p)},i}v(Bv,"question");async function Lv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l,label:h}=await Bt(t,e,Et(e)),u=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s),d=((e==null?void 0:e.height)??l.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=gt.svg(a),C=xt(e,{});e.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const b=Ut(x),w=y.path(b,C),_=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-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),Ct(e,_),e.intersect=function(S){return pt.polygon(e,x,S)},a}v(Lv,"rect_left_inv_arrow");async function Av(t,e){const{labelStyles:r,nodeStyles:n}=bt(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),l=e.description,h=e.label,u=await Mn(a,h,e.labelStyle,!0,!0);let d={width:0,height:0};if(ir(Kt())){const A=u.children[0],L=Wt(u);d=A.getBoundingClientRect(),L.attr("width",d.width),L.attr("height",d.height)}it.info("Text 2",l);const f=l||[],p=u.getBBox(),m=await Mn(a,Array.isArray(f)?f.join("<br/>"):f,e.labelStyle,!0,!0),x=m.children[0],g=Wt(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;Wt(m).attr("transform","translate( "+(d.width>p.width?0:(p.width-d.width)/2)+", "+(p.height+y+5)+")"),Wt(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 C=d.width+(e.padding||0),b=d.height+(e.padding||0),w=-d.width/2-y,_=-d.height/2-y;let S,N;if(e.look==="handDrawn"){const A=gt.svg(s),L=xt(e,{}),j=A.path(Yn(w,_,C,b,e.rx||0),L),F=A.line(-d.width/2-y,-d.height/2-y+p.height+y,d.width/2+y,-d.height/2-y+p.height+y,L);N=s.insert(()=>(it.debug("Rough node insert CXC",j),F),":first-child"),S=s.insert(()=>(it.debug("Rough node insert CXC",j),j),":first-child")}else S=o.insert("rect",":first-child"),N=o.insert("line"),S.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)),N.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 Ct(e,S),e.intersect=function(A){return pt.rect(e,A)},s}v(Av,"rectWithTitle");async function Mv(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 Fs(t,e,i)}v(Mv,"roundedRect");var ti=8;async function Iv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l}=await Bt(t,e,Et(e)),h=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?ti:ti*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=h-ti,f=u,p=ti-h/2,m=-u/2,{cssStyles:x}=e,g=gt.svg(o),y=xt(e,{});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const C=[{x:p,y:m},{x:p+d,y:m},{x:p+d,y:m+f},{x:p-ti,y:m+f},{x:p-ti,y:m},{x:p,y:m},{x:p,y:m+f}],b=g.polygon(C.map(_=>[_.x,_.y]),y),w=o.insert(()=>b,":first-child");return w.attr("class","basic label-container outer-path").attr("style",Fe(x)),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),l.attr("transform",`translate(${ti/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),Ct(e,w),e.intersect=function(_){return pt.rect(e,_)},o}v(Iv,"shadedProcess");async function Fv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l,label:h}=await Bt(t,e,Et(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=((e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2)*1.5,f=u,p=d/1.5,m=-f/2,x=-p/2,{cssStyles:g}=e,y=gt.svg(a),C=xt(e,{});e.look!=="handDrawn"&&(C.roughness=0,C.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=Ut(b),_=y.path(w,C),S=a.insert(()=>_,":first-child");return S.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&S.selectChildren("path").attr("style",g),n&&e.look!=="handDrawn"&&S.selectChildren("path").attr("style",n),S.attr("transform",`translate(0, ${p/4})`),h.attr("transform",`translate(${-f/2+(e.padding??0)-(l.x-(l.left??0))}, ${-p/4+(e.padding??0)-(l.y-(l.top??0))})`),Ct(e,S),e.intersect=function(N){return pt.polygon(e,b,N)},a}v(Fv,"slopedRect");async function Dv(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 Fs(t,e,s)}v(Dv,"squareRect");async function Pv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?20:i,o=e.look==="neo"?12:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=l.height+(e.look==="neo"?o*2:o),u=l.width+h/4+(e.look==="neo"?s*2:s),d=h/2,{cssStyles:f}=e,p=gt.svg(a),m=xt(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},...Yo(-u/2+d,0,d,50,90,270),{x:u/2-d,y:h/2},...Yo(u/2-d,0,d,50,270,450)],g=Ut(x),y=p.path(g,m),C=a.insert(()=>y,":first-child");return C.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&C.selectChildren("path").attr("style",n),Ct(e,C),e.intersect=function(b){return pt.polygon(e,x,b)},a}v(Pv,"stadium");async function Ov(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return Fs(t,e,r)}v(Ov,"state");function $v(t,e,{config:{themeVariables:r}}){var C,b;const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n;const{cssStyles:s}=e,{lineColor:o,stateBorder:a,nodeBorder:l,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=gt.svg(u),f=xt(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??l,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=(C=t.node())==null?void 0:C.ownerSVGElement)==null?void 0:b.id)??"",_=w?`${w}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${_})`)}return Ct(e,y),e.intersect=function(w){return pt.circle(e,(e.width??0)/2,w)},u}v($v,"stateEnd");function Rv(t,e,{config:{themeVariables:r}}){var a,l;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=gt.svg(s).circle(0,0,e.width,SO(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=((l=(a=t.node())==null?void 0:a.ownerSVGElement)==null?void 0:l.id)??"",u=h?`${h}-drop-shadow-small`:"drop-shadow-small";o.attr("style",`filter:url(#${u})`)}return Ct(e,o),e.intersect=function(h){return pt.circle(e,(e.width??7)/2,h)},s}v(Rv,"stateStart");var Pi=8;async function zv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l}=await Bt(t,e,Et(e)),h=((e==null?void 0:e.width)??l.width)+2*Pi+s,u=((e==null?void 0:e.height)??l.height)+o,d=h-2*Pi,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=gt.svg(a),y=xt(e,{}),C=g.rectangle(p,m,d+16,f,y),b=g.line(p+Pi,m,p+Pi,m+f,y),w=g.line(p+Pi+d,m,p+Pi+d,m+f,y);a.insert(()=>b,":first-child"),a.insert(()=>w,":first-child");const _=a.insert(()=>C,":first-child"),{cssStyles:S}=e;_.attr("class","basic label-container").attr("style",Fe(S)),Ct(e,_)}else{const g=wn(a,d,f,x);n&&g.attr("style",n),Ct(e,g)}return e.intersect=function(g){return pt.polygon(e,x,g)},a}v(zv,"subroutine");var Lh=.2;async function Wv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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-Lh*(e.height+o*2),10));const{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2,u=Lh*h,d=Lh*h,p=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2+u-u,m=h,x=-p/2,g=-m/2,{cssStyles:y}=e,C=gt.svg(a),b=xt(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 S=Ut(w),N=C.path(S,b),A=Ut(_),L=C.path(A,{...b,fillStyle:"solid"}),j=a.insert(()=>L,":first-child");return j.insert(()=>N,":first-child"),j.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&j.selectAll("path").attr("style",n),Ct(e,j),e.intersect=function(F){return pt.polygon(e,w,F)},a}v(Wv,"taggedRect");async function qv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,Et(e)),a=Math.max(s.width+(e.padding??0)*2,(e==null?void 0:e.width)??0),l=Math.max(s.height+(e.padding??0)*2,(e==null?void 0:e.height)??0),h=l/8,u=.2*a,d=.2*l,f=l+h,{cssStyles:p}=e,m=gt.svg(i),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:f/2},...qn(-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,C=-f/2-d*.4,b=[{x:y+a-u,y:(C+l)*1.3},{x:y+a,y:C+l-d},{x:y+a,y:(C+l)*.9},...qn(y+a,(C+l)*1.25,y+a-u,(C+l)*1.3,-l*.02,.5)],w=Ut(g),_=m.path(w,x),S=Ut(b),N=m.path(S,{...x,fillStyle:"solid"}),A=i.insert(()=>N,":first-child");return A.insert(()=>_,":first-child"),A.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&A.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&A.selectAll("path").attr("style",n),A.attr("transform",`translate(0,${-h/2})`),o.attr("transform",`translate(${-a/2+(e.padding??0)-(s.x-(s.left??0))},${-l/2+(e.padding??0)-h/2-(s.y-(s.top??0))})`),Ct(e,A),e.intersect=function(L){return pt.polygon(e,g,L)},i}v(qv,"taggedWaveEdgedRectangle");async function Hv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Bt(t,e,Et(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),l=-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",l).attr("y",h).attr("width",o).attr("height",a),Ct(e,u),e.intersect=function(d){return pt.rect(e,d)},i}v(Hv,"text");var gR=v((t,e,r,n,i,s)=>`M${t},${e}
536
- a${i},${s} 0,0,1 0,${-n}
537
- l${r},0
538
- a${i},${s} 0,0,1 0,${n}
539
- M${r},${-n}
540
- a${i},${s} 0,0,0 0,${n}
541
- l${-r},0`,"createCylinderPathD"),xR=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"),yR=v((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),qg=5,Hg=10;async function Uv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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<qg&&(e.height=qg);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<Hg&&(e.width=Hg)}const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(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=gt.svg(o),g=xR(0,0,f,h,d,u),y=yR(0,0,f,h,d,u),C=x.path(g,xt(e,{})),b=x.path(y,xt(e,{fill:"none"}));m=o.insert(()=>b,":first-child"),m=o.insert(()=>C,":first-child"),m.attr("class","basic label-container"),p&&m.attr("style",p)}else{const x=gR(0,0,f,h,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",Fe(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} )`),l.attr("transform",`translate(${-(a.width/2)-d-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),Ct(e,m),e.intersect=function(x){const g=pt.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 C=d*d*(1-y*y/(u*u));C!=0&&(C=Math.sqrt(Math.abs(C))),C=d-C,x.x-(e.x??0)>0&&(C=-C),g.x+=C}return g},o}v(Uv,"tiltedCylinder");async function Yv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=(e.look==="neo",i),o=e.look==="neo"?i*2:i,{shapeSvg:a,bbox:l}=await Bt(t,e,Et(e)),h=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.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=gt.svg(a),x=xt(e,{}),g=Ut(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=wn(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,Ct(e,f),e.intersect=function(m){return pt.polygon(e,d,m)},a}v(Yv,"trapezoid");async function Gv(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=15,l=5;(e.width||e.height)&&(e.height=(e.height??0)-o*2,e.height<l&&(e.height=l),e.width=(e.width??0)-s*2,e.width<a&&(e.width=a));const{shapeSvg:h,bbox:u}=await Bt(t,e,Et(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=gt.svg(h),x=xt(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=Ut(g),C=m.path(y,x),b=h.insert(()=>C,":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),Ct(e,b),e.intersect=function(w){return pt.polygon(e,g,w)},h}v(Gv,"trapezoidalPentagon");var Ug=10,Yg=10;async function Vv(t,e){var w;const{labelStyles:r,nodeStyles:n}=bt(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<Yg&&(e.width=Yg),e.height=(e==null?void 0:e.height)??0,e.height<Ug&&(e.height=Ug));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(e)),h=kn((w=Kt().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=gt.svg(o),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Ut(p),C=x.path(y,g),b=o.insert(()=>C,":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,Ct(e,b),l.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 it.info("Triangle intersect",e,p,_),pt.polygon(e,p,_)},o}v(Vv,"triangle");async function Xv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l,bbox:h,label:u}=await Bt(t,e,Et(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,C=y>0?y/2:0,b=gt.svg(l),w=xt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const _=[{x:-d/2-C,y:m/2},...qn(-d/2-C,m/2,d/2+C,m/2,p,.8),{x:d/2+C,y:-m/2},{x:-d/2-C,y:-m/2}],S=Ut(_),N=b.path(S,w),A=l.insert(()=>N,":first-child");return A.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&A.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&A.selectAll("path").attr("style",n),A.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))})`),Ct(e,A),e.intersect=function(L){return pt.polygon(e,_,L)},l}v(Xv,"waveEdgedRectangle");async function Kv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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:l}=await Bt(t,e,Et(e)),h=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,u=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o,d=u/8,f=u+d*2,{cssStyles:p}=e,m=gt.svg(a),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-h/2,y:f/2},...qn(-h/2,f/2,h/2,f/2,d,1),{x:h/2,y:-f/2},...qn(h/2,-f/2,-h/2,-f/2,d,-1)],y=Ut(g),C=m.path(y,x),b=a.insert(()=>C,":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),Ct(e,b),e.intersect=function(w){return pt.polygon(e,g,w)},a}v(Kv,"waveRectangle");var ge=10;async function Qv(t,e){const{labelStyles:r,nodeStyles:n}=bt(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-ge,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-ge,10));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,Et(e)),h=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+ge,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+ge,d=h-ge,f=u-ge,p=-d/2,m=-f/2,{cssStyles:x}=e,g=gt.svg(o),y=xt(e,{}),C=[{x:p-ge,y:m-ge},{x:p-ge,y:m+f},{x:p+d,y:m+f},{x:p+d,y:m-ge}],b=`M${p-ge},${m-ge} L${p+d},${m-ge} L${p+d},${m+f} L${p-ge},${m+f} L${p-ge},${m-ge}
542
- M${p-ge},${m} L${p+d},${m}
543
- M${p},${m-ge} 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(${ge/2}, ${ge/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),l.attr("transform",`translate(${-(a.width/2)+ge/2-(a.x-(a.left??0))}, ${-(a.height/2)+ge/2-(a.y-(a.top??0))})`),Ct(e,_),e.intersect=function(S){return pt.polygon(e,C,S)},o}v(Qv,"windowPane");var Gg=new Set(["redux-color","redux-dark-color"]),bR=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function Jp(t,e){var ct,Ft,_t,lt;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=me(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:Y}=me(),{background:ot}=Y,kt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${ot}`]};await Jp(t,kt)}const h=me();e.useHtmlLabels=h.htmlLabels;let u=((ct=h.er)==null?void 0:ct.diagramPadding)??10,d=((Ft=h.er)==null?void 0:Ft.entityPadding)??6;const{cssStyles:f}=e,{labelStyles:p,nodeStyles:m}=bt(e);if(r.attributes.length===0&&e.label){const Y={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};xn(e.label,h)+Y.labelPaddingX*2<h.er.minEntityWidth&&(e.width=h.er.minEntityWidth);const ot=await Fs(t,e,Y);if(n!=null&&Gg.has(n)){const kt=r.colorIndex??0;ot.attr("data-color-id",`color-${kt%l.length}`)}if(!kn(h.htmlLabels)){const kt=ot.select("text"),Tt=(_t=kt.node())==null?void 0:_t.getBBox();kt.attr("transform",`translate(${-Tt.width/2}, 0)`)}return ot}h.htmlLabels||(u*=1.25,d*=1.25);let x=Et(e);x||(x="node default");const g=t.insert("g").attr("class",x).attr("id",e.domId||e.id),y=await Ui(g,e.label??"",h,0,0,["name"],p);y.height+=d;let C=0;const b=[],w=[];let _=0,S=0,N=0,A=0,L=!0,j=!0;for(const Y of r.attributes){const ot=await Ui(g,Y.type,h,0,C,["attribute-type"],p);_=Math.max(_,ot.width+u);const kt=await Ui(g,Y.name,h,0,C,["attribute-name"],p);S=Math.max(S,kt.width+u);const Tt=await Ui(g,Y.keys.join(),h,0,C,["attribute-keys"],p);N=Math.max(N,Tt.width+u);const ee=await Ui(g,Y.comment,h,0,C,["attribute-comment"],p);A=Math.max(A,ee.width+u);const le=Math.max(ot.height,kt.height,Tt.height,ee.height)+d;w.push({yOffset:C,rowHeight:le}),C+=le}let F=4;N<=u&&(L=!1,N=0,F--),A<=u&&(j=!1,A=0,F--);const z=g.node().getBBox();if(y.width+u*2-(_+S+N+A)>0){const Y=y.width+u*2-(_+S+N+A);_+=Y/F,S+=Y/F,N>0&&(N+=Y/F),A>0&&(A+=Y/F)}const W=_+S+N+A,P=gt.svg(g),I=xt(e,{});e.look!=="handDrawn"&&(I.roughness=0,I.fillStyle="solid");let M=0;w.length>0&&(M=w.reduce((Y,ot)=>Y+((ot==null?void 0:ot.rowHeight)??0),0));const O=Math.max(z.width+u*2,(e==null?void 0:e.width)||0,W),$=Math.max((M??0)+y.height,(e==null?void 0:e.height)||0),B=-O/2,T=-$/2;if(g.selectAll("g:not(:first-child)").each((Y,ot,kt)=>{const Tt=Wt(kt[ot]),ee=Tt.attr("transform");let le=0,Zt=0;if(ee){const Xt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(ee);Xt&&(le=parseFloat(Xt[1]),Zt=parseFloat(Xt[2]),Tt.attr("class").includes("attribute-name")?le+=_:Tt.attr("class").includes("attribute-keys")?le+=_+S:Tt.attr("class").includes("attribute-comment")&&(le+=_+S+N))}Tt.attr("transform",`translate(${B+u/2+le}, ${Zt+T+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(T+d/2)+")"),n!=null&&Gg.has(n)){const Y=r.colorIndex??0;g.attr("data-color-id",`color-${Y%l.length}`)}const G=P.rectangle(B,T,O,$,I),tt=g.insert(()=>G,":first-child").attr("class","outer-path").attr("style",f.join(""));b.push(0);for(const[Y,ot]of w.entries()){const Tt=(Y+1)%2===0&&ot.yOffset!==0,ee=P.rectangle(B,y.height+T+(ot==null?void 0:ot.yOffset),O,ot==null?void 0:ot.rowHeight,{...I,fill:Tt?s:o,stroke:a});g.insert(()=>ee,"g.label").attr("style",f.join("")).attr("class",`row-rect-${Tt?"even":"odd"}`)}const D=1e-4;let V=Yi(B,y.height+T,O+B,y.height+T,D),ht=P.polygon(V.map(Y=>[Y.x,Y.y]),I);if(g.insert(()=>ht).attr("class","divider"),V=Yi(_+B,y.height+T,_+B,$+T,D),ht=P.polygon(V.map(Y=>[Y.x,Y.y]),I),g.insert(()=>ht).attr("class","divider"),L){const Y=_+S+B;V=Yi(Y,y.height+T,Y,$+T,D),ht=P.polygon(V.map(ot=>[ot.x,ot.y]),I),g.insert(()=>ht).attr("class","divider")}if(j){const Y=_+S+N+B;V=Yi(Y,y.height+T,Y,$+T,D),ht=P.polygon(V.map(ot=>[ot.x,ot.y]),I),g.insert(()=>ht).attr("class","divider")}for(const Y of b){const ot=y.height+T+Y;V=Yi(B,ot,O+B,ot,D),ht=P.polygon(V.map(kt=>[kt.x,kt.y]),I),g.insert(()=>ht).attr("class","divider")}if(Ct(e,tt),m&&e.look!=="handDrawn")if(n!=null&&bR.has(n))g.selectAll("path").attr("style",m);else{const Y=m.split(";"),ot=(lt=Y==null?void 0:Y.filter(kt=>kt.includes("stroke")))==null?void 0:lt.map(kt=>`${kt}`).join("; ");g.selectAll("path").attr("style",ot??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(Y){return pt.rect(e,Y)},g}v(Jp,"erBox");async function Ui(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!==Pm(e)&&(e=Pm(e),e=e.replaceAll("<","&lt;").replaceAll(">","&gt;"));const l=a.node().appendChild(await vn(a,e,{width:xn(e,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(e.includes("&lt;")||e.includes("&gt;")){let u=l.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=l.getBBox();if(kn(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const d=Wt(l);h=u.getBoundingClientRect(),d.attr("width",h.width),d.attr("height",h.height)}return h}v(Ui,"addText");function Yi(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(Yi,"lineToPolygon");async function Zv(t,e,r,n,i=r.class.padding??12){const s=n?0:3,o=t.insert("g").attr("class",Et(e)).attr("id",e.domId||e.id);let a=null,l=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 C=e.annotations[0];await Co(a,{text:`«${C}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await Co(l,e,0,["font-weight: bolder"]);const m=l.node().getBBox();f=m.height,h=o.insert("g").attr("class","members-group text");let x=0;for(const C of e.members){const b=await Co(h,C,x,[C.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 C of e.methods){const b=await Co(u,C,g,[C.parseClassifier()]);g+=b+s}let y=o.node().getBBox();if(a!==null){const C=a.node().getBBox();a.attr("transform",`translate(${-C.width/2})`)}return l.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(Zv,"textHelper");async function Co(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:kn(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),Po(a)&&(o=!0);const l=await vn(i,lp(Ci(a)),{width:xn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let h,u=1;if(o){const d=l.children[0],f=Wt(l);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 C;if(x.style.display="flex",x.style.flexDirection="column",m){const b=((C=s.fontSize)==null?void 0:C.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")&&Wt(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const d=l.children[0];(l.textContent===""||l.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=l.getBBox()}return i.attr("transform","translate(0,"+(-h.height/(2*u)+r)+")"),h.height}v(Co,"addText");async function Jv(t,e){var P,I;const r=Kt(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??kn(r.htmlLabels)??!0,l=e;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];const{shapeSvg:h,bbox:u}=await Zv(t,e,r,a,o),{labelStyles:d,nodeStyles:f}=bt(e);e.labelStyle=d,e.cssStyles=l.styles||"";const p=((P=l.styles)==null?void 0:P.join(";"))||f||"";e.cssStyles||(e.cssStyles=p.replaceAll("!important","").split(";"));const m=l.members.length===0&&l.methods.length===0&&!((I=r.class)!=null&&I.hideEmptyMembersBox),x=gt.svg(h),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Math.max(e.width??0,u.width);let C=Math.max(e.height??0,u.height);const b=(e.height??0)>u.height;l.members.length===0&&l.methods.length===0?C+=o:l.members.length>0&&l.methods.length===0&&(C+=o*2);const w=-y/2,_=-C/2;let S=m?s*2:l.members.length===0&&l.methods.length===0?-s:0;b&&(S=s*2);const N=x.rectangle(w-s,_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0),y+2*s,C+2*s+S,g),A=h.insert(()=>N,":first-child");A.attr("class","basic label-container outer-path");const L=A.node().getBBox(),j=h.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,F=h.select(".label-group").node().getBBox().height-(m?s/2:0)||0,z=h.select(".members-group").node().getBBox().height-(m?s/2:0)||0,W=(j+F+_+s-(_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(h.selectAll(".text").each((M,O,$)=>{var V,ht;const B=Wt($[O]),T=B.attr("transform");let G=0;if(T){const Ft=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(T);Ft&&(G=parseFloat(Ft[2]))}let tt=G+_+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(B.attr("class").includes("methods-group")){const ct=Math.max(z,o/2);b?tt=Math.max(W,j+F+ct+_+o*2+s)+o*2:tt=j+F+ct+_+o*4+s}l.members.length===0&&l.methods.length===0&&((V=r.class)!=null&&V.hideEmptyMembersBox)&&(l.annotations.length>0?tt=G-o:tt=G),a||(tt-=4);let D=w;(B.attr("class").includes("label-group")||B.attr("class").includes("annotation-group"))&&(D=-((ht=B.node())==null?void 0:ht.getBBox().width)/2||0,h.selectAll("text").each(function(ct,Ft,_t){window.getComputedStyle(_t[Ft]).textAnchor==="middle"&&(D=0)})),B.attr("transform",`translate(${D}, ${tt})`)}),l.members.length>0||l.methods.length>0||m){const M=j+F+_+s,O=x.line(L.x,M,L.x+L.width,M+.001,g);h.insert(()=>O).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(m||l.members.length>0||l.methods.length>0){const M=j+F+z+_+o*2+s,O=x.line(L.x,b?Math.max(W,M):M,L.x+L.width,(b?Math.max(W,M):M)+.001,g);h.insert(()=>O).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",p)}if(l.look!=="handDrawn"&&h.selectAll("path").attr("style",p),A.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 M=RegExp(/color\s*:\s*([^;]*)/),O=M.exec(p);if(O){const $=O[0].replace("color","fill");h.selectAll("tspan").attr("style",$)}else if(d){const $=M.exec(d);if($){const B=$[0].replace("color","fill");h.selectAll("tspan").attr("style",B)}}}return Ct(e,A),e.intersect=function(M){return pt.rect(e,M)},h}v(Jv,"classBox");async function tw(t,e){var L,j;const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,h=Et(e),{themeVariables:u}=Kt(),{borderColorArray:d,requirementEdgeLabelBackground:f}=u,p=t.insert("g").attr("class",h).attr("id",e.domId??e.id);let m;l?m=await Vr(p,`&lt;&lt;${i.type}&gt;&gt;`,0,e.labelStyle):m=await Vr(p,"&lt;&lt;Element&gt;&gt;",0,e.labelStyle);let x=m;const g=await Vr(p,i.name,x,e.labelStyle+"; font-weight: bold;");if(x+=g+a,l){const F=await Vr(p,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=F;const z=await Vr(p,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=z;const W=await Vr(p,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=W,await Vr(p,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const F=await Vr(p,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=F,await Vr(p,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((L=p.node())==null?void 0:L.getBBox().width)??200)+o,C=(((j=p.node())==null?void 0:j.getBBox().height)??200)+o,b=-y/2,w=-C/2,_=gt.svg(p),S=xt(e,{});e.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const N=_.rectangle(b,w,y,C,S),A=p.insert(()=>N,":first-child");if(A.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const F=e.colorIndex??0;p.attr("data-color-id",`color-${F%d.length}`)}if(p.selectAll(".label").each((F,z,W)=>{const P=Wt(W[z]),I=P.attr("transform");let M=0,O=0;if(I){const G=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(I);G&&(M=parseFloat(G[1]),O=parseFloat(G[2]))}const $=O-C/2;let B=b+o/2;(z===0||z===1)&&(B=M),P.attr("transform",`translate(${B}, ${$+o})`)}),x>m+g+a){const F=w+m+g+a;let z;if(e.look==="neo"){const I=[[b,F],[b+y,F],[b+y,F+.001],[b,F+.001]];z=_.polygon(I,S)}else z=_.line(b,F,b+y,F,S);p.insert(()=>z).attr("class","divider")}return Ct(e,A),e.intersect=function(F){return pt.rect(e,F)},n&&e.look!=="handDrawn"&&(f||d!=null&&d.length)&&p.selectAll("path").attr("style",n),p}v(tw,"requirementBox");async function Vr(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=Kt(),o=s.htmlLabels??!0,a=await vn(i,lp(Ci(e)),{width:xn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let l;if(o){const h=a.children[0],u=Wt(a);l=h.getBoundingClientRect(),u.attr("width",l.width),u.attr("height",l.height)}else{const h=a.children[0];for(const u of h.children)n&&u.setAttribute("style",n);l=a.getBBox(),l.height+=6}return i.attr("transform",`translate(${-l.width/2},${-l.height/2+r})`),l.height}v(Vr,"addText");var CR=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 ew(t,e,{config:r}){var z,W;const{labelStyles:n,nodeStyles:i}=bt(e);e.labelStyle=n||"";const s=10,o=e.width;e.width=(e.width??200)-10;const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,Et(e)),u=e.padding||10;let d="",f;"ticket"in e&&e.ticket&&((z=r==null?void 0:r.kanban)!=null&&z.ticketBaseUrl)&&(d=(W=r==null?void 0:r.kanban)==null?void 0:W.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 Bh(f,"ticket"in e&&e.ticket||"",p):{label:m,bbox:x}=await Bh(a,"ticket"in e&&e.ticket||"",p);const{label:g,bbox:y}=await Bh(a,"assigned"in e&&e.assigned||"",p);e.width=o;const C=10,b=(e==null?void 0:e.width)||0,w=Math.max(x.height,y.height)/2,_=Math.max(l.height+C*2,(e==null?void 0:e.height)||0)+w,S=-b/2,N=-_/2;h.attr("transform","translate("+(u-b/2)+", "+(-w-l.height/2)+")"),m.attr("transform","translate("+(u-b/2)+", "+(-w+l.height/2)+")"),g.attr("transform","translate("+(u+b/2-y.width-2*s)+", "+(-w+l.height/2)+")");let A;const{rx:L,ry:j}=e,{cssStyles:F}=e;if(e.look==="handDrawn"){const P=gt.svg(a),I=xt(e,{}),M=L||j?P.path(Yn(S,N,b,_,L||0),I):P.rectangle(S,N,b,_,I);A=a.insert(()=>M,":first-child"),A.attr("class","basic label-container").attr("style",F||null)}else{A=a.insert("rect",":first-child"),A.attr("class","basic label-container __APA__").attr("style",i).attr("rx",L??5).attr("ry",j??5).attr("x",S).attr("y",N).attr("width",b).attr("height",_);const P="priority"in e&&e.priority;if(P){const I=a.append("line"),M=S+2,O=N+Math.floor((L??0)/2),$=N+_-Math.floor((L??0)/2);I.attr("x1",M).attr("y1",O).attr("x2",M).attr("y2",$).attr("stroke-width","4").attr("stroke",CR(P))}}return Ct(e,A),e.height=_,e.intersect=function(P){return pt.rect(e,P)},a}v(ew,"kanbanItem");async function rw(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,Et(e)),l=s.width+10*o,h=s.height+8*o,u=.15*l,{cssStyles:d}=e,f=s.width+20,p=s.height+20,m=Math.max(l,f),x=Math.max(h,p);a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let g;const y=`M0 0
544
- a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
545
- a${u},${u} 1 0,0 ${m*.25},0
546
- a${u},${u} 1 0,0 ${m*.25},0
547
- a${u},${u} 1 0,0 ${m*.25},${x*.1}
548
-
549
- a${u},${u} 1 0,0 ${m*.15},${x*.33}
550
- a${u*.8},${u*.8} 1 0,0 0,${x*.34}
551
- a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
552
-
553
- a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
554
- a${u},${u} 1 0,0 ${-1*m*.25},0
555
- a${u},${u} 1 0,0 ${-1*m*.25},0
556
- a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
557
-
558
- a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
559
- a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
560
- a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
561
- H0 V0 Z`;if(e.look==="handDrawn"){const C=gt.svg(i),b=xt(e,{}),w=C.path(y,b);g=i.insert(()=>w,":first-child"),g.attr("class","basic label-container").attr("style",Fe(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})`),Ct(e,g),e.calcIntersect=function(C,b){return pt.rect(C,b)},e.intersect=function(C){return it.info("Bang intersect",e,C),pt.rect(e,C)},i}v(rw,"bang");async function nw(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,Et(e)),l=s.width+2*o,h=s.height+2*o,u=.15*l,d=.25*l,f=.35*l,p=.2*l,{cssStyles:m}=e;let x;const g=`M0 0
562
- a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
563
- a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
564
- a${d},${d} 1 0,1 ${l*.35},${l*.2}
565
-
566
- a${u},${u} 1 0,1 ${l*.15},${h*.35}
567
- a${p},${p} 1 0,1 ${-1*l*.15},${h*.65}
568
-
569
- a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
570
- a${f},${f} 1 0,1 ${-1*l*.5},0
571
- a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
572
-
573
- a${u},${u} 1 0,1 ${-1*l*.1},${-1*h*.35}
574
- a${p},${p} 1 0,1 ${l*.1},${-1*h*.65}
575
- H0 V0 Z`;if(e.look==="handDrawn"){const y=gt.svg(i),C=xt(e,{}),b=y.path(g,C);x=i.insert(()=>b,":first-child"),x.attr("class","basic label-container").attr("style",Fe(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(${-l/2}, ${-h/2})`),Ct(e,x),e.calcIntersect=function(y,C){return pt.rect(y,C)},e.intersect=function(y){return it.info("Cloud intersect",e,y),pt.rect(e,y)},i}v(nw,"cloud");async function iw(t,e){const{labelStyles:r,nodeStyles:n}=bt(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,Et(e)),l=s.width+8*o,h=s.height+2*o,u=5,d=e.look==="neo"?`
576
- M${-l/2} ${h/2-u}
577
- v${-h+2*u}
578
- q0,-${u} ${u},-${u}
579
- h${l-2*u}
580
- q${u},0 ${u},${u}
581
- v${h-u}
582
- H${-l/2}
583
- Z
584
- `:`
585
- M${-l/2} ${h/2-u}
586
- v${-h+2*u}
587
- q0,-${u} ${u},-${u}
588
- h${l-2*u}
589
- q${u},0 ${u},${u}
590
- v${h-2*u}
591
- q0,${u} ${-u},${u}
592
- h${-(l-2*u)}
593
- q${-u},0 ${-u},${-u}
594
- Z
595
- `;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",-l/2).attr("y1",h/2).attr("x2",l/2).attr("y2",h/2),a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),i.append(()=>a.node()),Ct(e,f),e.calcIntersect=function(p,m){return pt.rect(p,m)},e.intersect=function(p){return pt.rect(e,p)},i}v(iw,"defaultMindmapNode");async function sw(t,e){const r={padding:e.padding??0};return Zp(t,e,r)}v(sw,"mindmapCircle");var kR=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Dv},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Mv},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Pv},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:zv},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:sv},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:ov},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Zp},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:rw},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:nw},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Bv},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:pv},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:wv},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:vv},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Yv},{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:Cv},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:lv},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Hv},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Qk},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Iv},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Rv},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:$v},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:uv},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:fv},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:ev},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:rv},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:nv},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Sv},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:Xv},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:dv},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:Uv},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:Tv},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:iv},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:av},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Vv},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:Qv},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:cv},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Gv},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:hv},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Fv},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Nv},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:jv},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Kk},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:tv},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:qv},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Wv},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Kv},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Lv},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:_v}],vR=v(()=>{const e=[...Object.entries({state:Ov,choice:Zk,note:Ev,rectWithTitle:Av,labelRect:kv,iconSquare:yv,iconCircle:gv,icon:mv,iconRounded:xv,imageSquare:bv,anchor:Vk,kanbanItem:ew,mindmapCircle:sw,defaultMindmapNode:iw,classBox:Jv,erBox:Jp,requirementBox:tw}),...kR.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),ow=vR();function wR(t){return t in ow}v(wR,"isValidShape");var Bc=new Map;async function aw(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?ow[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",Fe(e.look)),e.tooltip&&i.attr("title",e.tooltip),Bc.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(aw,"insertNode");var RY=v((t,e)=>{Bc.set(e.id,t)},"setNodeElem"),zY=v(()=>{Bc.clear()},"clear"),WY=v(t=>{const e=Bc.get(t.id);it.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"),SR=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&Vg(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&Vg(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),TR={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}},_R=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],Vg=v((t,e,r,n,i,s,o=!1,a)=>{var m;const l=TR[r],h=l&&_R.includes(l.type);if(!l){it.warn(`Unknown arrow type: ${r}`);return}const u=l.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 C=y.cloneNode(!0);C.id=g,C.querySelectorAll("path, circle, line").forEach(w=>{w.setAttribute("stroke",a),l.fill&&w.setAttribute("fill",a)}),(m=y.parentNode)==null||m.appendChild(C)}}t.attr(`marker-${e}`,`url(${n}#${g})`)}else t.attr(`marker-${e}`,`url(${n}#${p})`)},"addEdgeMarker"),jR=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=Kt())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),Ql=new Map,Oe=new Map,qY=v(()=>{Ql.clear(),Oe.clear()},"clear"),so=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),NR=v(async(t,e)=>{const r=Kt();let n=ir(r);const{labelStyles:i}=bt(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 vn(t,e.label,{style:so(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(h),it.info("abc82",e,e.labelType);let u=h.getBBox(),d=u;if(n){const p=h.children[0],m=Wt(h);u=p.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const p=Wt(h).select("text").node();p&&typeof p.getBBox=="function"&&(d=p.getBBox())}o.attr("transform",to(d,n)),Ql.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 Mn(m,e.startLabelLeft,so(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Wt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",to(g,n)),Oe.get(e.id)||Oe.set(e.id,{}),Oe.get(e.id).startLeft=p,ko(f,e.startLabelLeft)}if(e.startLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Mn(m,e.startLabelRight,so(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Wt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",to(g,n)),Oe.get(e.id)||Oe.set(e.id,{}),Oe.get(e.id).startRight=p,ko(f,e.startLabelRight)}if(e.endLabelLeft){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Mn(p,e.endLabelLeft,so(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Wt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",to(g,n)),Oe.get(e.id)||Oe.set(e.id,{}),Oe.get(e.id).endLeft=p,ko(f,e.endLabelLeft)}if(e.endLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Mn(p,e.endLabelRight,so(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=Wt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",to(g,n)),Oe.get(e.id)||Oe.set(e.id,{}),Oe.get(e.id).endRight=p,ko(f,e.endLabelRight)}return h},"insertEdgeLabel");function ko(t,e){ir(Kt())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v(ko,"setTerminalWidth");var ER=v((t,e)=>{it.debug("Moving label abc88 ",t.id,t.label,Ql.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=Kt(),{subGraphTitleTotalMargin:i}=$p(n);if(t.label){const s=Ql.get(t.id);let o=t.x,a=t.y;if(r){const l=Pr.calcLabelPosition(r);it.debug("Moving label "+t.label+" from (",o,",",a,") to (",l.x,",",l.y,") abc88"),e.updatedPath&&(o=l.x,a=l.y)}s.attr("transform",`translate(${o}, ${a+i/2})`)}if(t.startLabelLeft){const s=Oe.get(t.id).startLeft;let o=t.x,a=t.y;if(r){const l=Pr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.startLabelRight){const s=Oe.get(t.id).startRight;let o=t.x,a=t.y;if(r){const l=Pr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelLeft){const s=Oe.get(t.id).endLeft;let o=t.x,a=t.y;if(r){const l=Pr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelRight){const s=Oe.get(t.id).endRight;let o=t.x,a=t.y;if(r){const l=Pr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}},"positionEdgeLabel"),BR=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"),LR=v((t,e,r)=>{it.debug(`intersection calc abc89:
596
- outsidePoint: ${JSON.stringify(e)}
597
- insidePoint : ${JSON.stringify(r)}
598
- 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 l=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)*l){let d=r.y<e.y?e.y-l-i:i-l-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),it.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 it.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"),Xg=v((t,e)=>{it.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(it.info("abc88 checking point",s,e),!BR(e,s)&&!i){const o=LR(e,n,s);it.debug("abc88 inside",s,n,o),it.debug("abc88 intersection",o,e);let a=!1;r.forEach(l=>{a=a||l.x===o.x&&l.y===o.y}),r.some(l=>l.x===o.x&&l.y===o.y)?it.warn("abc88 no intersect",o,r):r.push(o),i=!0}else it.warn("abc88 outside",s,n),n=s,i||r.push(s)}),it.debug("returning points",r),r},"cutPathAtIntersect");function lw(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(lw,"extractCornerPoints");var Kg=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"),AR=v(function(t){const{cornerPointPositions:e}=lw(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=Kg(i,o,5),l=Kg(s,o,5),h=l.x-a.x,u=l.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){it.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 it.debug("Corner point skipping fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));r.push(f,l)}else r.push(t[n]);return r},"fixCorners"),MR=v((t,e,r)=>{const n=t-e-r,i=2,s=2,o=i+s,a=Math.floor(n/o),l=Array(a).fill(`${i} ${s}`).join(" ");return`0 ${e} ${l} ${r}`},"generateDashArray"),IR=v(function(t,e,r,n,i,s,o,a=!1){var O;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:l}=Kt();let h=e.points,u=!1;const d=i;var f=s;const p=[];for(const $ in e.cssCompiledStyles)ok($)||p.push(e.cssCompiledStyles[$]);it.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])),it.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&&(it.info("to cluster abc88",r.get(e.toCluster)),h=Xg(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(it.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(h,null,2)),h=Xg(h.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=h.filter($=>!Number.isNaN($.y));const g=jR(e.curve);g!=="rounded"&&(x=AR(x));let y=Eo;switch(g){case"linear":y=Eo;break;case"basis":y=Tu;break;case"cardinal":y=Vb;break;case"bumpX":y=qb;break;case"bumpY":y=Hb;break;case"catmullRom":y=Kb;break;case"monotoneX":y=r1;break;case"monotoneY":y=n1;break;case"natural":y=s1;break;case"step":y=o1;break;case"stepAfter":y=l1;break;case"stepBefore":y=a1;break;case"rounded":y=Eo;break;default:y=Tu}const{x:C,y:b}=jP(e),w=hD().x(C).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 S,N=g==="rounded"?cw(hw(x,e),5):w(x);const A=Array.isArray(e.style)?e.style:[e.style];let L=A.find($=>$==null?void 0:$.startsWith("stroke:")),j="";e.animate&&(j="edge-animation-fast"),e.animation&&(j="edge-animation-"+e.animation);let F=!1;if(e.look==="handDrawn"){const $=gt.svg(t);Object.assign([],x);const B=$.path(N,{roughness:.3,seed:l});_+=" transition",S=Wt(B).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(j?" "+j:"")).attr("style",A?A.reduce((G,tt)=>G+";"+tt,""):"");let T=S.attr("d");S.attr("d",T),t.node().appendChild(S.node())}else{const $=p.join(";"),B=A?A.reduce((ht,ct)=>ht+ct+";",""):"",T=($?$+";"+B+";":B)+";"+(A?A.reduce((ht,ct)=>ht+";"+ct,""):"");S=t.append("path").attr("d",N).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(j?" "+j:"")).attr("style",T),L=(O=T.match(/stroke:([^;]+)/))==null?void 0:O[1],F=e.animate===!0||!!e.animation||$.includes("animation");const G=S.node(),tt=typeof G.getTotalLength=="function"?G.getTotalLength():0,D=hg[e.arrowTypeStart]||0,V=hg[e.arrowTypeEnd]||0;if(e.look==="neo"&&!F){const ct=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?MR(tt,D,V):`0 ${D} ${tt-D-V} ${V}`}; stroke-dashoffset: 0;`;S.attr("style",ct+S.attr("style"))}}S.attr("data-edge",!0),S.attr("data-et","edge"),S.attr("data-id",e.id),S.attr("data-points",m),S.attr("data-look",Fe(e.look)),e.showPoints&&x.forEach($=>{t.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",$.x).attr("cy",$.y)});let z="";(Kt().flowchart.arrowMarkerAbsolute||Kt().state.arrowMarkerAbsolute)&&(z=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,z=z.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),it.info("arrowTypeStart",e.arrowTypeStart),it.info("arrowTypeEnd",e.arrowTypeEnd);const W=!F&&(e==null?void 0:e.look)==="neo";SR(S,e,z,o,n,W,L);const P=Math.floor(h.length/2),I=h[P];Pr.isLabelCoordinateInPath(I,S.attr("d"))||(u=!0);let M={};return u&&(M.updatedPath=h),M.originalPath=e.points,M},"insertEdge");function cw(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],l=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=l.x-o.x,f=l.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,C=f/m,b=x*y+g*C,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 S=Math.min(e/Math.sin(_/2),p/2,m/2),N=o.x-x*S,A=o.y-g*S,L=o.x+y*S,j=o.y+C*S;r+=`L${N},${A}`,r+=`Q${o.x},${o.y} ${L},${j}`}}return r}v(cw,"generateRoundedPath");function ed(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(ed,"calculateDeltaAndAngle");function hw(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&qe[e.arrowTypeStart]){const i=qe[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=ed(s,o),l=i*Math.cos(a),h=i*Math.sin(a);r[0].x=s.x+l,r[0].y=s.y+h}const n=t.length;if(n>=2&&qe[e.arrowTypeEnd]){const i=qe[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=ed(o,s),l=i*Math.cos(a),h=i*Math.sin(a);r[n-1].x=s.x-l,r[n-1].y=s.y-h}return r}v(hw,"applyMarkerOffsetsToPoints");var FR=v((t,e,r,n)=>{e.forEach(i=>{i6[i](t,r,n)})},"insertMarkers"),DR=v((t,e,r)=>{it.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",20).attr("markerHeight",28).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"),PR=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"),OR=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"),$R=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"),RR=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"),zR=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"),WR=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"),qR=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"),HR=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"),UR=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"),YR=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"),GR=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"),VR=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"),XR=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"),KR=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"),QR=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 l=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");l.append("circle").attr("fill",o??"white").attr("cx",9).attr("cy",9).attr("stroke-width",`${s}`).attr("r",6),l.append("path").attr("d","M21,0 L21,18").attr("stroke-width",`${s}`)},"zero_or_one_neo"),ZR=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"),JR=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 l=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");l.append("circle").attr("fill",o??"white").attr("cx",11).attr("cy",18).attr("r",6).attr("stroke-width",`${s}`),l.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width",`${s}`)},"zero_or_more_neo"),t6=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
599
- L20,10
600
- M20,10
601
- L0,20`)},"requirement_arrow"),e6=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
602
- L20,10
603
- M20,10
604
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),r6=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"),n6=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"),i6={extension:DR,composition:PR,aggregation:OR,dependency:$R,lollipop:RR,point:zR,circle:WR,cross:qR,barb:HR,barbNeo:UR,only_one:YR,zero_or_one:GR,one_or_more:VR,zero_or_more:XR,only_one_neo:KR,zero_or_one_neo:QR,one_or_more_neo:ZR,zero_or_more_neo:JR,requirement_arrow:t6,requirement_contains:r6,requirement_arrow_neo:e6,requirement_contains_neo:n6},s6=FR,o6={common:na,getConfig:me,insertCluster:nR,insertEdge:IR,insertEdgeLabel:NR,insertMarkers:s6,insertNode:aw,interpolateToCurve:Mp,labelHelper:Bt,log:it,positionEdgeLabel:ER},Go={},uw=v(t=>{for(const e of t)Go[e.name]=e},"registerLayoutLoaders"),a6=v(()=>{uw([{name:"dagre",loader:v(async()=>await Yt(()=>import("./dagre-BM42HDAG-DBwRZbPz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Yt(()=>import("./cose-bilkent-S5V4N54A-BC5rkVLI.js"),__vite__mapDeps([8,7,3,4,5,6])),"loader")}])},"registerDefaultLayoutLoaders");a6();var HY=v(async(t,e)=>{if(!(t.layoutAlgorithm in Go))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=Go[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:l}=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",l).attr("stop-opacity",1)}return n.render(t,e,o6,{algorithm:r.algorithm})},"render"),UY=v((t="",{fallback:e="dagre"}={})=>{if(t in Go)return t;if(e in Go)return it.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"),tf="comm",dw="rule",pw="decl",l6="@media",c6="@import",h6="@supports",u6="@namespace",rd="@keyframes",fw="@layer",d6="@scope",p6=Math.abs,Lo=String.fromCharCode;function mw(t){return t.trim()}function nd(t,e,r){return t.replace(e,r)}function ts(t,e){return t.charCodeAt(e)|0}function Ts(t,e,r){return t.slice(e,r)}function Kr(t){return t.length}function gw(t){return t.length}function Pa(t,e){return e.push(t),t}var Lc=1,_s=1,xw=0,Nr=0,Te=0,Ds="";function ef(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:Lc,column:_s,length:o,return:"",siblings:a}}function f6(){return Te}function m6(){return Te=Nr>0?ts(Ds,--Nr):0,_s--,Te===10&&(_s=1,Lc--),Te}function Rr(){return Te=Nr<xw?ts(Ds,Nr++):0,_s++,Te===10&&(_s=1,Lc++),Te}function In(){return ts(Ds,Nr)}function al(){return Nr}function Ac(t,e){return Ts(Ds,t,e)}function Vo(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 g6(t){return Lc=_s=1,xw=Kr(Ds=t),Nr=0,[]}function x6(t){return Ds="",t}function Ah(t){return mw(Ac(Nr-1,id(t===91?t+2:t===40?t+1:t)))}function y6(t){for(;(Te=In())&&Te<33;)Rr();return Vo(t)>2||Vo(Te)>3?"":" "}function b6(t,e){for(;--e&&Rr()&&!(Te<48||Te>102||Te>57&&Te<65||Te>70&&Te<97););return Ac(t,al()+(e<6&&In()==32&&Rr()==32))}function id(t){for(;Rr();)switch(Te){case t:return Nr;case 34:case 39:t!==34&&t!==39&&id(Te);break;case 40:t===41&&id(t);break;case 92:Rr();break}return Nr}function C6(t,e){for(;Rr()&&t+Te!==57;)if(t+Te===84&&In()===47)break;return"/*"+Ac(e,Nr-1)+"*"+Lo(t===47?t:Rr())}function k6(t){for(;!Vo(In());)Rr();return Ac(t,Nr)}function v6(t){return x6(ll("",null,null,null,[""],t=g6(t),0,[0],t))}function ll(t,e,r,n,i,s,o,a,l){for(var h=0,u=0,d=o,f=0,p=0,m=0,x=1,g=1,y=1,C=0,b=0,w="",_=i,S=s,N=n,A=w;g;)switch(m=b,b=Rr()){case 40:m!=108&&ts(A,d-1)==58?(C++,A+="("):A+=Ah(b);break;case 41:C--,A+=")";break;case 34:case 39:case 91:A+=Ah(b);break;case 9:case 10:case 13:case 32:if(C>0){A+=Lo(b);break}A+=y6(m);break;case 92:A+=b6(al()-1,7);continue;case 47:switch(In()){case 42:case 47:Pa(w6(C6(Rr(),al()),e,r,l),l),(Vo(m||1)==5||Vo(In()||1)==5)&&Kr(A)&&Ts(A,-1,void 0)!==" "&&(A+=" ");break;default:A+="/"}break;case 123*x:a[h++]=Kr(A)*y;case 125*x:case 59:case 0:if(C>0&&b){A+=Lo(b);break}switch(b){case 0:case 125:g=0;case 59+u:y==-1&&(A=nd(A,/\f/g,"")),p>0&&(Kr(A)-d||x===0)&&Pa(p>32?Zg(A+";",n,r,d-1,l):Zg(nd(A," ","")+";",n,r,d-2,l),l);break;case 59:A+=";";default:if(Pa(N=Qg(A,e,r,h,u,i,a,w,_=[],S=[],d,s),s),b===123)if(u===0)ll(A,e,N,N,_,s,d,a,S);else{switch(f){case 99:if(ts(A,3)===110)break;case 108:if(ts(A,2)===97)break;default:u=0;case 100:case 109:case 115:}u?ll(t,N,N,n&&Pa(Qg(t,N,N,0,0,i,a,w,i,_=[],d,S),S),i,S,d,a,n?_:S):ll(A,N,N,N,[""],S,0,a,S)}}h=u=p=0,x=y=1,w=A="",d=o;break;case 58:d=1+Kr(A),p=m;default:if(x<1){if(b==123)--x;else if(b==125&&x++==0&&m6()==125)continue}switch(A+=Lo(b),b*x){case 38:y=u>0?1:(A+="\f",-1);break;case 44:if(C>0)break;a[h++]=(Kr(A)-1)*y,y=1;break;case 64:In()===45&&(A+=Ah(Rr())),f=In(),u=d=Kr(w=A+=k6(al())),b++;break;case 45:m===45&&Kr(A)==2&&(x=0)}}return s}function Qg(t,e,r,n,i,s,o,a,l,h,u,d){for(var f=i-1,p=i===0?s:[""],m=gw(p),x=0,g=0,y=0;x<n;++x)for(var C=0,b=Ts(t,f+1,f=p6(g=o[x])),w=t;C<m;++C)(w=mw(g>0?p[C]+" "+b:nd(b,/&\f/g,p[C])))&&(l[y++]=w);return ef(t,e,r,i===0?dw:a,l,h,u,d)}function w6(t,e,r,n){return ef(t,e,r,tf,Lo(f6()),Ts(t,2,-2),0,n)}function Zg(t,e,r,n,i){return ef(t,e,r,pw,Ts(t,0,n),Ts(t,n+1,-1),n,i)}function sd(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function S6(t,e,r,n){switch(t.type){case fw:if(t.children.length)break;case c6:case u6:case pw:return t.return=t.return||t.value;case tf:return"";case rd:return t.return=t.value+"{"+sd(t.children,n)+"}";case dw:if(!Kr(t.value=t.props.join(",")))return""}return Kr(r=sd(t.children,n))?t.return=t.value+"{"+r+"}":""}function T6(t){var e=gw(t);return function(r,n,i,s){for(var o="",a=0;a<e;a++)o+=t[a](r,n,i,s)||"";return o}}var yw="c4",_6=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),j6=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./c4Diagram-AAUBKEIU-CIZ7QDGR.js");return{diagram:e}},__vite__mapDeps([9,10,3,4,5,6,7]));return{id:yw,diagram:t}},"loader"),N6={id:yw,detector:_6,loader:j6},E6=N6,bw="flowchart",B6=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"),L6=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-D84i8zUb.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:bw,diagram:t}},"loader"),A6={id:bw,detector:B6,loader:L6},M6=A6,Cw="flowchart-v2",I6=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"),F6=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-D84i8zUb.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:Cw,diagram:t}},"loader"),D6={id:Cw,detector:I6,loader:F6},P6=D6,kw="er",O6=v(t=>/^\s*erDiagram/.test(t),"detector"),$6=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./erDiagram-TEJ5UH35-BuNJLn2I.js");return{diagram:e}},__vite__mapDeps([16,13,14,15,3,4,5,6,7]));return{id:kw,diagram:t}},"loader"),R6={id:kw,detector:O6,loader:$6},z6=R6,vw="gitGraph",W6=v(t=>/^\s*gitGraph/.test(t),"detector"),q6=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-PVQCEYII-Mo99IrfD.js");return{diagram:e}},__vite__mapDeps([17,18,19,20,5,3,4,6,7]));return{id:vw,diagram:t}},"loader"),H6={id:vw,detector:W6,loader:q6},U6=H6,ww="gantt",Y6=v(t=>/^\s*gantt/.test(t),"detector"),G6=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./ganttDiagram-6RSMTGT7-DW_1tH7v.js");return{diagram:e}},__vite__mapDeps([21,3,4,22,23,24,5,6,7]));return{id:ww,diagram:t}},"loader"),V6={id:ww,detector:Y6,loader:G6},X6=V6,Sw="info",K6=v(t=>/^\s*info/.test(t),"detector"),Q6=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./infoDiagram-5YYISTIA-BJvJda4j.js");return{diagram:e}},__vite__mapDeps([25,20,5,3,4,6,7]));return{id:Sw,diagram:t}},"loader"),Z6={id:Sw,detector:K6,loader:Q6},Tw="pie",J6=v(t=>/^\s*pie/.test(t),"detector"),t8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./pieDiagram-4H26LBE5-N-HzAPPi.js");return{diagram:e}},__vite__mapDeps([26,18,20,5,3,4,6,27,28,23,7]));return{id:Tw,diagram:t}},"loader"),e8={id:Tw,detector:J6,loader:t8},_w="quadrantChart",r8=v(t=>/^\s*quadrantChart/.test(t),"detector"),n8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./quadrantDiagram-W4KKPZXB-YEX6PyFG.js");return{diagram:e}},__vite__mapDeps([29,22,23,24,3,4,5,6,7]));return{id:_w,diagram:t}},"loader"),i8={id:_w,detector:r8,loader:n8},s8=i8,jw="xychart",o8=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),a8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./xychartDiagram-2RQKCTM6-Do2YVGeZ.js");return{diagram:e}},__vite__mapDeps([30,23,28,22,24,3,4,5,6,7]));return{id:jw,diagram:t}},"loader"),l8={id:jw,detector:o8,loader:a8},c8=l8,Nw="requirement",h8=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),u8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./requirementDiagram-4Y6WPE33-CCpgQqwO.js");return{diagram:e}},__vite__mapDeps([31,13,14,3,4,5,6,7]));return{id:Nw,diagram:t}},"loader"),d8={id:Nw,detector:h8,loader:u8},p8=d8,Ew="sequence",f8=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),m8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./sequenceDiagram-3UESZ5HK-Dh8UHRBI.js");return{diagram:e}},__vite__mapDeps([32,10,19,3,4,5,6,7]));return{id:Ew,diagram:t}},"loader"),g8={id:Ew,detector:f8,loader:m8},x8=g8,Bw="class",y8=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"),b8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./classDiagram-4FO5ZUOK-7kNnlTD1.js");return{diagram:e}},__vite__mapDeps([33,34,12,10,13,14,3,4,5,6,7]));return{id:Bw,diagram:t}},"loader"),C8={id:Bw,detector:y8,loader:b8},k8=C8,Lw="classDiagram",v8=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"),w8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./classDiagram-v2-Q7XG4LA2-7kNnlTD1.js");return{diagram:e}},__vite__mapDeps([35,34,12,10,13,14,3,4,5,6,7]));return{id:Lw,diagram:t}},"loader"),S8={id:Lw,detector:v8,loader:w8},T8=S8,Aw="state",_8=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"),j8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./stateDiagram-AJRCARHV-DKvZ4fLX.js");return{diagram:e}},__vite__mapDeps([36,37,13,14,1,2,3,4,5,6,7]));return{id:Aw,diagram:t}},"loader"),N8={id:Aw,detector:_8,loader:j8},E8=N8,Mw="stateDiagram",B8=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"),L8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-BHNVJYJU-DF_adEfb.js");return{diagram:e}},__vite__mapDeps([38,37,13,14,3,4,5,6,7]));return{id:Mw,diagram:t}},"loader"),A8={id:Mw,detector:B8,loader:L8},M8=A8,Iw="journey",I8=v(t=>/^\s*journey/.test(t),"detector"),F8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./journeyDiagram-JHISSGLW-DmgxLRyA.js");return{diagram:e}},__vite__mapDeps([39,12,10,27,3,4,5,6,7]));return{id:Iw,diagram:t}},"loader"),D8={id:Iw,detector:I8,loader:F8},P8=D8,O8=v((t,e,r)=>{it.debug(`rendering svg for syntax error
605
- `);const n=bD(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),db(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"),Fw={draw:O8},$8=Fw,R8={db:{},renderer:Fw,parser:{parse:v(()=>{},"parse")}},z8=R8,Dw="flowchart-elk",W8=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"),q8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-D84i8zUb.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:Dw,diagram:t}},"loader"),H8={id:Dw,detector:W8,loader:q8},U8=H8,Pw="timeline",Y8=v(t=>/^\s*timeline/.test(t),"detector"),G8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./timeline-definition-PNZ67QCA-qunNDnlH.js");return{diagram:e}},__vite__mapDeps([40,27,3,4,5,6,7]));return{id:Pw,diagram:t}},"loader"),V8={id:Pw,detector:Y8,loader:G8},X8=V8,Ow="mindmap",K8=v(t=>/^\s*mindmap/.test(t),"detector"),Q8=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./mindmap-definition-RKZ34NQL-C0dgdrrD.js");return{diagram:e}},__vite__mapDeps([41,13,14,3,4,5,6,7]));return{id:Ow,diagram:t}},"loader"),Z8={id:Ow,detector:K8,loader:Q8},J8=Z8,$w="kanban",tz=v(t=>/^\s*kanban/.test(t),"detector"),ez=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./kanban-definition-UN3LZRKU-DV6cN2Fc.js");return{diagram:e}},__vite__mapDeps([42,12,3,4,5,6,7]));return{id:$w,diagram:t}},"loader"),rz={id:$w,detector:tz,loader:ez},nz=rz,Rw="sankey",iz=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),sz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./sankeyDiagram-5OEKKPKP-BSUvtggj.js");return{diagram:e}},__vite__mapDeps([43,28,23,3,4,5,6,7]));return{id:Rw,diagram:t}},"loader"),oz={id:Rw,detector:iz,loader:sz},az=oz,zw="packet",lz=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),cz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./diagram-LMA3HP47-pmYhkUAj.js");return{diagram:e}},__vite__mapDeps([44,18,20,5,3,4,6,7]));return{id:zw,diagram:t}},"loader"),hz={id:zw,detector:lz,loader:cz},Ww="radar",uz=v(t=>/^\s*radar-beta/.test(t),"detector"),dz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./diagram-2AECGRRQ-CmljsTYt.js");return{diagram:e}},__vite__mapDeps([45,18,20,5,3,4,6,7]));return{id:Ww,diagram:t}},"loader"),pz={id:Ww,detector:uz,loader:dz},qw="block",fz=v(t=>/^\s*block(-beta)?/.test(t),"detector"),mz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./blockDiagram-GPEHLZMM-Dm-THFZ6.js");return{diagram:e}},__vite__mapDeps([46,12,1,15,3,4,5,6,7]));return{id:qw,diagram:t}},"loader"),gz={id:qw,detector:fz,loader:mz},xz=gz,Hw="treeView",yz=v(t=>/^\s*treeView-beta/.test(t),"detector"),bz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./diagram-5GNKFQAL-Pcdh-Hev.js");return{diagram:e}},__vite__mapDeps([47,18,19,20,5,3,4,6,7]));return{id:Hw,diagram:t}},"loader"),Cz={id:Hw,detector:yz,loader:bz},kz=Cz,Uw="architecture",vz=v(t=>/^\s*architecture/.test(t),"detector"),wz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./architectureDiagram-3BPJPVTR-UehcfvE8.js");return{diagram:e}},__vite__mapDeps([48,18,20,5,3,4,6,7]));return{id:Uw,diagram:t}},"loader"),Sz={id:Uw,detector:vz,loader:wz},Tz=Sz,Yw="eventmodeling",_z=v(t=>/^\s*eventmodeling/.test(t),"detector"),jz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./diagram-KO2AKTUF-CrEqfa_s.js");return{diagram:e}},__vite__mapDeps([49,18,20,5,3,4,6,7]));return{id:Yw,diagram:t}},"loader"),Nz={id:Yw,detector:_z,loader:jz},Ez=Nz,Gw="ishikawa",Bz=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),Lz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-YF4QCWOH-Dl7ib9vb.js");return{diagram:e}},__vite__mapDeps([50,3,4,5,6,7]));return{id:Gw,diagram:t}},"loader"),Az={id:Gw,detector:Bz,loader:Lz},Vw="venn",Mz=v(t=>/^\s*venn-beta/.test(t),"detector"),Iz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./vennDiagram-CIIHVFJN-D5a-gmIU.js");return{diagram:e}},__vite__mapDeps([51,3,4,5,6,7]));return{id:Vw,diagram:t}},"loader"),Fz={id:Vw,detector:Mz,loader:Iz},Dz=Fz,Xw="treemap",Pz=v(t=>/^\s*treemap/.test(t),"detector"),Oz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./diagram-OG6HWLK6-1mWNdTnP.js");return{diagram:e}},__vite__mapDeps([52,14,18,20,5,3,4,6,24,28,23,7]));return{id:Xw,diagram:t}},"loader"),$z={id:Xw,detector:Pz,loader:Oz},Kw="wardley-beta",Rz=v(t=>/^\s*wardley-beta/i.test(t),"detector"),zz=v(async()=>{const{diagram:t}=await Yt(async()=>{const{diagram:e}=await import("./wardleyDiagram-YWT4CUSO-R1zmVC27.js");return{diagram:e}},__vite__mapDeps([53,18,20,5,3,4,6,7]));return{id:Kw,diagram:t}},"loader"),Wz={id:Kw,detector:Rz,loader:zz},qz=Wz,Jg=!1,Mc=v(()=>{Jg||(Jg=!0,_l("error",z8,t=>t.toLowerCase().trim()==="error"),_l("---",{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("---")),hu(U8,J8,Tz),hu(E6,nz,T8,k8,z6,X6,Z6,e8,p8,x8,P6,M6,X8,U6,M8,E8,P8,s8,az,hz,c8,xz,Ez,kz,pz,Az,$z,Dz,qz))},"addDiagrams"),Hz=v(async()=>{it.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(gi).map(async([r,{detector:n,loader:i}])=>{if(i)try{mu(r)}catch{try{const{diagram:s,id:o}=await i();_l(o,s,n)}catch(s){throw it.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete gi[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){it.error(`Failed to load ${e.length} external diagrams`);for(const r of e)it.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),Uz="graphics-document document";function Qw(t,e){t.attr("role",Uz),e!==""&&t.attr("aria-roledescription",e)}v(Qw,"setA11yDiagramInfo");function Zw(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(Zw,"addSVGa11yTitleDescription");var di,od=(di=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=np(e,n);e=wO(e)+`
606
- `;try{mu(i)}catch{const d=$3(i);if(!d)throw new Qy(`Diagram ${i} not found.`);const{id:f,diagram:p}=await d();_l(f,p)}const{db:s,parser:o,renderer:a,init:l}=mu(i);return o.parser&&(o.parser.yy=s),(h=s.clear)==null||h.call(s),l==null||l(n),r.title&&((u=s.setDiagramTitle)==null||u.call(s,r.title)),await o.parse(e),new di(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(di,"Diagram"),di),tx=[],Yz=v(()=>{tx.forEach(t=>{t()}),tx=[]},"attachFunctions"),Gz=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Jw(t){const e=t.match(Ky);if(!e)return{text:t,metadata:{}};let r=_P(e[1],{schema:TP})??{};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(Jw,"extractFrontMatter");var Vz=v(t=>t.replace(/\r\n?/g,`
607
- `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),Xz=v(t=>{const{text:e,metadata:r}=Jw(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"),Kz=v(t=>{const e=Pr.detectInit(t)??{},r=Pr.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:hO(t),directive:e}},"processDirectives");function rf(t){const e=Vz(t),r=Xz(e),n=Kz(r.text),i=Op(r.config,n.directive);return t=Gz(n.text),{code:t,title:r.title,config:i}}v(rf,"preprocessDiagram");function t2(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(t2,"toBase64");var Qz=5e4,Zz="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",Jz="sandbox",t9="loose",e9="http://www.w3.org/2000/svg",r9="http://www.w3.org/1999/xlink",n9="http://www.w3.org/1999/xhtml",i9="100%",s9="100%",o9="border:0;margin:0;",a9="margin:0",l9="allow-top-navigation-by-user-activation allow-popups",c9='The "iframe" tag is not supported by your browser.',h9=["foreignobject"],u9=["dominant-baseline"];function nf(t){const e=rf(t);return Sl(),dM(e.config??{}),e}v(nf,"processAndSetConfigs");async function e2(t,e){Mc();try{const{code:r,config:n}=nf(t);return{diagramType:(await n2(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(e2,"parse");var ex=v((t,e,r=[])=>{const n=rb(`{ ${r.join(" !important; ")} !important; }`);return`.${t} ${e} ${n}`},"cssImportantStyles"),d9=v((t,e=new Map)=>{const r=new CSSStyleSheet;if(t.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${t.fontFamily}}`,r.cssRules.length),t.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${t.altFontFamily}}`,r.cssRules.length),e instanceof Map){const a=ir(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(l=>{mg(l.styles)||a.forEach(h=>{r.insertRule(ex(l.id,h,l.styles),r.cssRules.length)}),mg(l.textStyles)||r.insertRule(ex(l.id,"tspan",((l==null?void 0:l.textStyles)||[]).map(h=>h.replace("color","fill"))),r.cssRules.length)})}let n="";if(t.themeCSS!==void 0)if(typeof r.replaceSync=="function"){const i=new CSSStyleSheet;i.replaceSync(t.themeCSS),n=fu(i)+`
608
- `}else n+=`${t.themeCSS}
609
- `;return n+fu(r)},"createCssStyles"),p9=v((t,e)=>sd(v6(`${t}{${e}}`),T6([v(function(n,i,s,o){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===rd)return;n.props=n.props.map(a=>a.startsWith(t)?a:`${t} ${a}`)}else n.type.startsWith("@")&&([...[l6,h6,fw,d6,"@container","@starting-style"],rd].includes(n.type)||(it.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=tf))},"addNamespace"),S6])),"compileCSS"),f9=v((t,e,r,n)=>{const i=d9(t,r),s=LM(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return p9(n,s)},"createUserStyles"),m9=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=Ci(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),g9=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":s9,n=t2(`<body style="${a9}">${t}</body>`);return`<iframe style="width:${i9};height:${r};${o9}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${l9}">
610
- ${c9}
611
- </iframe>`},"putIntoIFrame"),rx=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",e9);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function ad(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(ad,"sandboxedIframe");var x9=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"),y9=v(async function(t,e,r){var z,W,P,I,M,O;Mc();const n=nf(e);e=n.code;const i=me();it.debug(i),e.length>((i==null?void 0:i.maxTextSize)??Qz)&&(e=Zz);const s=`#${t}`,o="i"+t,a="#"+o,l="d"+t,h="#"+l,u=v(()=>{const B=Wt(f?a:h).node();B&&"remove"in B&&B.remove()},"removeTempElements");let d=Wt(document.body);const f=i.securityLevel===Jz,p=i.securityLevel===t9,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const $=ad(Wt(r),o);d=Wt($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Wt(r);rx(d,t,l,`font-family: ${m}`,r9)}else{if(x9(document,t,l,o),f){const $=ad(Wt(document.body),o);d=Wt($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Wt("body");rx(d,t,l)}let x,g;try{x=await od.fromText(e,{title:n.title})}catch($){if(i.suppressErrorRendering)throw u(),$;x=await od.fromText("error"),g=$}const y=d.select(h).node(),C=x.type,b=y.firstChild,w=b.firstChild,_=(W=(z=x.renderer).getClasses)==null?void 0:W.call(z,e,x),S=f9(i,C,_,s),N=document.createElement("style");N.innerHTML=S,b.insertBefore(N,w);try{await x.renderer.draw(e,t,"11.15.0",x)}catch($){throw i.suppressErrorRendering?u():$8.draw(e,t,"11.15.0"),$}const A=d.select(`${h} svg`),L=(I=(P=x.db).getAccTitle)==null?void 0:I.call(P),j=(O=(M=x.db).getAccDescription)==null?void 0:O.call(M);i2(C,A,L,j),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",n9);let F=d.select(h).node().innerHTML;if(it.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),F=m9(F,f,kn(i.arrowMarkerAbsolute)),f){const $=d.select(h+" svg").node();F=g9(F,$)}else p||(F=bs.sanitize(F,{ADD_TAGS:h9,ADD_ATTR:u9,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(Yz(),g)throw g;return u(),{diagramType:C,svg:F,bindFunctions:x.db.bindFunctions}},"render");function r2(t={}){var n;const e=Be({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),hM(e),e!=null&&e.theme&&e.theme in pn?e.themeVariables=pn[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=pn.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?cM(e):nb();rp(r.logLevel),Mc()}v(r2,"initialize");var n2=v((t,e={})=>{const{code:r}=rf(t);return od.fromText(r,e)},"getDiagramFromText");function i2(t,e,r,n){Qw(e,t),Zw(e,r,n,e.attr("id"))}v(i2,"addA11yInfo");var vi=Object.freeze({render:y9,parse:e2,getDiagramFromText:n2,initialize:r2,getConfig:me,setConfig:ib,getSiteConfig:nb,updateSiteConfig:uM,reset:v(()=>{Sl()},"reset"),globalReset:v(()=>{Sl(Cs)},"globalReset"),defaultConfig:Cs});rp(me().logLevel);Sl(me());var b9=v((t,e,r)=>{it.warn(t),Pp(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"),s2=v(async function(t={querySelector:".mermaid"}){try{await C9(t)}catch(e){if(Pp(e)&&it.error(e.str),kr.parseError&&kr.parseError(e),!t.suppressErrors)throw it.error("Use the suppressErrors option to suppress these errors"),e}},"run"),C9=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=vi.getConfig();it.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");it.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(it.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),vi.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new Pr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const l of Array.from(i)){if(it.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const h=`mermaid-${s.next()}`;o=l.innerHTML,o=bk(Pr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Pr.detectInit(o);u&&it.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:f}=await c2(h,o,l);l.innerHTML=d,t&&await t(h),f&&f(l)}catch(d){b9(d,a,kr.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),o2=v(function(t){vi.initialize(t)},"initialize"),k9=v(async function(t,e,r){it.warn("mermaid.init is deprecated. Please use run instead."),t&&o2(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await s2(n)},"init"),v9=v(async(t,{lazyLoad:e=!0}={})=>{Mc(),hu(...t),e===!1&&await Hz()},"registerExternalDiagrams"),a2=v(function(){if(kr.startOnLoad){const{startOnLoad:t}=vi.getConfig();t&&kr.run().catch(e=>it.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",a2,!1);var w9=v(function(t){kr.parseError=t},"setParseErrorHandler"),Zl=[],Mh=!1,l2=v(async()=>{if(!Mh){for(Mh=!0;Zl.length>0;){const t=Zl.shift();if(t)try{await t()}catch(e){it.error("Error executing queue",e)}}Mh=!1}},"executeQueue"),S9=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{vi.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;it.error("Error parsing",a),(l=kr.parseError)==null||l.call(kr,a),o(a),n(a)})}),"performCall");Zl.push(i),l2().catch(n)}),"parse"),c2=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{vi.render(t,e,r).then(l=>{o(l),n(l)},l=>{var h;it.error("Error parsing",l),(h=kr.parseError)==null||h.call(kr,l),a(l),i(l)})}),"performCall");Zl.push(s),l2().catch(i)}),"render"),T9=v(()=>Object.keys(gi).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),kr={startOnLoad:!0,mermaidAPI:vi,parse:S9,render:c2,init:k9,run:s2,registerExternalDiagrams:v9,registerLayoutLoaders:uw,initialize:o2,parseError:void 0,contentLoaded:a2,setParseErrorHandler:w9,detectType:np,registerIconPacks:B$,getRegisteredDiagramsMetadata:T9},h2=kr;/*! Check if previously processed *//*!
612
- * Wait for document loaded before starting the execution
613
- */h2.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function _9({code:t}){const e=k.useRef(null),r=k.useId(),[n,i]=k.useState(null),[s,o]=k.useState(null);return k.useEffect(()=>{let a=!1;const l=`mermaid-${r.replace(/:/g,"")}`;return h2.render(l,t).then(({svg:h})=>{a||i(h)}).catch(h=>{a||o(h.message||"Invalid diagram")}),()=>{a=!0}},[t,r]),s?c.jsx("pre",{className:"text-[11px] text-destructive bg-destructive/10 border border-destructive/20 rounded p-3 overflow-x-auto",children:`Mermaid error: ${s}
614
-
615
- ${t}`}):n?c.jsx("div",{ref:e,className:"my-3 overflow-x-auto",dangerouslySetInnerHTML:{__html:n}}):c.jsx("div",{className:"text-[11px] text-muted-foreground py-2",children:"Rendering diagram..."})}function j9({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?c.jsx(_9,{code:String(e).trim()}):c.jsx("code",{className:t,...r,children:e})}const N9=`prose prose-sm prose-invert max-w-none
616
- prose-headings:text-foreground prose-p:text-muted-foreground
617
- prose-a:text-accent prose-strong:text-foreground
618
- prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
619
- prose-pre:bg-muted prose-pre:border prose-pre:border-border
620
- prose-li:text-muted-foreground prose-table:text-xs
621
- prose-th:text-foreground prose-td:text-muted-foreground
622
- prose-hr:border-border`;function u2({content:t,className:e}){return c.jsx("article",{className:st(N9,e),children:c.jsx(Hd,{remarkPlugins:[Vd],components:{code:j9},children:t||""})})}function E9(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 d2(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=d2(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function p2(t){let e=t.files.length;for(const r of t.children.values())e+=p2(r);return e}function f2({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=B9(t,e),h=r.has(l)||!!a,u=p2(t);return c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>n(l),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?c.jsx(qS,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):c.jsx(Td,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name}),c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto tabular-nums shrink-0",children:u})]}),h&&c.jsxs(c.Fragment,{children:[[...t.children.values()].sort((d,f)=>d.name.localeCompare(f.name)).map(d=>c.jsx(f2,{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=>c.jsx(m2,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function m2({file:t,depth:e,isSelected:r,isTracked:n,onSelect:i}){return c.jsxs("button",{onClick:i,className:st("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:[c.jsx(wi,{className:"h-3 w-3 shrink-0",style:{color:n?"hsl(var(--primary))":void 0}}),c.jsx("span",{className:st("text-xs truncate",r?"text-accent font-medium":"text-foreground"),children:t.name}),n&&c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 ml-auto",style:{background:"hsl(var(--primary))"}})]})}function B9(t,e){return`dir-${e}-${t.name}`}function g2({items:t,selectedFile:e,onSelectedFileChange:r,previousView:n,onBack:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,h]=k.useState([]),[u,d]=k.useState(!0),[f,p]=k.useState(null),m=e||f,x=Y=>{p(Y),r&&r(Y)},[g,y]=k.useState(null),[C,b]=k.useState(!1),[w,_]=k.useState(!1),[S,N]=k.useState(""),[A,L]=k.useState(null),[j,F]=k.useState(!1),z=k.useRef(null),[W,P]=k.useState(""),[I,M]=k.useState(()=>new Set(["dir-0-docs"])),[O,$]=k.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),B=k.useRef(!1),T=k.useRef(null),G=k.useCallback(Y=>{Y.preventDefault(),B.current=!0;const ot=Tt=>{if(!B.current||!T.current)return;const ee=T.current.getBoundingClientRect(),le=Math.min(Math.max(Tt.clientX-ee.left,160),500);$(le)},kt=()=>{B.current=!1,document.removeEventListener("mousemove",ot),document.removeEventListener("mouseup",kt),$(Tt=>(localStorage.setItem("compose:docsTreeWidth",Tt),Tt))};document.addEventListener("mousemove",ot),document.addEventListener("mouseup",kt)},[]),tt=w&&S!==A,D=k.useCallback(async()=>{if(!(!m||j)){F(!0);try{const Y=await Mt("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:S})});Y.ok?(L(S),y(S),_e("Saved","info")):_e(`Save failed (${Y.status})`,"error")}catch(Y){_e(`Save failed: ${Y.message}`,"error")}F(!1)}},[m,S,j]),V=k.useCallback(()=>{_(Y=>(!Y&&g!==null&&(N(g),L(g)),!Y))},[g]);k.useEffect(()=>{if(!w)return;const Y=ot=>{(ot.metaKey||ot.ctrlKey)&&ot.key==="s"&&(ot.preventDefault(),D())};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[w,D]),k.useEffect(()=>{_(!1),N(""),L(null)},[m]),k.useEffect(()=>{Mt("/api/files").then(Y=>Y.json()).then(Y=>{h(Y.files||[]),d(!1);const ot=new Set(["dir-0-docs"]);for(const kt of Y.files||[]){const Tt=kt.split("/");Tt.length>1&&ot.add(`dir-1-${Tt[1]}`)}M(ot)}).catch(()=>d(!1))},[]),k.useEffect(()=>{if(!m){y(null);return}b(!0),Mt(`/api/file?path=${encodeURIComponent(m)}`).then(Y=>Y.json()).then(Y=>{y(Y.content??null),b(!1)}).catch(()=>{y(null),b(!1)})},[m]);const ht=k.useMemo(()=>!o||!s?l:l.filter(Y=>Y.includes(`features/${s}/`)),[l,o,s]),ct=k.useMemo(()=>{const Y=new Set,ot=kt=>kt.split("/").pop();for(const kt of t){const Tt=`${kt.title||""} ${kt.description||""} ${kt.planLink||""}`.toLowerCase();for(const ee of ht)(Tt.includes(ee.toLowerCase())||Tt.includes(ot(ee).replace(".md","").toLowerCase()))&&Y.add(ee)}return Y},[t,ht]),Ft=k.useMemo(()=>E9(ht),[ht]),_t=k.useMemo(()=>d2(Ft,W),[Ft,W]),lt=k.useCallback(Y=>{M(ot=>{const kt=new Set(ot);return kt.has(Y)?kt.delete(Y):kt.add(Y),kt})},[]);return u?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading docs..."})}):c.jsxs("div",{ref:T,className:"flex-1 flex min-h-0",children:[c.jsxs("div",{className:"shrink-0 flex flex-col min-h-0",style:{width:`${O}px`},children:[c.jsxs("div",{className:"px-2 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[c.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:c.jsx(ea,{featureCode:s,active:o,onToggle:a})}),c.jsxs("div",{className:"relative",children:[c.jsx(bn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(yd,{placeholder:"Search files...",value:W,onChange:Y=>P(Y.target.value),className:"h-7 pl-7 pr-7 text-xs"}),W&&c.jsx("button",{onClick:()=>P(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c.jsx(yn,{className:"h-3 w-3"})})]}),c.jsxs("div",{className:"flex items-center justify-between mt-1.5 px-1",children:[c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ht.length," files"]}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ht.length-ct.size," untracked"]})]})]}),c.jsx($n,{className:"flex-1",children:c.jsxs("div",{className:"py-1",children:[[..._t.children.values()].sort((Y,ot)=>Y.name.localeCompare(ot.name)).map(Y=>c.jsx(f2,{node:Y,depth:0,expandedDirs:I,onToggleDir:lt,selectedFile:m,onSelectFile:x,trackedPaths:ct,searchQuery:W},Y.name)),_t.files.sort((Y,ot)=>Y.name.localeCompare(ot.name)).map(Y=>c.jsx(m2,{file:Y,depth:0,isSelected:m===Y.path,isTracked:ct.has(Y.path),onSelect:()=>x(Y.path)},Y.path))]})})]}),c.jsx("div",{onMouseDown:G,className:"w-1 shrink-0 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors",style:{background:"hsl(var(--border))"}}),c.jsx("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:m?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2",style:{borderBottom:"1px solid hsl(var(--border))"},children:[n&&i&&c.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:[c.jsx(bS,{className:"h-3 w-3"}),"Back to ",n.charAt(0).toUpperCase()+n.slice(1)]}),c.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:m}),tt&&c.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"}),ct.has(m)&&c.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&&c.jsxs("button",{onClick:D,disabled:j||!tt,className:st("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",tt?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[c.jsx(yT,{className:"h-3 w-3"}),j?"Saving...":"Save"]}),c.jsx("button",{onClick:V,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?c.jsx(e0,{className:"h-3.5 w-3.5"}):c.jsx(i0,{className:"h-3.5 w-3.5"})})]}),C?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):g!==null&&w?c.jsx("textarea",{ref:z,value:S,onChange:Y=>N(Y.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?c.jsx($n,{className:"flex-1",children:c.jsx("div",{className:"px-6 py-4 max-w-3xl",children:c.jsx(u2,{content:g})})}):c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Could not load file"})})]}):c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsxs("div",{className:"text-center",children:[c.jsx(wi,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/30"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a file to preview"}),c.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Markdown files from the project docs/ directory"})]})})})]})}class L9{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)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,r,n,i){var s;const o=C=>{if(C=this.postProcess(C,n),i){setTimeout(function(){i(C)},0);return}else return C},a=r.length,l=e.length;let h=1,u=a+l;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>=l&&m+1>=a)return o(this.buildValues(p[0].lastComponent,r,e));let x=-1/0,g=1/0;const y=()=>{for(let C=Math.max(x,-h);C<=Math.min(g,h);C+=2){let b;const w=p[C-1],_=p[C+1];w&&(p[C-1]=void 0);let S=!1;if(_){const A=_.oldPos-C;S=_&&0<=A&&A<a}const N=w&&w.oldPos+1<l;if(!S&&!N){p[C]=void 0;continue}if(!N||S&&w.oldPos<_.oldPos?b=this.addToPath(_,!0,!1,0,n):b=this.addToPath(w,!1,!0,1,n),m=this.extractCommon(b,r,e,C,n),b.oldPos+1>=l&&m+1>=a)return o(this.buildValues(b.lastComponent,r,e))||!0;p[C]=b,b.oldPos+1>=l&&(g=Math.min(g,C-1)),m+1>=a&&(x=Math.max(x,C+1))}h++};if(i)(function C(){setTimeout(function(){if(h>u||Date.now()>f)return i(void 0);y()||C()},0)})();else for(;h<=u&&Date.now()<=f;){const C=y();if(C)return C}}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 l=e.oldPos,h=l-i,u=0;for(;h+1<o&&l+1<a&&this.equals(n[l+1],r[h+1],s);)h++,l++,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=l,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,l=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(l,l+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(l,l+u.count));l+=u.count,u.added||(h+=u.count)}}return i}}class A9 extends L9{constructor(){super(...arguments),this.tokenize=F9}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
623
- `))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
624
- `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
625
- `)&&(e=e.slice(0,-1)),r.endsWith(`
626
- `)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const M9=new A9;function I9(t,e,r){return M9.diff(t,e,r)}function F9(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
627
- `));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 sf({oldText:t,newText:e}){const[r,n]=k.useState(!1),{parts:i,addCount:s,removeCount:o}=k.useMemo(()=>{if(!t||!e)return{parts:[],addCount:0,removeCount:0};const a=I9(t,e);let l=0,h=0;for(const u of a){const d=u.value.split(`
628
- `).filter(f=>f!=="").length;u.added&&(l+=d),u.removed&&(h+=d)}return{parts:a,addCount:l,removeCount:h}},[t,e]);return!t||!e?null:s===0&&o===0?c.jsx("span",{className:"text-[9px] text-muted-foreground/50 italic",children:"No changes"}):r?c.jsxs("div",{className:"mt-1.5",children:[c.jsx("button",{onClick:()=>n(!1),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors mb-1",children:"Hide changes"}),c.jsx("div",{className:"rounded border border-border bg-muted/30 overflow-x-auto max-h-[300px] overflow-y-auto",children:c.jsx("pre",{className:"text-[10px] font-mono leading-relaxed",children:i.map((a,l)=>{const h=a.value.split(`
629
- `);return h[h.length-1]===""&&h.pop(),h.map((u,d)=>c.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:[c.jsx("span",{className:"inline-block w-3 text-muted-foreground/40 select-none mr-1",children:a.added?"+":a.removed?"-":" "}),u||" "]},`${l}-${d}`))})})})]}):c.jsxs("button",{onClick:()=>n(!0),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors",children:["Show changes (+",s," -",o,")"]})}function x2(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 D9({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=a0[t.fromPhase];return e.exists?c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r&&c.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&&c.jsxs("span",{className:"text-amber-400",children:[" (missing: ",e.sections.missing.join(", "),")"]}),!e.meetsMinWordCount&&c.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}):c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r??"Artifact"," not found"]})}function P9(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,l=(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(l>0)return{sentence:`${l} critical finding${l>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 O9({gate:t}){const e=P9(t);if(!e)return null;const r=e.outcome==="approve";return c.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 nx({title:t,count:e,color:r,children:n}){return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:r}}),c.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:t}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:e})]}),n]})}function $9({gate:t,item:e,priorRevision:r,isExpanded:n,expandedAction:i,onExpand:s,onResolve:o,onSelect:a}){const[l,h]=k.useState(""),[u,d]=k.useState(!1),f=()=>{o(t.id,"revised",l||void 0),s(null,null),h("")},p=()=>{l.trim()&&(o(t.id,"killed",l),s(null,null),h(""))};return c.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent hover:bg-muted/50 transition-colors",children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[c.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"}),c.jsx("p",{className:"text-[10px] text-muted-foreground",children:mn[t.stepId]??`${Ce[t.fromPhase]??t.fromPhase} → ${Ce[t.toPhase]??t.toPhase}`}),c.jsx(D9,{gate:t}),t.artifactSnapshot?c.jsxs("div",{className:"space-y-1",children:[c.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?c.jsx(Es,{className:"h-3 w-3"}):c.jsx(pi,{className:"h-3 w-3"}),u?"Hide artifact":"View artifact"]}),u&&c.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:c.jsx(u2,{content:t.artifactSnapshot})})]}):null,r?c.jsxs("div",{className:"space-y-1",children:[c.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&&c.jsx("div",{className:"px-2",children:c.jsx(sf,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:x2(t.createdAt)})]}),c.jsx("div",{className:"mt-1.5",children:c.jsx(O9,{gate:t})}),c.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[c.jsx(Pt,{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"}),c.jsx(Pt,{variant:"outline",size:"sm",className:st("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"}),c.jsx(Pt,{variant:"outline",size:"sm",className:st("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&&c.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[c.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:l,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}),c.jsx(Pt,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:i==="kill"&&!l.trim(),onClick:i==="revise"?f:p,children:i==="revise"?"Submit":"Confirm Kill"})]})]})}function R9(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function z9({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=R9(t);return c.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:(e==null?void 0:e.title)??"Unknown"}),c.jsx(rr,{variant:"outline",className:st("text-[10px] px-1.5 py-0 h-4",n.color,n.border),children:t.outcome}),i!=="human"&&c.jsx("span",{className:"text-[9px] px-1 py-0 rounded bg-muted text-muted-foreground",children:i}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:x2(t.resolvedAt)})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:mn[t.stepId]??`${Ce[t.fromPhase]??t.fromPhase} → ${Ce[t.toPhase]??t.toPhase}`}),t.comment&&c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function y2({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o}){const[a,l]=k.useState(null),[h,u]=k.useState(null),d=k.useMemo(()=>{if(!s||!i)return t;const b=new Set(e.filter(w=>{var _;return w.featureCode===i||((_=w.lifecycle)==null?void 0:_.featureCode)===i}).map(w=>w.id));return t.filter(w=>b.has(w.itemId))},[t,e,s,i]),f=(b,w)=>{l(b),u(w)},{pending:p,resolved:m,priorRevisions:x}=k.useMemo(()=>{const b=[],w=[];for(const S of d)S.status==="pending"?b.push(S):S.resolvedAt&&w.push(S);b.sort((S,N)=>new Date(S.createdAt)-new Date(N.createdAt)),w.sort((S,N)=>new Date(N.resolvedAt)-new Date(S.resolvedAt));const _=new Map;for(const S of b){const N=w.find(A=>A.stepId===S.stepId&&A.itemId===S.itemId&&(A.outcome==="revised"||A.outcome==="revise")&&A.comment);N&&_.set(S.id,{comment:N.comment,priorSnapshot:N.artifactSnapshot||null,currentSnapshot:S.artifactSnapshot||null})}return{pending:b,resolved:w,priorRevisions:_}},[d]),[g,y]=k.useState(!1),C=k.useMemo(()=>new Map(e.map(b=>[b.id,b])),[e]);return c.jsxs("div",{className:"flex-1 overflow-auto flex flex-col",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0",children:[c.jsx(ea,{featureCode:i,active:s,onToggle:o}),c.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),p.length>0?c.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:[p.length," pending"]}):c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),m.length>0&&c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",m.length," resolved"]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[p.length>0&&c.jsx(nx,{title:"Pending",count:p.length,color:"#f59e0b",children:p.map(b=>c.jsx($9,{gate:b,item:C.get(b.itemId),priorRevision:x.get(b.id),isExpanded:a===b.id,expandedAction:a===b.id?h:null,onExpand:f,onResolve:r,onSelect:n},b.id))}),m.length>0&&c.jsxs(nx,{title:"History",count:m.length,color:"#22c55e",children:[(g?m.slice(0,50):m.slice(0,10)).map(b=>c.jsx(z9,{gate:b,item:C.get(b.itemId)},b.id)),m.length>10&&!g&&c.jsxs("button",{className:"w-full px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>y(!0),children:["Show all ",m.length," resolved gates"]})]}),p.length===0&&m.length===0&&c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function b2({event:t,items:e,onNavigate:r}){const[n,i]=k.useState(!1),[s,o]=k.useState(null);if(k.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),l=(a==null?void 0:a.title)??"Unknown",h=s.type==="pending"?`Gate pending: ${Io(s,a)}`:`Gate ${s.outcome}: ${l}`;return c.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 W9({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=k.useContext(dc),i=r.has(t.id)?"vision-entering":n.has(t.id)?"vision-updated":"",[s,o]=k.useState(!1),[a,l]=k.useState(""),h=t.status==="complete"||t.status==="killed",{baseDesc:u,resolution:d}=k.useMemo(()=>{if(!t.description)return{baseDesc:"",resolution:""};const x=`
630
-
631
- ---
632
- 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=k.useCallback(async()=>{const g=`Be brief. Summarize, give your recommendation, refine the decision wording based on the resolution if needed: ${t.description||t.title}
633
- `;try{const y=await Mt(aS("/api/terminal/inject"),{method:"POST",headers:Ki({"Content-Type":"application/json"}),body:JSON.stringify({text:g})});if(!y.ok){_e(`Could not send to terminal (${y.status})`,"error");return}const C=document.querySelector(".xterm-helper-textarea");C&&C.focus()}catch(y){console.error("Failed to inject into terminal:",y),_e(`Could not send to terminal: ${y.message}`,"error")}},[t]),p=k.useCallback(()=>{const x=a.trim()?`${t.description||""}
634
-
635
- ---
636
- Resolution: ${a.trim()}`:t.description;e(t.id,{status:"complete",description:x}),o(!1),l("")},[t.id,t.description,a,e]),m=k.useCallback(()=>{e(t.id,{status:"killed"})},[t.id,e]);return c.jsxs("div",{className:st("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:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx("div",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{background:h?"hsl(var(--muted-foreground))":mr.question}}),c.jsx("p",{className:st("text-sm font-medium leading-snug flex-1",h?"text-muted-foreground line-through":"text-foreground"),children:t.title})]}),u&&c.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed pl-4",children:u}),d&&c.jsxs("div",{className:st("ml-4 pl-3 border-l-2 border-success/40 py-1",n.has(t.id)&&"resolution-sparkle"),children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-0.5",children:"Resolution"}),c.jsx("p",{className:"text-xs text-foreground leading-relaxed",children:d})]}),s&&c.jsxs("div",{className:"ml-4 flex items-center gap-1.5",children:[c.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=>l(x.target.value),onKeyDown:x=>{x.key==="Enter"&&p(),x.key==="Escape"&&o(!1)},autoFocus:!0}),c.jsx(Pt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:p,children:c.jsx(_d,{className:"h-3 w-3"})}),c.jsx(Pt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:c.jsx(yn,{className:"h-3 w-3"})})]}),!h&&!s&&c.jsxs("div",{className:"flex items-center gap-1.5 pl-4",children:[c.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:[c.jsx(sc,{className:"h-2.5 w-2.5"})," Discuss"]}),c.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:[c.jsx(Qo,{className:"h-2.5 w-2.5"})," Resolve"]}),c.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:[c.jsx(FS,{className:"h-2.5 w-2.5"})," Dismiss"]})]}),h&&c.jsx("div",{className:"pl-4",children:c.jsx("span",{className:st("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 C2({item:t,items:e,connections:r,onUpdate:n,onClose:i}){const[s,o]=k.useState(null),[a,l]=k.useState(null),[h,u]=k.useState(""),d=k.useRef(null),f=k.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 C=x.get(y.fromId);C&&g.push(C)}if(y.fromId===t.id){const C=x.get(y.toId);C&&g.push(C)}}return g.sort((y,C)=>{const b=new Date(y.createdAt||0).getTime();return new Date(C.createdAt||0).getTime()-b}),g},[t.id,e,r]),p=f.filter(x=>x.status!=="complete"&&x.status!=="killed").length;k.useEffect(()=>{if(!(!s||a!=="running"))return d.current=setInterval(async()=>{try{const x=await Mt(`/api/agent/${s}`);if(!x.ok)return;const g=await x.json();g.status!=="running"&&(l(g.status),clearInterval(d.current))}catch{}},1500),()=>clearInterval(d.current)},[s,a]);const m=k.useCallback(async()=>{if(a==="running")return;const x=t.description?`
637
- 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(`
638
- `);l("running");try{const y=await Mt("/api/agent/spawn",{method:"POST",headers:Ki({"Content-Type":"application/json"}),body:JSON.stringify({prompt:g})});if(!y.ok){const b=await y.json().catch(()=>({}));l("failed"),u(b.error||"Failed to spawn agent"),_e(`Could not start challenge agent (${y.status})`,"error");return}const C=await y.json();o(C.agentId)}catch(y){l("failed"),u(y.message),_e(`Could not start challenge agent: ${y.message}`,"error")}},[t,a]);return c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[c.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:i}),c.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:[c.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3 border-b border-border shrink-0",children:[c.jsx(ul,{className:"h-5 w-5 text-amber-400 shrink-0 mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pressure Test"}),c.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t.title})]}),c.jsx(Pt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:c.jsx(yn,{className:"h-3.5 w-3.5"})})]}),c.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-3",children:[a==="running"&&c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[c.jsx(n0,{className:"h-3.5 w-3.5 text-accent animate-spin"}),c.jsx("span",{className:"text-xs text-accent",children:"Generating challenges..."})]}),a==="failed"&&c.jsx("div",{className:"px-3 py-2 rounded-lg bg-destructive/10 border border-destructive/20",children:c.jsxs("span",{className:"text-xs text-destructive",children:["Failed: ",h]})}),f.length===0&&!a?c.jsxs("div",{className:"text-center py-8",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"No challenges yet."}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Run a pressure test to generate counter-questions."})]}):f.map(x=>c.jsx(W9,{item:x,onUpdate:n},x.id))]}),c.jsxs("div",{className:"flex items-center justify-between p-4 pt-3 border-t border-border shrink-0",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:p>0?`${p} open / ${f.length} total`:f.length>0?`${f.length} resolved`:"No challenges"}),c.jsxs(Pt,{size:"sm",className:st("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[c.jsx(ul,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const q9=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],H9=["gate","flag","skip"],U9=["light","dark","system"],ix=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function oo({title:t,children:e}){return c.jsxs("div",{className:"mb-6",children:[c.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:t}),e]})}function Oi({label:t,children:e}){return c.jsxs("div",{className:"flex items-center justify-between py-1.5 px-1",children:[c.jsx("label",{className:"text-sm text-foreground",children:t}),e]})}function Y9({value:t,className:e,onCommit:r}){const[n,i]=k.useState(t||"");return k.useEffect(()=>{i(t||"")},[t]),c.jsx("input",{type:"text",className:e,value:n,onChange:s=>i(s.target.value),onBlur:()=>{n.trim()&&n.trim()!==t&&r(n.trim())}})}function k2({settings:t,onSettingsChange:e,onReset:r}){var p,m,x,g,y,C;const n=Yx();if(!t)return c.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."});const i=k.useCallback((b,w)=>{const _=w==="null"?null:w;e({policies:{[b]:_}})},[e]),s=k.useCallback((b,w)=>{const _=parseInt(w,10);_>=1&&_<=100&&e({iterations:{[b]:{maxIterations:_}}})},[e]),o=k.useCallback((b,w)=>{w.trim()&&e({models:{[b]:w.trim()}})},[e]),a=k.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]),l=k.useCallback(b=>{e({ui:{defaultView:b}})},[e]),h=k.useCallback(b=>{e({capabilities:{enforcement:b}})},[e]),u=k.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 c.jsxs("div",{className:"flex-1 overflow-auto p-6 max-w-2xl",children:[c.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Settings"}),c.jsx(oo,{title:"Phase Policies",children:q9.map(b=>c.jsx(Oi,{label:Ce[b]||b,children:c.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"&&c.jsx("option",{value:"null",children:"—"}),H9.map(w=>c.jsx("option",{value:w,children:w},w))]})},b))}),c.jsxs(oo,{title:"Iteration Limits",children:[c.jsx(Oi,{label:"Review max iterations",children:c.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)})}),c.jsx(Oi,{label:"Coverage max iterations",children:c.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)})})]}),c.jsx(oo,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var w;return c.jsx(Oi,{label:b,children:c.jsx(Y9,{className:f+" w-48",value:((w=t.models)==null?void 0:w[b])||"",onCommit:_=>o(b,_)},b)},b)})}),c.jsxs(oo,{title:"Appearance",children:[c.jsx(Oi,{label:"Theme",children:c.jsx("select",{className:d,value:((y=t.ui)==null?void 0:y.theme)||"system",onChange:b=>a(b.target.value),children:U9.map(b=>c.jsx("option",{value:b,children:b},b))})}),c.jsx(Oi,{label:"Default view",children:c.jsx("select",{className:d,value:ix.includes((C=t.ui)==null?void 0:C.defaultView)?t.ui.defaultView:"graph",onChange:b=>l(b.target.value),children:ix.map(b=>c.jsx("option",{value:b,children:b},b))})})]}),c.jsx(oo,{title:"Capability Enforcement",children:c.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 c.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[c.jsx("input",{type:"radio",name:"enforcement",value:b,checked:(((_=t.capabilities)==null?void 0:_.enforcement)??"log")===b,onChange:()=>h(b),className:"accent-accent"}),c.jsx("span",{className:"text-sm text-foreground",children:w})]},b)}),c.jsx("p",{className:"text-[11px] text-muted-foreground pt-1",children:"Block stops the build on disallowed tool use; Log records but continues."})]})}),c.jsx("button",{onClick:u,className:"text-xs text-destructive hover:underline mt-2",children:"Reset to Defaults"})]})}function G9(){const[t,e]=k.useState([]),[r,n]=k.useState(!0),[i,s]=k.useState(null);k.useEffect(()=>{Mt("/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 l=await Mt("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})});l.ok||_e(`Could not create draft (${l.status})`,"error")}catch(l){console.error("[TemplateSelector] Failed to create draft:",l),_e(`Could not create draft: ${l.message}`,"error")}s(null)};return r?c.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[c.jsx(n0,{className:"w-4 h-4 animate-spin mr-2"}),"Loading templates..."]}):t.length===0?c.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"No pipeline templates found"}):c.jsxs("div",{className:"p-4 space-y-3",children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Choose a pipeline template"}),c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(a=>c.jsxs("button",{onClick:()=>o(a.id),disabled:i!==null,className:st("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",RT[a.category]||"border-border bg-card"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(wi,{className:"w-4 h-4 shrink-0"}),c.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.label})]}),c.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),c.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-auto",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(ZS,{className:"w-3 h-3"})," ",a.steps," steps"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(t0,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),c.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function v2({activeBuild:t,pipelineDraft:e,onSelectStep:r,onRefresh:n}){const[i,s]=k.useState(null),[o,a]=k.useState(!1),[l,h]=k.useState(!1),u=b=>{const w=i===b?null:b;s(w),r&&r(w)},d=()=>{n&&n()},f=async()=>{if(e!=null&&e.draftId){a(!0);try{const b=await Mt("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});b.ok?_e("Draft approved","info"):_e(`Approve failed (${b.status})`,"error")}catch(b){console.error("[PipelineView] Approve failed:",b),_e(`Approve failed: ${b.message}`,"error")}a(!1)}},p=async()=>{if(e!=null&&e.draftId){h(!0);try{const b=await Mt("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});b.ok||_e(`Reject failed (${b.status})`,"error")}catch(b){console.error("[PipelineView] Reject failed:",b),_e(`Reject failed: ${b.message}`,"error")}h(!1)}};if(!t&&!e)return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pipeline Templates"}),c.jsx("div",{className:"ml-auto",children:c.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:[c.jsx(hl,{className:"w-3 h-3"})," Refresh"]})})]}),c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(G9,{})})]});if(e){const b=e.steps||[],w=e.metadata||{};return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Draft Review"}),c.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[c.jsxs("button",{onClick:p,disabled:l||o,className:st("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",l&&"opacity-60"),children:[c.jsx(yn,{className:"w-3 h-3"})," Reject"]}),c.jsxs("button",{onClick:f,disabled:o||l,className:st("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:[c.jsx(Qo,{className:"w-3 h-3"})," Approve"]})]})]}),c.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:[c.jsxs("span",{className:"text-amber-400 font-medium",children:["Draft: ",w.label||w.id||"Pipeline"]}),c.jsx("span",{className:"text-muted-foreground ml-2",children:w.description||""}),w.category&&c.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",w.category]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3",children:c.jsx("div",{className:"space-y-1",children:b.map((_,S)=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-slate-800/40 bg-card",children:[c.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:S+1}),c.jsx("span",{className:"text-xs text-foreground",children:_.id}),_.agent&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:_.agent}),_.function&&c.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",_.function]})]},_.id||S))})})]})}const m=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(b=>[b.id,b.status])):{},x=(t==null?void 0:t.currentStepId)??null,g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(b=>[b.id,b])):{},y=Oc.map(b=>{const w=g[b.id];return w?{...b,...w}:b});if(t!=null&&t.steps)for(const b of t.steps)Oc.find(w=>w.id===b.id)||y.push({id:b.id,name:b.id.replace(/_/g," "),agent:"claude",phase:"implementation",...b});const C=Object.keys(hf).map(b=>({phase:b,config:hf[b],steps:y.filter(w=>w.phase===b)}));return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Oa,{icon:Qi,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),c.jsx(Oa,{icon:Sd,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),c.jsx(Oa,{icon:jd,color:"text-slate-300 bg-slate-500/10",label:"Human"}),c.jsx(Oa,{icon:Bs,color:"text-amber-400 bg-amber-500/10",label:"Gate"})]}),c.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t&&c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Live: ",c.jsx("span",{className:"text-blue-400 font-medium",children:t.featureCode})]}),c.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:[c.jsx(hl,{className:"w-3 h-3"})," Refresh"]})]})]}),t&&c.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:[c.jsxs("span",{className:"text-blue-400 font-medium",children:["Active Build: ",t.featureCode]}),c.jsxs("span",{className:"text-muted-foreground ml-2",children:["status: ",t.status," · step ",t.stepNum??"?","/",t.totalSteps??Oc.length]}),x&&c.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",c.jsx("span",{className:"font-medium",children:x})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:C.map(({phase:b,config:w,steps:_})=>c.jsxs("div",{className:st("rounded-lg border p-3",w.color),children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:w.label}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:_.map((S,N)=>{const A=m[S.id]??null,L=S.id===x,j=S.id===i;return c.jsxs(qt.Fragment,{children:[c.jsx(V9,{step:S,liveStatus:A,isCurrent:L,isSelected:j,onClick:()=>u(S.id)}),N<_.length-1&&c.jsx(Kx,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},S.id)})})]},b))})]})}function V9({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?Bs:t.agent==="claude"?Qi:t.agent==="codex"?Sd:jd,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 c.jsxs("button",{onClick:i,className:st("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:[c.jsx("div",{className:st("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:c.jsx(s,{className:"w-3 h-3"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-[10px] font-medium text-foreground truncate leading-tight",children:t.name}),e&&c.jsx("p",{className:"text-[8px] text-muted-foreground capitalize",children:e})]})]})}function Oa({icon:t,color:e,label:r}){return c.jsxs("div",{className:st("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",e),children:[c.jsx(t,{className:"w-3 h-3"}),c.jsx("span",{children:r})]})}function X9(t,{search:e="",agentFilter:r="all",statusFilter:n="all"}={}){let i=t;if(e){const s=e.toLowerCase();i=i.filter(o=>{var a,l,h,u;return((a=o.featureCode)==null?void 0:a.toLowerCase().includes(s))||((l=o.feature_code)==null?void 0:l.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 K9={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:Qi},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:Sd},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:Qi},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:jd},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:Qi}},Q9={bg:"bg-slate-800",text:"text-slate-600",Icon:Qi},sx={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 Z9({agent:t,size:e="md",className:r}){const n=K9[t]||Q9,i=sx[e]||sx.md,{Icon:s}=n;return c.jsx("span",{className:st("inline-flex items-center justify-center rounded-full shrink-0",n.bg,n.text,i.outer,r),title:t||"unassigned",children:c.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 Hn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const w2=6048e5,J9=864e5,$a=43200,ox=1440;let t7={};function ua(){return t7}function Xo(t,e){var a,l,h,u;const r=ua(),n=(e==null?void 0:e.weekStartsOn)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.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 Jl(t){return Xo(t,{weekStartsOn:1})}function S2(t){const e=oe(t),r=e.getFullYear(),n=Hn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=Jl(n),s=Hn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=Jl(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function ax(t){const e=oe(t);return e.setHours(0,0,0,0),e}function tc(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 e7(t,e){const r=ax(t),n=ax(e),i=+r-tc(r),s=+n-tc(n);return Math.round((i-s)/J9)}function r7(t){const e=S2(t),r=Hn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Jl(r)}function cl(t,e){const r=oe(t),n=oe(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function n7(t){return Hn(t,Date.now())}function i7(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function s7(t){if(!i7(t)&&typeof t!="number")return!1;const e=oe(t);return!isNaN(Number(e))}function o7(t,e){const r=oe(t),n=oe(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function a7(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function l7(t,e){return+oe(t)-+oe(e)}function c7(t){const e=oe(t);return e.setHours(23,59,59,999),e}function h7(t){const e=oe(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function u7(t){const e=oe(t);return+c7(e)==+h7(e)}function d7(t,e){const r=oe(t),n=oe(e),i=cl(r,n),s=Math.abs(o7(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=cl(r,n)===-i;u7(oe(t))&&s===1&&cl(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function p7(t,e,r){const n=l7(t,e)/1e3;return a7(r==null?void 0:r.roundingMethod)(n)}function f7(t){const e=oe(t),r=Hn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const m7={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"}},g7=(t,e,r)=>{let n;const i=m7[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 Ih(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const x7={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},y7={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},b7={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},C7={date:Ih({formats:x7,defaultWidth:"full"}),time:Ih({formats:y7,defaultWidth:"full"}),dateTime:Ih({formats:b7,defaultWidth:"full"})},k7={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},v7=(t,e,r,n)=>k7[t];function ao(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 w7={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},S7={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},T7={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"]},_7={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"]},j7={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"}},N7={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"}},E7=(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"},B7={ordinalNumber:E7,era:ao({values:w7,defaultWidth:"wide"}),quarter:ao({values:S7,defaultWidth:"wide",argumentCallback:t=>t-1}),month:ao({values:T7,defaultWidth:"wide"}),day:ao({values:_7,defaultWidth:"wide"}),dayPeriod:ao({values:j7,defaultWidth:"wide",formattingValues:N7,defaultFormattingWidth:"wide"})};function lo(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],l=Array.isArray(a)?A7(a,d=>d.test(o)):L7(a,d=>d.test(o));let h;h=t.valueCallback?t.valueCallback(l):l,h=r.valueCallback?r.valueCallback(h):h;const u=e.slice(o.length);return{value:h,rest:u}}}function L7(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function A7(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function M7(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 I7=/^(\d+)(th|st|nd|rd)?/i,F7=/\d+/i,D7={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},P7={any:[/^b/i,/^(a|c)/i]},O7={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},$7={any:[/1/i,/2/i,/3/i,/4/i]},R7={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},z7={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]},W7={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},q7={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]},H7={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},U7={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}},Y7={ordinalNumber:M7({matchPattern:I7,parsePattern:F7,valueCallback:t=>parseInt(t,10)}),era:lo({matchPatterns:D7,defaultMatchWidth:"wide",parsePatterns:P7,defaultParseWidth:"any"}),quarter:lo({matchPatterns:O7,defaultMatchWidth:"wide",parsePatterns:$7,defaultParseWidth:"any",valueCallback:t=>t+1}),month:lo({matchPatterns:R7,defaultMatchWidth:"wide",parsePatterns:z7,defaultParseWidth:"any"}),day:lo({matchPatterns:W7,defaultMatchWidth:"wide",parsePatterns:q7,defaultParseWidth:"any"}),dayPeriod:lo({matchPatterns:H7,defaultMatchWidth:"any",parsePatterns:U7,defaultParseWidth:"any"})},T2={code:"en-US",formatDistance:g7,formatLong:C7,formatRelative:v7,localize:B7,match:Y7,options:{weekStartsOn:0,firstWeekContainsDate:1}};function G7(t){const e=oe(t);return e7(e,f7(e))+1}function V7(t){const e=oe(t),r=+Jl(e)-+r7(e);return Math.round(r/w2)+1}function _2(t,e){var u,d,f,p;const r=oe(t),n=r.getFullYear(),i=ua(),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=Hn(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=Xo(o,e),l=Hn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const h=Xo(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=h.getTime()?n:n-1}function X7(t,e){var a,l,h,u;const r=ua(),n=(e==null?void 0:e.firstWeekContainsDate)??((l=(a=e==null?void 0:e.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(h=r.locale)==null?void 0:h.options)==null?void 0:u.firstWeekContainsDate)??1,i=_2(t,e),s=Hn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),Xo(s,e)}function K7(t,e){const r=oe(t),n=+Xo(r,e)-+X7(r,e);return Math.round(n/w2)+1}function ie(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const En={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return ie(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):ie(r+1,2)},d(t,e){return ie(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 ie(t.getHours()%12||12,e.length)},H(t,e){return ie(t.getHours(),e.length)},m(t,e){return ie(t.getMinutes(),e.length)},s(t,e){return ie(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return ie(i,e.length)}},$i={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},lx={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 En.y(t,e)},Y:function(t,e,r,n){const i=_2(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return ie(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):ie(s,e.length)},R:function(t,e){const r=S2(t);return ie(r,e.length)},u:function(t,e){const r=t.getFullYear();return ie(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 ie(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 ie(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 En.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 ie(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=K7(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):ie(i,e.length)},I:function(t,e,r){const n=V7(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):ie(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):En.d(t,e)},D:function(t,e,r){const n=G7(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):ie(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 ie(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 ie(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 ie(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=$i.noon:n===0?i=$i.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=$i.evening:n>=12?i=$i.afternoon:n>=4?i=$i.morning:i=$i.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 En.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):En.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):ie(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):ie(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):En.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):En.s(t,e)},S:function(t,e){return En.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return hx(n);case"XXXX":case"XX":return ni(n);case"XXXXX":case"XXX":default:return ni(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return hx(n);case"xxxx":case"xx":return ni(n);case"xxxxx":case"xxx":default:return ni(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+cx(n,":");case"OOOO":default:return"GMT"+ni(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+cx(n,":");case"zzzz":default:return"GMT"+ni(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return ie(n,e.length)},T:function(t,e,r){const n=t.getTime();return ie(n,e.length)}};function cx(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+ie(s,2)}function hx(t,e){return t%60===0?(t>0?"-":"+")+ie(Math.abs(t)/60,2):ni(t,e)}function ni(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=ie(Math.trunc(n/60),2),s=ie(n%60,2);return r+i+e+s}const ux=(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"})}},j2=(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"})}},Q7=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return ux(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}}",ux(n,e)).replace("{{time}}",j2(i,e))},Z7={p:j2,P:Q7},J7=/^D+$/,tW=/^Y+$/,eW=["D","DD","YY","YYYY"];function rW(t){return J7.test(t)}function nW(t){return tW.test(t)}function iW(t,e,r){const n=sW(t,e,r);if(console.warn(n),eW.includes(t))throw new RangeError(n)}function sW(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 oW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,aW=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lW=/^'([^]*?)'?$/,cW=/''/g,hW=/[a-zA-Z]/;function uW(t,e,r){var u,d,f,p;const n=ua(),i=n.locale??T2,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(!s7(a))throw new RangeError("Invalid time value");let l=e.match(aW).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=Z7[x];return g(m,i.formatLong)}return m}).join("").match(oW).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:dW(m)};if(lx[x])return{isToken:!0,value:m};if(x.match(hW))throw new RangeError("Format string contains an unescaped latin alphabet character `"+x+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const h={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(m=>{if(!m.isToken)return m.value;const x=m.value;(nW(x)||rW(x))&&iW(x,e,String(t));const g=lx[x[0]];return g(a,x,i.localize,h)}).join("")}function dW(t){const e=t.match(lW);return e?e[1].replace(cW,"'"):t}function pW(t,e,r){const n=ua(),i=(r==null?void 0:r.locale)??n.locale??T2,s=2520,o=cl(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 l,h;o>0?(l=oe(e),h=oe(t)):(l=oe(t),h=oe(e));const u=p7(h,l),d=(tc(h)-tc(l))/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<ox){const m=Math.round(f/60);return i.formatDistance("aboutXHours",m,a)}else{if(f<s)return i.formatDistance("xDays",1,a);if(f<$a){const m=Math.round(f/ox);return i.formatDistance("xDays",m,a)}else if(f<$a*2)return p=Math.round(f/$a),i.formatDistance("aboutXMonths",p,a)}if(p=d7(h,l),p<12){const m=Math.round(f/$a);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 fW(t,e){return pW(t,n7(t),e)}function N2({date:t,className:e}){if(!t)return c.jsx("span",{className:st("text-muted-foreground",e),children:"—"});let r;try{if(r=typeof t=="string"?new Date(t):t,isNaN(r.getTime()))return c.jsx("span",{className:st("text-muted-foreground",e),children:"—"})}catch{return c.jsx("span",{className:st("text-muted-foreground",e),children:"—"})}const n=fW(r,{addSuffix:!0}),i=uW(r,"PPpp");return c.jsx("time",{dateTime:r.toISOString(),title:i,className:st("text-muted-foreground tabular-nums",e),children:n})}function E2({sessions:t=[],items:e=[],onSelectItem:r,featureCode:n,focusActive:i,onToggleFocus:s}){const[o,a]=k.useState(""),[l,h]=k.useState("all"),[u,d]=k.useState("all"),f=k.useMemo(()=>t.filter(m=>m.status==="active").length,[t]),p=k.useMemo(()=>{let m=X9(t,{search:o,agentFilter:l,statusFilter:u});return i&&n&&(m=m.filter(x=>x.featureCode===n||x.feature_code===n)),m},[t,o,l,u,i,n]);return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[c.jsx(ea,{featureCode:n,active:i,onToggle:s}),c.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[c.jsx("span",{className:st("w-2 h-2 rounded-full",f>0?"bg-emerald-400":"bg-slate-600")}),c.jsxs("span",{className:"text-muted-foreground",children:[f," active"]})]}),c.jsx("div",{className:"h-4 w-px bg-border"}),c.jsxs("div",{className:"relative",children:[c.jsx(bn,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),c.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"})]}),c.jsxs("select",{value:l,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:[c.jsx("option",{value:"all",children:"All agents"}),l0.filter(m=>m!=="unassigned").map(m=>c.jsx("option",{value:m,children:m},m))]}),c.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:[c.jsx("option",{value:"all",children:"All status"}),["active","completed","failed","paused"].map(m=>c.jsx("option",{value:m,children:m},m))]}),c.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[p.length,"/",t.length]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[p.length===0&&c.jsx(ep,{icon:wd,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),p.map(m=>c.jsx(mW,{session:m,items:e,onSelectItem:r},m.id))]})]})}function mW({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=cf[n]||cf.exploring,a=i?e.find(l=>{var h;return l.featureCode===i||l.feature_code===i||((h=l.lifecycle)==null?void 0:h.featureCode)===i}):null;return c.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:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Z9,{agent:t.agent,size:"sm",className:"shrink-0"}),c.jsx(tp,{status:t.status,className:"shrink-0"}),n&&c.jsx("span",{className:st("text-[10px] px-1.5 py-0.5 rounded",o),children:n}),i&&c.jsx("button",{onClick:()=>a&&(r==null?void 0:r(a.id)),className:st("text-[10px] font-mono",a?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:i}),c.jsx(N2,{date:s,className:"ml-auto text-[10px] shrink-0"})]}),t.summary&&c.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:t.summary}),c.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[c.jsxs("span",{children:["📄 ",t.reads??0]}),c.jsxs("span",{children:["📤 ",t.writes??0]}),c.jsxs("span",{className:(t.errors??0)>0?"text-red-400":void 0,children:["⚠ ",t.errors??0]})]})]})}const dx=t=>Symbol.iterator in t,px=t=>"entries"in t,fx=(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},gW=(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 xW(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:dx(t)&&dx(e)?px(t)&&px(e)?fx(t,e):gW(t,e):fx({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function _i(t){const e=qt.useRef(void 0);return r=>{const n=t(r);return xW(e.current,n)?e.current:e.current=n}}function B2({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=fr(_i(g=>({items:g.items,gates:g.gates,sessions:g.sessions}))),[a,l]=k.useState(""),[h,u]=k.useState(0),d=k.useRef(null);k.useEffect(()=>{t&&(l(""),u(0),setTimeout(()=>{var g;return(g=d.current)==null?void 0:g.focus()},0))},[t]);const f=k.useMemo(()=>{if(!t)return[];if(!a.trim()){const w=s.filter(S=>S.status==="pending").slice(0,3).map(S=>({type:"gate",id:S.id,label:Io(S,i.find(N=>N.id===S.itemId)),sub:mn[S.stepId]?`${Ce[S.fromPhase]??S.fromPhase} → ${Ce[S.toPhase]??S.toPhase}`:null,status:"pending",gate:S})),_=i.filter(S=>S.status==="blocked").slice(0,3).map(S=>({type:"item",id:S.id,label:S.title,sub:S.type,status:S.status,item:S}));return[...w.length?[{type:"section",label:"Pending Gates"}]:[],...w,..._.length?[{type:"section",label:"Blocked Items"}]:[],..._]}const g=a.toLowerCase(),y=i.filter(w=>{var _,S;return((_=w.title)==null?void 0:_.toLowerCase().includes(g))||((S=w.featureCode)==null?void 0:S.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})),C=s.filter(w=>{var _;return(w.fromPhase||"").toLowerCase().includes(g)||(w.toPhase||"").toLowerCase().includes(g)||(((_=i.find(S=>S.id===w.itemId))==null?void 0:_.title)??"").toLowerCase().includes(g)}).slice(0,3).map(w=>({type:"gate",id:w.id,label:Io(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,...C.length?[{type:"section",label:"Gates"}]:[],...C,...b.length?[{type:"section",label:"Sessions"}]:[],...b]},[t,a,i,s,o]),p=f.filter(g=>g.type!=="section"),m=k.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?c.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh]",onClick:e,children:c.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:[c.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-slate-700/50",children:[c.jsx(bn,{className:"h-4 w-4 text-muted-foreground shrink-0"}),c.jsx("input",{ref:d,value:a,onChange:g=>{l(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"}),c.jsx("kbd",{className:"text-[10px] text-muted-foreground border border-border rounded px-1 py-0.5",children:"esc"})]}),c.jsxs("div",{className:"max-h-80 overflow-y-auto py-1",children:[f.length===0&&c.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 c.jsx("div",{className:"px-4 pt-2 pb-1",children:c.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:g.label})},`section-${y}`);const C=x++,b=h===C;return c.jsxs("button",{className:st("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(C),onClick:()=>{g.type==="gate"?n==null||n(g.id):g.type==="item"?r==null||r(g.id):e()},children:[g.type==="gate"&&c.jsx(Bs,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&c.jsx(oc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&c.jsx(wd,{className:"h-4 w-4 text-blue-400 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm text-foreground truncate",children:g.label}),g.sub&&c.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:g.sub})]}),g.status&&c.jsx(tp,{status:g.status})]},g.id)})]}),c.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/50 text-[10px] text-muted-foreground",children:[c.jsxs("span",{children:[c.jsx("kbd",{className:"border border-border rounded px-1",children:"↑↓"})," navigate"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"border border-border rounded px-1",children:"↵"})," select"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"border border-border rounded px-1",children:"esc"})," close"]})]})]})}):null}const Ra=[{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"}}],yW=["gate","flag","skip"];function mx(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function L2({open:t,onClose:e,parentItem:r,initialType:n="task"}){const i=fr(b=>b.createItem),[s,o]=k.useState(()=>mx(r)),[a,l]=k.useState("task"),[h,u]=k.useState(!1),[d,f]=k.useState(!1),[p,m]=k.useState(""),x=k.useRef(null);k.useEffect(()=>{if(t){const b=Ra.find(_=>_.id===n)||Ra.find(_=>_.id==="task"),w=mx(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}),l(b.id),u(!1),m(""),setTimeout(()=>{var _;return(_=x.current)==null?void 0:_.focus()},50)}},[t,r,n]);const g=b=>{const w=Ra.find(_=>_.id===b);w&&(l(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)}},C=b=>{b.key==="Enter"&&!b.shiftKey&&b.target.tagName!=="TEXTAREA"&&(b.preventDefault(),y())};return c.jsx(bd,{open:t,onOpenChange:b=>!b&&e(),children:c.jsxs(Cd,{className:"max-w-md",onKeyDown:C,children:[c.jsx(kd,{children:c.jsx(vd,{children:"New Item"})}),c.jsxs("div",{className:"px-6 pb-2 space-y-4",children:[c.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:Ra.map(b=>c.jsx("button",{type:"button",onClick:()=>g(b.id),className:st("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))}),c.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"}),c.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"}),c.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?c.jsx(Zx,{className:"h-3 w-3"}):c.jsx(Es,{className:"h-3 w-3"}),"Advanced"]}),h&&c.jsxs("div",{className:"space-y-3 border border-border/40 rounded-md p-3 bg-muted/20",children:[c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Feature Code"}),c.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"})]}),c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Phase"}),c.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:o0.map(b=>c.jsx("option",{value:b,children:dl[b]??b},b))})]}),c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Priority"}),c.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:[c.jsx("option",{value:0,children:"Low (0)"}),c.jsx("option",{value:1,children:"Normal (1)"}),c.jsx("option",{value:2,children:"High (2)"}),c.jsx("option",{value:3,children:"Critical (3)"})]})]}),c.jsxs("label",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Assign to"}),c.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:l0.map(b=>c.jsx("option",{value:b,children:b},b))})]}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Governance"}),c.jsx("div",{className:"flex gap-1.5",children:yW.map(b=>c.jsx("button",{type:"button",onClick:()=>o(w=>({...w,governance:b})),className:st("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&&c.jsx("p",{className:"text-xs text-destructive",children:p})]}),c.jsxs(Gx,{children:[c.jsx(Pt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),c.jsx(Pt,{size:"sm",onClick:y,disabled:d||!s.title.trim(),children:d?"Creating…":"Create"})]})]})})}const bW=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],CW=[{id:"gate",Icon:Bs,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:e0,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:s0,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function kW(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 A2({open:t,onClose:e,settings:r,onSettingsChange:n}){const[i,s]=k.useState(!1),o=k.useRef(null),a=k.useCallback((l,h)=>{n==null||n({governance:{phases:{[l]:h}}}),clearTimeout(o.current),s(!0),o.current=setTimeout(()=>s(!1),1500)},[n]);return c.jsx(bd,{open:t,onOpenChange:l=>!l&&e(),children:c.jsxs(Cd,{className:"max-w-sm",children:[c.jsx(kd,{children:c.jsxs("div",{className:"flex items-center justify-between pr-6",children:[c.jsx(vd,{children:"Governance Settings"}),i&&c.jsx("span",{className:"text-[11px] text-emerald-400 font-medium",children:"Saved ✓"})]})}),c.jsx("div",{className:"px-6 pb-6 space-y-1 max-h-96 overflow-y-auto",children:bW.map(l=>{const h=l==="explore_design",u=kW(r,l),d=Ce[l]??l;return c.jsxs("div",{className:st("flex items-center gap-3 rounded-md px-2 py-1.5",h&&"opacity-40"),children:[c.jsx("span",{className:st("text-xs flex-1 min-w-0 truncate",h?"text-muted-foreground":"text-foreground"),children:d}),h?c.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"no policy"}):c.jsx("div",{className:"flex gap-1 shrink-0",children:CW.map(f=>{const p=u===f.id,{Icon:m}=f;return c.jsxs("button",{onClick:()=>a(l,f.id),title:f.label,className:st("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:[c.jsx(m,{className:"h-2.5 w-2.5"}),f.label]},f.id)})})]},l)})}),c.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 M2({onOpenGate:t}){const{gates:e,items:r}=fr(_i(g=>({gates:g.gates,items:g.items}))),[n,i]=k.useState(new Set),[s,o]=k.useState(0),a=e.filter(g=>g.status==="pending"&&!n.has(g.id));if(a.length===0)return null;const l=Math.min(s,a.length-1),h=a[l],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=Io(h,u),f=zT[h.fromPhase]??WT,p=()=>{i(g=>new Set([...g,h.id])),l>=a.length-1&&l>0&&o(l-1)},m=()=>o(Math.max(0,l-1)),x=()=>o(Math.min(a.length-1,l+1));return c.jsxs("div",{className:st("shrink-0 h-10 border-t flex items-center gap-2 px-3",f.bg,f.border),children:[c.jsx(Bs,{className:st("h-3.5 w-3.5 shrink-0",f.text)}),c.jsx("span",{className:st("text-[11px] font-medium truncate flex-1 min-w-0",f.text),children:d}),a.length>1&&c.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[c.jsx("button",{onClick:m,disabled:l===0,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:c.jsx(Qx,{className:"h-3 w-3"})}),c.jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[l+1,"/",a.length]}),c.jsx("button",{onClick:x,disabled:l===a.length-1,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:c.jsx(pi,{className:"h-3 w-3"})})]}),c.jsx("button",{onClick:()=>t==null?void 0:t(h.id),className:st("shrink-0 text-[10px] px-2 py-0.5 rounded border transition-colors hover:opacity-80",f.border,f.text),children:"Review"}),c.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:c.jsx(yn,{className:"h-3 w-3"})})]})}const vW="●",wW="text-zinc-400";function SW(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 TW(t){var e;return((e=c0[t])==null?void 0:e.icon)??vW}function _W(t){var e;return((e=c0[t])==null?void 0:e.color)??wW}const jW={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 NW(t){return jW[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function EW(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function BW(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function LW({event:t,now:e}){const r=TW(t.kind),n=_W(t.kind),i=SW(t.timestamp,e);return c.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:[c.jsxs("div",{className:"flex items-center justify-between gap-1",children:[c.jsx("span",{className:st("text-[11px] shrink-0",n),children:r}),c.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:i||BW(t.timestamp)})]}),c.jsx("p",{className:"text-[11px] text-foreground/80 truncate leading-tight",children:t.title}),t.roles&&t.roles.length>0&&c.jsx("div",{className:"flex flex-wrap gap-0.5 mt-0.5",children:t.roles.map((s,o)=>c.jsx("span",{"data-role-chip":!0,className:st("text-[9px] px-1 py-px rounded-full leading-tight",NW(s.name)),children:s.name},o))})]})}function I2({events:t=[],currentFeatureCode:e,now:r}){const n=EW(t,e);return n.length===0?null:c.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:c.jsx("div",{className:"flex items-center gap-2 px-3 h-full",children:n.map(i=>c.jsx(LW,{event:i,now:r},i.id))})})}function AW(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 MW="Select a feature to see status.";function F2({featureCode:t,snapshot:e}){const[r,n]=k.useState(!1),i=k.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??MW,o=AW(e);return c.jsxs(c.Fragment,{children:[c.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:[c.jsx("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1},children:s}),c.jsx("span",{style:{marginLeft:8,opacity:.5,fontSize:10},"aria-hidden":"true",children:r?"▲":"▼"})]}),r&&c.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:c.jsx("div",{style:{padding:"8px 12px"},children:o.length===0?c.jsx("span",{className:"text-muted-foreground",children:"No details available."}):c.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:c.jsx("tbody",{children:o.map((a,l)=>c.jsxs("tr",{children:[c.jsx("td",{style:{paddingRight:16,paddingBottom:2,fontWeight:500,whiteSpace:"nowrap"},className:"text-foreground/60",children:a.label}),c.jsx("td",{style:{paddingBottom:2},children:String(a.value)})]},l))})})})})]})}function IW({onContextSelect:t,sidebarOpen:e=!0,onToggleSidebar:r}){const{items:n,connections:i,connected:s,uiCommand:o,clearUICommand:a,recentChanges:l,createItem:h,updateItem:u,deleteItem:d,createConnection:f,deleteConnection:p,agentActivity:m,agentErrors:x,sessionState:g,registerSnapshotProvider:y,gates:C,gateEvent:b,resolveGate:w,settings:_,updateSettings:S,resetSettings:N,activeBuild:A,setActiveBuild:L,pipelineDraft:j,sessions:F,selectedPhase:z,setSelectedPhase:W,decisionEvents:P,statusSnapshots:I,setStatusSnapshot:M}=fr(),[O,$]=k.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),B=k.useRef(!!sessionStorage.getItem("vision-activeView")),[T,G]=k.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[tt,D]=k.useState(""),[V,ht]=k.useState(null),[ct,Ft]=k.useState(!1),[_t,lt]=k.useState(!1),[Y,ot]=k.useState(!1);k.useEffect(()=>{sessionStorage.setItem("vision-activeView",T)},[T]),k.useEffect(()=>{O?sessionStorage.setItem("vision-selectedItemId",O):sessionStorage.removeItem("vision-selectedItemId")},[O]);const kt=k.useRef(!1);k.useEffect(()=>{var Z;(Z=_==null?void 0:_.ui)!=null&&Z.defaultView&&!kt.current&&!B.current&&(G(_.ui.defaultView),kt.current=!0)},[_]),k.useEffect(()=>{o&&(o.view&&G(o.view),o.phase!==void 0&&W(o.phase),o.select!==void 0&&$(o.select),a())},[o,a]),k.useEffect(()=>{const Z=()=>{var H;return["INPUT","TEXTAREA","SELECT"].includes((H=document.activeElement)==null?void 0:H.tagName)},dt=H=>{(H.metaKey||H.ctrlKey)&&H.key==="k"&&(H.preventDefault(),Ft(rt=>!rt)),(H.metaKey||H.ctrlKey)&&H.key==="n"&&(H.preventDefault(),lt(!0)),H.key===","&&!H.metaKey&&!H.ctrlKey&&!Z()&&ot(!0)};return window.addEventListener("keydown",dt),()=>window.removeEventListener("keydown",dt)},[]);const Tt=k.useMemo(()=>{let Z=n;if(z&&(Z=Z.filter(dt=>dt.phase===z)),tt){const dt=tt.toLowerCase();Z=Z.filter(H=>H.title.toLowerCase().includes(dt)||(H.description||"").toLowerCase().includes(dt))}return Z},[n,z,tt]),ee=k.useMemo(()=>z?n.filter(Z=>Z.phase===z):n,[n,z]),le=k.useMemo(()=>new Set(ee.map(Z=>Z.id)),[ee]),Zt=k.useMemo(()=>z?C.filter(Z=>le.has(Z.itemId)):C,[C,le,z]),$e=k.useMemo(()=>{if(!z&&!tt)return i;const Z=new Set(Tt.map(dt=>dt.id));return i.filter(dt=>Z.has(dt.fromId)&&Z.has(dt.toId))},[i,Tt,z,tt]);k.useEffect(()=>{y(()=>({activeView:T,selectedPhase:z,searchQuery:tt,selectedItemId:O,totalItems:n.length,filteredCount:Tt.length,connected:s}))},[y,T,z,tt,O,n.length,Tt.length,s]);const Xt=k.useCallback(Z=>{$(Z),t&&t({type:"item",id:Z})},[t]),Re=k.useCallback((Z,dt)=>{u(Z,dt)},[u]);k.useCallback(async()=>{const dt=await h({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:z||"vision"});dt&&dt.id&&$(dt.id)},[h,z]),k.useCallback(async Z=>{await d(Z),O===Z&&($(null),t&&t(null))},[d,O,t]);const re=k.useCallback(Z=>{const dt=C.find(H=>H.id===Z);dt&&($(dt.itemId),t&&t({type:"item",id:dt.itemId}))},[C,t]);k.useCallback(async Z=>f(Z),[f]),k.useCallback(async Z=>p(Z),[p]);const Ae=k.useCallback(()=>{Mt("/api/build/state").then(Z=>Z.json()).then(Z=>L(Z.state??null)).catch(()=>{})},[L]),X=k.useCallback(Z=>{t&&t({type:"step",id:Z})},[t]),nt=k.useMemo(()=>{var dt;if(!O)return null;const Z=n.find(H=>H.id===O);return((dt=Z==null?void 0:Z.lifecycle)==null?void 0:dt.featureCode)||null},[O,n]);return k.useEffect(()=>{nt&&(I&&I[nt]||Mt(`/api/lifecycle/status?featureCode=${encodeURIComponent(nt)}`).then(Z=>Z.json()).then(Z=>{Z.snapshot&&M&&M(nt,Z.snapshot)}).catch(()=>{}))},[nt]),c.jsx(dc.Provider,{value:l,children:c.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[c.jsx(F2,{featureCode:nt,snapshot:nt?(I==null?void 0:I[nt])??null:null}),nt&&c.jsx(I2,{events:P,currentFeatureCode:nt}),c.jsxs("div",{className:"flex-1 flex min-h-0",children:[c.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[r&&c.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&&c.jsx(Oy,{items:n,gates:C,activeBuild:A,activeView:T,onViewChange:G,selectedPhase:z,onPhaseSelect:W,searchQuery:tt,onSearchChange:D,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Xt,onThemeChange:S,onNewItem:()=>lt(!0)})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[!s&&c.jsx("div",{className:"text-center text-[10px] py-0.5 bg-destructive text-destructive-foreground",children:"Disconnected — reconnecting..."}),T==="tree"&&c.jsx(Ry,{items:Tt,connections:$e,selectedItemId:O,onSelect:Xt}),T==="graph"&&c.jsx(Wy,{items:Tt,connections:$e,selectedItemId:O,onSelect:Xt}),T==="pipeline"&&c.jsx(v2,{activeBuild:A,pipelineDraft:j,onSelectStep:X,onRefresh:Ae}),T==="sessions"&&c.jsx(E2,{sessions:F,items:n,onSelectItem:Xt}),T==="docs"&&c.jsx(g2,{items:ee}),T==="gates"&&c.jsx(y2,{gates:Zt,items:ee,onResolve:w,onSelect:Xt}),T==="settings"&&c.jsx(k2,{settings:_,onSettingsChange:S,onReset:N})]}),c.jsx(M2,{onOpenGate:re}),V&&(()=>{const Z=n.find(dt=>dt.id===V);return Z?c.jsx(C2,{item:Z,items:n,connections:i,onUpdate:Re,onClose:()=>ht(null)}):null})(),c.jsx(b2,{event:b,items:n,onNavigate:()=>G("gates")}),c.jsx(B2,{open:ct,onClose:()=>Ft(!1),onSelectItem:Z=>{Xt(Z),Ft(!1)},onSelectGate:Z=>{re(Z),Ft(!1)}}),c.jsx(L2,{open:_t,onClose:()=>lt(!1)}),c.jsx(A2,{open:Y,onClose:()=>ot(!1),settings:_,onSettingsChange:S})]})]})})}Ko.use(Xx);const FW={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},DW={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function PW(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 OW(){const[t,e]=k.useState(()=>document.documentElement.classList.contains("dark"));return k.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const $W={"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}},RW={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function zW(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 ec="compose:graph:";function WW(t){try{const e=localStorage.getItem(ec+t);return e?JSON.parse(e):null}catch{return null}}function qW(t,e){try{localStorage.setItem(ec+t,JSON.stringify(e))}catch{}}const HW=[{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 Xi({onClick:t,active:e,children:r,title:n}){return c.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 za({mode:t,active:e,onClick:r}){return c.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 Fh(){return c.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function gx({arrow:t,label:e,edgeStyle:r,color:n,targetLabel:i,targetColor:s,suffix:o}){return c.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:t}),c.jsx("span",{style:{color:n||"hsl(var(--muted-foreground))",fontStyle:r==="dashed"?"italic":"normal"},children:e||"connects"}),i?c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s||"hsl(var(--muted-foreground) / 0.6)"}}),c.jsx("span",{style:{color:"hsl(var(--foreground))"},children:i})]})]}):o?c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:o}):null,r&&r!=="solid"&&c.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",r,")"]})]})}function UW({nodes:t,edges:e,graphKey:r}){const[n,i]=k.useState(()=>{try{const l=localStorage.getItem(ec+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});k.useEffect(()=>{try{localStorage.setItem(ec+r+":tree-collapsed",JSON.stringify([...n]))}catch{}},[n,r]);const s=k.useMemo(()=>{const l={};for(const h of t)l[h.id]=h;return l},[t]),o=k.useMemo(()=>{var u,d;const l={},h={};for(const f of t)l[f.id]=[],h[f.id]=[];for(const f of e)(u=l[f.from])==null||u.push(f),(d=h[f.to])==null||d.push(f);return{out:l,inc:h}},[t,e]),a=l=>i(h=>{const u=new Set(h);return u.has(l)?u.delete(l):u.add(l),u});return c.jsxs("div",{className:"w-full h-full overflow-y-auto",style:{background:"hsl(var(--background))",padding:"1rem"},children:[c.jsxs("div",{className:"flex items-center mb-4",style:{gap:"8px"},children:[c.jsx(Xi,{onClick:()=>i(new Set),children:"Expand all"}),c.jsx(Xi,{onClick:()=>i(new Set(t.map(l=>l.id))),children:"Collapse all"}),c.jsxs("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground))"},children:[t.length," entities · ",e.length," relations"]})]}),t.map(l=>{const h=n.has(l.id),u=o.out[l.id]||[],d=o.inc[l.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 c.jsxs("div",{className:"mb-0.5",children:[c.jsxs("button",{onClick:()=>a(l.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:[c.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:"▼"}),c.jsx("span",{className:"w-3 h-3 shrink-0",style:{borderRadius:l.shape==="diamond"?0:3,background:l.color,transform:l.shape==="diamond"?"rotate(45deg) scale(0.8)":"none"}}),c.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:l.label}),l.sublabel&&c.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:["— ",l.sublabel]}),c.jsx("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:x})]}),!h&&c.jsxs("div",{style:{paddingLeft:"32px",paddingBottom:"4px"},children:[p.map((g,y)=>{var C,b;return c.jsx(gx,{arrow:"→",label:g.label,edgeStyle:g.style,color:g.color,targetLabel:((C=s[g.to])==null?void 0:C.label)||g.to,targetColor:(b=s[g.to])==null?void 0:b.color},`out-${y}`)}),f.map((g,y)=>c.jsx(gx,{arrow:"↻",label:g.label,edgeStyle:g.style,color:g.color,suffix:"(self)"},`self-${y}`)),m.map((g,y)=>{var C,b;return c.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:((C=s[g.from])==null?void 0:C.color)||"hsl(var(--muted-foreground) / 0.6)"}}),c.jsx("span",{style:{color:"hsl(var(--foreground))"},children:((b=s[g.from])==null?void 0:b.label)||g.from})]}),c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),c.jsx("span",{style:{color:g.color||"hsl(var(--muted-foreground))",fontStyle:g.style==="dashed"?"italic":"normal"},children:g.label||"connects"}),c.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→ this"}),g.style&&g.style!=="solid"&&c.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",g.style,")"]})]},`in-${y}`)}),x===0&&c.jsx("div",{className:"text-xs italic",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground) / 0.6)"},children:"no relations"})]})]},l.id)})]})}function YW({elements:t,nodes:e,edges:r,layout:n,style:i,title:s,subtitle:o,graphKey:a="default",onNodeClick:l}){const h=k.useRef(null),u=k.useRef(null),[d,f]=k.useState(null),p=OW(),m=p?FW:DW,x=k.useMemo(()=>WW(a),[a]),[g,y]=k.useState((x==null?void 0:x.layoutKey)||"dagre-tb"),[C,b]=k.useState((x==null?void 0:x.showEdgeLabels)??!0),[w,_]=k.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[S,N]=k.useState((x==null?void 0:x.showLegend)??!0),[A,L]=k.useState((x==null?void 0:x.viewMode)||"graph");k.useEffect(()=>{qW(a,{layoutKey:g,showEdgeLabels:C,hiddenNodes:[...w],showLegend:S,viewMode:A})},[a,g,C,w,S,A]);const j=t||(e&&r?zW(e,r):[]),F=k.useMemo(()=>i||PW(m),[i,p]),z=n||$W[g],W=k.useMemo(()=>j.filter(T=>!T.data.source).map(T=>({id:T.data.id,label:T.data.label,color:T.data.color})),[JSON.stringify(j)]),P=k.useMemo(()=>w.size===0?j:j.filter(T=>T.data.source?!w.has(T.data.source)&&!w.has(T.data.target):!w.has(T.data.id)),[j,w]);k.useEffect(()=>{if(!h.current)return;const T=Ko({container:h.current,elements:P,style:F,layout:z,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=T,T.on("mouseover","node",G=>{const tt=G.target;tt.style("border-width",2),tt.style("border-opacity",1);const D=tt.renderedPosition();f({x:D.x,y:D.y-tt.renderedHeight()/2-12,label:tt.data("label"),sublabel:tt.data("sublabel"),id:tt.id(),color:tt.data("color")})}),T.on("mouseout","node",G=>{G.target.style("border-width",1),G.target.style("border-opacity",.5),f(null)}),l&&T.on("tap","node",G=>l(G.target.id())),T.on("layoutstop",()=>T.fit(void 0,40)),()=>{T.destroy(),u.current=null}},[JSON.stringify(P),JSON.stringify(z),p,A]),k.useEffect(()=>{const T=u.current;T&&T.edges().forEach(G=>{G.data("label")&&G.style("label",C?G.data("label"):"")})},[C]);const I=k.useCallback(()=>{var T;return(T=u.current)==null?void 0:T.fit(void 0,40)},[]),M=k.useCallback(()=>{const T=u.current;T&&T.zoom({level:T.zoom()*1.3,renderedPosition:{x:T.width()/2,y:T.height()/2}})},[]),O=k.useCallback(()=>{const T=u.current;T&&T.zoom({level:T.zoom()/1.3,renderedPosition:{x:T.width()/2,y:T.height()/2}})},[]),$=k.useCallback(T=>{_(G=>{const tt=new Set(G);return tt.has(T)?tt.delete(T):tt.add(T),tt})},[]),B=k.useCallback(()=>_(new Set),[]);return A==="tree"?c.jsxs("div",{className:"w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[c.jsxs("div",{className:"flex items-center justify-between shrink-0",style:{padding:"8px 16px",borderBottom:"1px solid hsl(var(--border))"},children:[c.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[s&&c.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&c.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),c.jsxs("div",{className:"flex",style:{gap:"4px"},children:[c.jsx(za,{mode:"graph",active:A==="graph",onClick:()=>L("graph")}),c.jsx(za,{mode:"tree",active:A==="tree",onClick:()=>L("tree")})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(UW,{nodes:e||[],edges:r||[],graphKey:a})})]}):c.jsxs("div",{className:"w-full h-full relative",style:{background:"hsl(var(--background))"},children:[(s||o)&&c.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&&c.jsx("div",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&c.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),c.jsxs("div",{className:"absolute top-2 right-3 z-[2] flex items-center",style:{gap:"4px"},children:[c.jsx("select",{value:g,onChange:T=>y(T.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(RW).map(([T,G])=>c.jsx("option",{value:T,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:G},T))}),c.jsx(Fh,{}),c.jsx(Xi,{onClick:O,title:"Zoom out",children:"−"}),c.jsx(Xi,{onClick:I,title:"Fit to view",children:"Fit"}),c.jsx(Xi,{onClick:M,title:"Zoom in",children:"+"}),c.jsx(Fh,{}),c.jsx(Xi,{onClick:()=>N(!S),active:S,title:S?"Hide legend":"Show legend",children:"Legend"}),c.jsx(Fh,{}),c.jsx(za,{mode:"graph",active:A==="graph",onClick:()=>L("graph")}),c.jsx(za,{mode:"tree",active:A==="tree",onClick:()=>L("tree")})]}),S&&c.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:[c.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Entities"}),w.size>0&&c.jsx("button",{onClick:B,className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:"hsl(var(--primary))"},children:"Show all"})]}),c.jsx("div",{className:"flex flex-col gap-1",children:W.map(T=>{const G=w.has(T.id);return c.jsxs("button",{onClick:()=>$(T.id),className:"flex items-center gap-1.5 bg-transparent border-none py-0.5 cursor-pointer transition-opacity",style:{opacity:G?.35:1},title:G?`Show ${T.label}`:`Hide ${T.label}`,children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:G?"transparent":T.color,border:`1.5px solid ${T.color}`}}),c.jsx("span",{className:"text-xs",style:{color:G?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:G?"line-through":"none"},children:T.label})]},T.id)})}),c.jsxs("div",{className:"flex justify-between items-center mt-2.5 mb-1.5",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Edges"}),c.jsx("button",{onClick:()=>b(!C),className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:C?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:C?"Hide labels":"Show labels"})]}),c.jsx("div",{className:"flex flex-col gap-1",children:HW.map(T=>c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("svg",{width:"20",height:"6",className:"shrink-0",children:c.jsx("line",{x1:"0",y1:"3",x2:"20",y2:"3",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.5",strokeDasharray:T.dash||"none"})}),c.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:T.label})]},T.style))})]}),d&&c.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:[c.jsx("div",{className:"text-sm font-semibold",style:{color:d.color||"hsl(var(--foreground))"},children:d.label}),d.sublabel&&c.jsx("div",{className:"text-xs mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:d.sublabel}),c.jsx("div",{className:"text-[10px] mt-1 font-mono",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:d.id})]}),c.jsx("div",{ref:h,className:"w-full h-full"})]})}const $t={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"},GW=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:$t.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:$t.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:$t.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:$t.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:$t.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:$t.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:$t.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:$t.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:$t.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:$t.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:$t.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:$t.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:$t.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:$t.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:$t.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:$t.decision},{id:"question",label:"Question",sublabel:"may block progress",color:$t.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:$t.artifact}],VW=[{from:"p-vision",to:"p-specification",color:$t.pipeline},{from:"p-specification",to:"p-planning",color:$t.pipeline},{from:"p-planning",to:"p-implementation",color:$t.pipeline},{from:"p-implementation",to:"p-verification",color:$t.pipeline},{from:"p-verification",to:"p-release",color:$t.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:$t.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:$t.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:$t.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:$t.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:$t.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:$t.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:$t.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:$t.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:$t.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:$t.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:$t.track},{from:"task",to:"feature",label:"implements",color:$t.task},{from:"spec",to:"feature",label:"implements",color:$t.spec},{from:"feature",to:"feature",label:"blocks",color:$t.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:$t.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:$t.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:$t.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:$t.artifact},{from:"question",to:"decision",label:"contradicts",color:$t.question},{from:"feature",to:"p-vision",label:"enters",color:$t.feature,style:"dashed"}];function XW(){return c.jsx(YW,{graphKey:"product",nodes:GW,edges:VW,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const KW="compose-popout";function D2(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 Wa({path:t,onDock:e}){return c.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:[c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:D2(t)}),c.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:[c.jsx(xS,{style:{width:11,height:11}}),"pop in"]})]})}function QW({path:t}){const[e,r]=k.useState(null),[n,i]=k.useState(!0),s=k.useRef(null),o=k.useRef(null),a=t.startsWith("vision://")?"vision":t.startsWith("graph://")?"graph":t.endsWith(".html")||t.endsWith(".htm")?"html":"markdown";k.useEffect(()=>{document.title=D2(t)+" — Compose"},[t]),k.useEffect(()=>{const h=new BroadcastChannel(KW);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 l=k.useCallback(()=>{var h;(h=s.current)==null||h.postMessage({type:"popout-dock",path:t}),window.close()},[t]);return k.useEffect(()=>{if(a==="vision"||a==="graph"){i(!1);return}Mt(`/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]),k.useEffect(()=>{if(a==="vision"||a==="graph")return;const h=window.location.protocol==="https:"?"wss:":"ws:",u=new WebSocket(`${h}//${window.location.host}/ws/files`);return o.current=u,u.onmessage=d=>{try{const f=JSON.parse(d.data);f.type==="fileChanged"&&f.path===t&&r(f.content)}catch{}},()=>u.close()},[t,a]),n?c.jsx("div",{className:"h-screen w-screen flex items-center justify-center bg-background",children:c.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a==="vision"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Wa,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(IW,{})})]}):a==="graph"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Wa,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(XW,{})})]}):a==="html"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Wa,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx("iframe",{srcDoc:e,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin",title:t})})]}):c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Wa,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 overflow-y-auto px-8 py-6",children:c.jsx("div",{className:"canvas-markdown max-w-4xl mx-auto",children:c.jsx(Hd,{remarkPlugins:[Vd],children:e||""})})})]})}const ZW="/api/stratum";async function Ic(t,e={}){return(await Mt(`${ZW}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function JW(t,e){return Ic(t,{method:"POST",body:JSON.stringify(e)})}function P2({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 c.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 of(){return c.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function tq({onAction:t}){const[e,r]=k.useState(null),[n,i]=k.useState(null),[s,o]=k.useState({}),[a,l]=k.useState({}),h=k.useCallback(()=>{Ic("/gates").then(d=>{r(Array.isArray(d)?d:[]),i(null)}).catch(d=>i(d.message))},[]);k.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 JW(`/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?c.jsx(of,{}):c.jsxs("section",{children:[c.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&&c.jsxs("span",{style:{opacity:1,color:"#f59e0b"},children:["(",e.length,")"]})]}),n&&c.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em",margin:"0 0 8px"},children:n}),(e==null?void 0:e.length)===0&&c.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 c.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",marginBottom:8,background:"#18181b"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[c.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:d.flow_name||d.flow_id}),c.jsx("span",{style:{opacity:.4,fontSize:"0.8em"},children:"›"}),c.jsx("span",{style:{fontFamily:"monospace",fontSize:"0.82em",opacity:.7},children:d.step_id}),d.function&&c.jsxs("span",{style:{opacity:.4,fontSize:"0.78em"},children:["fn:",d.function]})]}),c.jsx("input",{type:"text",placeholder:"Note (optional)",value:a[f]||"",onChange:m=>l(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"}}),c.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})=>c.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 eq({flowId:t,onClose:e}){const[r,n]=k.useState(null),[i,s]=k.useState(null);return k.useEffect(()=>{Ic(`/flows/${t}`).then(o=>{o.error?s(o.error.message):n(o)}).catch(o=>s(o.message))},[t]),c.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",background:"#18181b"},children:[c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[c.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:(r==null?void 0:r.flow_name)||t}),c.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"1.1em"},children:"✕"})]}),i&&c.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:i}),!r&&!i&&c.jsx(of,{}),r&&c.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:[]),l=o.size,h=r.step_count??"?";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:[c.jsx("span",{children:c.jsx(P2,{status:r.status})}),c.jsxs("span",{children:["steps ",l,"/",h,a.size>0&&c.jsxs("span",{style:{marginLeft:6,color:"#34d399",fontSize:"0.85em"},children:["∥ ",a.size," running"]})]}),r.round>0&&c.jsxs("span",{children:["round ",r.round]})]}),Array.isArray(r.ordered_steps)&&r.ordered_steps.length>0&&c.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",lineHeight:1.7},children:r.ordered_steps.map(u=>c.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:[c.jsx("span",{style:{fontFamily:"monospace"},children:u.id}),u.mode==="gate"&&c.jsx("span",{style:{marginLeft:6,color:"#f59e0b",fontSize:"0.9em"},children:"gate"}),a.has(u.id)&&c.jsx("span",{style:{marginLeft:6,fontSize:"0.85em"},children:"∥ running"})]},u.id))})]})})()})]})}function rq({activeBuild:t}){const[e,r]=k.useState(null),[n,i]=k.useState(null),[s,o]=k.useState(null),a=k.useCallback(()=>{Ic("/flows").then(l=>{r(Array.isArray(l)?l:[]),i(null)}).catch(l=>i(l.message))},[]);return k.useEffect(()=>{a();const l=setInterval(a,15e3);return()=>clearInterval(l)},[a]),k.useEffect(()=>{t&&a()},[t,a]),e===null&&!n?c.jsx(of,{}):c.jsxs("section",{children:[c.jsx("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:"Flows"}),n&&c.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:n}),(e==null?void 0:e.length)===0&&c.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No flows found."}),e==null?void 0:e.map(l=>c.jsx("div",{onClick:()=>o(s===l.flow_id?null:l.flow_id),style:{border:`1px solid ${s===l.flow_id?"#6366f1":"#3f3f46"}`,borderRadius:6,padding:"8px 12px",marginBottom:6,background:s===l.flow_id?"#1e1b4b":"#18181b",cursor:"pointer"},children:c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[c.jsx("span",{style:{fontSize:"0.88em",fontWeight:500},children:l.flow_name||l.flow_id}),c.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[c.jsxs("span",{style:{fontSize:"0.78em",opacity:.5},children:[Array.isArray(l.completed_steps)?l.completed_steps.length:l.completed_steps??0,"/",l.step_count??"?"]}),c.jsx(P2,{status:l.status})]})]})},l.flow_id)),s&&c.jsx("div",{style:{marginTop:8},children:c.jsx(eq,{flowId:s,onClose:()=>o(null)})})]})}const nq={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 iq({build:t,onDismiss:e}){const r=t.status==="running",n=["complete","failed","aborted"].includes(t.status);k.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 c.jsxs("div",{style:{border:`1px solid ${r?"#22c55e33":"#3f3f46"}`,borderRadius:6,padding:"10px 12px",marginBottom:12,background:i[t.status]||"#18181b"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[r&&c.jsx("span",{style:nq}),c.jsx("span",{style:{fontWeight:600,fontSize:"0.88em"},children:t.featureCode}),c.jsx("span",{style:{opacity:.5,fontSize:"0.78em"},children:r?"building":t.status})]}),n&&t.status!=="complete"&&c.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"0.9em"},children:"✕"})]}),c.jsxs("div",{style:{fontSize:"0.8em",opacity:.7,marginTop:4,fontFamily:"monospace"},children:[t.currentStepId,t.stepNum!=null&&t.totalSteps!=null&&c.jsxs("span",{style:{marginLeft:8,opacity:.5},children:["(",t.stepNum,"/",t.totalSteps,")"]}),t.retries>0&&c.jsxs("span",{style:{marginLeft:8,color:"#f59e0b"},children:["retry ",t.retries]})]})]})}function sq(){const t=fr(s=>s.activeBuild),[e,r]=k.useState(null),n=k.useCallback(()=>{t&&r(`${t.flowId}:${t.completedAt}`)},[t]);k.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 c.jsxs("div",{style:{padding:"12px 14px",color:"#e4e4e7",fontSize:"0.9em",overflowY:"auto",height:"100%"},children:[i&&c.jsx(iq,{build:t,onDismiss:n}),c.jsx(tq,{}),c.jsx("div",{style:{marginTop:20},children:c.jsx(rq,{activeBuild:t})})]})}function oq({projectName:t,projectRoot:e,onSwitch:r}){const[n,i]=k.useState(!1),[s,o]=k.useState(e||""),a=k.useRef(null);return k.useEffect(()=>{o(e||"")},[e]),k.useEffect(()=>{if(!n)return;const l=h=>{var u;(u=a.current)!=null&&u.contains(h.target)||i(!1)};return window.addEventListener("mousedown",l),()=>window.removeEventListener("mousedown",l)},[n]),k.useEffect(()=>{if(!n)return;const l=h=>{h.key==="Escape"&&i(!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]),c.jsxs("div",{ref:a,className:"flex items-center shrink-0 gap-2 relative",children:[c.jsx("span",{className:"text-xs font-semibold tracking-widest uppercase text-blue-600 dark:text-accent",children:"Compose"}),c.jsx("button",{"data-testid":"project-btn",className:"text-[10px] uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(l=>!l),title:e||"Switch project","aria-label":"Switch project","aria-haspopup":"dialog","aria-expanded":n,children:t||"no project"}),n&&c.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:[c.jsxs("div",{className:"text-[10px] text-muted-foreground mb-1 px-1",children:["Current: ",e]}),c.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:l=>o(l.target.value),onKeyDown:async l=>{l.key==="Enter"&&await r(s)&&i(!1),l.key==="Escape"&&i(!1)}})]})]})}const aq={dashboard:{label:"Dashboard",icon:tT,tip:"Overview of project status and activity"},tree:{label:"Items",icon:r0,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:uT,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:DT,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:wd,tip:"Active and past agent sessions"},"build-history":{label:"Builds",icon:Gh,tip:"History of past build runs and outcomes"},gates:{label:"Gates",icon:Bs,tip:"Quality gates and approval checkpoints"},docs:{label:"Docs",icon:wi,tip:"Project documentation and specs"},design:{label:"Design",icon:sc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:fi,tip:"Captured ideas and suggestions"}};function lq({tabs:t=[],activeTab:e,onTabChange:r,onOpenPalette:n,badges:i={}}){return c.jsxs("div",{className:"flex items-center gap-0.5 h-full",role:"tablist","aria-label":"Main views",children:[t.map(s=>{const o=aq[s],a=s===e,l=o==null?void 0:o.icon,h=(o==null?void 0:o.label)||s,u=i[s];return c.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:[l&&c.jsx(l,{style:{width:12,height:12}}),h,u>0&&c.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)}),c.jsx("div",{className:"flex-1"}),n&&c.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:[c.jsx(bn,{style:{width:12,height:12}}),c.jsx("kbd",{className:"text-[9px] font-mono opacity-50 bg-muted px-1 py-0.5 rounded",children:"⌘K"})]})]})}function cq(){const[t,e]=k.useState(u0);function r(){const n=!t;h_(n),e(n)}return c.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 He={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},hq={[He.COLLAPSED]:He.EXPANDED,[He.EXPANDED]:He.MAXIMIZED,[He.MAXIMIZED]:He.COLLAPSED};function uq(t){return hq[t]??He.COLLAPSED}function dq(t){return He.COLLAPSED}function pq(t){return He.MAXIMIZED}const fq=new Set(Object.values(He));function mq(t){return fq.has(t)}function gq(t){switch(t){case He.COLLAPSED:return"h-7";case He.EXPANDED:return"h-[40vh]";case He.MAXIMIZED:return"flex-1";default:return"h-7"}}const O2="compose:agentBarState";function xq(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(O2);return mq(e)?e:He.COLLAPSED}catch{return He.COLLAPSED}}function yq(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(O2,t)}catch{}}const xx="▾",bq="▴",Cq="⤢";function kq({barState:t="collapsed",onStateChange:e}){const[r,n]=k.useState("ready"),[i,s]=k.useState(null);k.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:C,active:b}=x;n(`∥ ${y}/${g} tasks${C?` (${C} 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=k.useCallback(()=>{e==null||e(uq(t))},[t,e]),a=k.useCallback(()=>{e==null||e(dq())},[t,e]);k.useCallback(()=>{e==null||e(pq())},[t,e]);const l=t==="collapsed",h=t==="expanded";return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{borderTop:"1px solid hsl(var(--border))"},"data-agent-bar-state":t,children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 h-7 shrink-0 select-none",style:{borderBottom:l?"none":"1px solid hsl(var(--border) / 0.5)"},children:[c.jsx("button",{className:"compose-btn-icon shrink-0",onClick:o,title:l?"Expand agent bar":h?"Maximize agent bar":"Collapse agent bar","aria-label":"Toggle agent bar",children:l?bq:h?Cq:xx}),c.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold shrink-0",style:{color:"hsl(var(--accent))"},children:"Agent"}),c.jsx("span",{className:"flex-1 min-w-0 truncate text-[11px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:r}),c.jsx(cq,{}),i&&i.total>0&&c.jsx("div",{className:"shrink-0 flex items-center gap-1",title:`${i.completed}/${i.total} tasks complete`,children:c.jsx("div",{style:{width:48,height:4,borderRadius:2,background:"hsl(var(--muted))",overflow:"hidden"},children:c.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"}})})}),!l&&c.jsx("button",{className:"compose-btn-icon shrink-0",onClick:a,title:"Collapse agent bar","aria-label":"Collapse agent bar",children:xx})]}),!l&&c.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:c.jsx(f0,{})})]})}const vq=280,wq=.6;function Sq({isOpen:t=!1,onToggle:e,widthPx:r=380,onResizePx:n,children:i,activeBuild:s,gates:o=[],agentErrors:a=[],items:l=[]}){const h=k.useRef(!1),u=k.useCallback(f=>{f.preventDefault(),h.current=!0;const p=x=>{if(!h.current)return;const g=window.innerWidth-x.clientX,y=window.innerWidth*wq,C=Math.max(vq,Math.min(y,g));n==null||n(C)},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 c.jsxs("div",{className:"flex shrink-0 h-full",style:{borderLeft:"1px solid hsl(var(--border))"},"data-context-panel-open":t,children:[t&&n&&c.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0",onMouseDown:u}),c.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&&c.jsx("div",{className:"flex flex-col h-full overflow-hidden",style:{width:`${r}px`},children:qt.Children.toArray(i).length>0?c.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):c.jsx(_q,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const Tq={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function yx(t){return Tq[t]||"#6b7280"}function _q({activeBuild:t,pendingGates:e,agentErrors:r,items:n}){const i={};for(const a of n){const l=a.phase||"unknown";i[l]=(i[l]||0)+1}const s=n.length||1,o=r.slice(-5);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"h-7 flex items-center px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:c.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-muted-foreground",children:"Project Overview"})}),c.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-3 space-y-4",children:[t?c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Active Build"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-accent font-mono",children:t.featureCode||"—"}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),c.jsx("span",{className:"text-[10px] text-foreground",children:t.currentStep||t.step||"—"})]})]}):c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Status"}),c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No active build"})]}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Pending Gates (",e.length,")"]}),e.length===0?c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):c.jsx("div",{className:"space-y-0.5",children:e.slice(0,5).map((a,l)=>c.jsx("p",{className:"text-[10px] text-amber-400 truncate",children:Io(a,n.find(h=>h.id===a.itemId))},l))})]}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Recent Errors (",o.length,")"]}),o.length===0?c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):c.jsx("div",{className:"space-y-0.5",children:o.map((a,l)=>c.jsx("p",{className:"text-[10px] text-destructive truncate",children:a.message||a.error||"Error"},l))})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase Distribution"}),c.jsx("div",{className:"flex h-2 rounded overflow-hidden gap-px",children:Object.entries(i).map(([a,l])=>c.jsx("div",{className:"h-full",style:{width:`${l/s*100}%`,background:yx(a),opacity:.75,minWidth:"2px"},title:`${a}: ${l}`},a))}),c.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1",children:Object.entries(i).map(([a,l])=>c.jsxs("span",{className:"text-[9px] text-muted-foreground flex items-center gap-1",children:[c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:yx(a)}}),a,": ",l]},a))})]})]})]})}const Bn=60,Ar=24,qa=80,Dh=28,Ph=48,bx=8,es=5,rc=9;function jq(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function Nq(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 l=n.get(a.fromId);l&&i.push(l)}if(a.fromId===t.id){const l=n.get(a.toId);l&&s.push(l)}}for(const a of s){const l=[];for(const h of r)if(h.fromId===a.id&&h.toId!==t.id){const u=n.get(h.toId);u&&l.push(u)}l.length>0&&o.set(a.id,l)}return{parents:i,children:s,grandchildren:o}}function Oh(t,e,r,n,i){const s=Math.min(t,es),o=s*n+(s-1)*bx,a=(r-o)/2,l=[];for(let h=0;h<s;h++)l.push({x:a+h*(n+bx),y:e,w:n,h:i});return{positions:l,overflow:t>es?t-es+1:0}}function Ha({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:h}){const u=mr[t.type]||mr.task,d=s?.2:.08;return c.jsxs("g",{style:{cursor:"pointer"},onClick:()=>a(t.id),onMouseEnter:f=>l(t,f),onMouseLeave:h,children:[c.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}),c.jsx("text",{x:e+n/2,y:r+i/2,textAnchor:"middle",dominantBaseline:"central",fontSize:s?rc+1:rc,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:jq(t.title,s?10:8)})]})}function Eq({item:t,pos:e}){if(!t||!e)return null;const r=mr[t.type]||mr.task,n=On[t.status]||On.planned;return c.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:[c.jsx("p",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:t.title}),c.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[c.jsx("span",{className:"text-[10px]",style:{color:r},children:t.type}),c.jsxs("span",{className:"text-[10px] flex items-center gap-1",children:[c.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:n}}),t.status]}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:Nd[t.confidence||0]})]})]})}function Bq({item:t,items:e,connections:r,onSelect:n}){const[i,s]=k.useState(null),[o,a]=k.useState(null),{parents:l,children:h,grandchildren:u}=k.useMemo(()=>Nq(t,e,r),[t,e,r]),d=k.useCallback((I,M)=>{const O=M.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),$=M.currentTarget.getBoundingClientRect();s(I),a({x:$.x+$.width/2-O.x,y:$.y-O.y-4})},[]),f=k.useCallback(()=>{s(null),a(null)},[]);if(!(l.length>0||h.length>0))return null;const m=288,x=[];let g=12,y=[],C=0;if(l.length>0){const I=Oh(l.length,g,m,Bn,Ar);y=I.positions,C=I.overflow,g+=Ar+Ph}const b=(m-qa)/2,w=g;g+=Dh+Ph;let _=[],S=0;if(h.length>0){const I=Oh(h.length,g,m,Bn,Ar);_=I.positions,S=I.overflow,g+=Ar}let N=new Map,A=new Map;const L=[...u.entries()];let j=[];if(L.length>0){g+=Ph;for(const[O,$]of L)for(const B of $)j.push({...B,_parentChildId:O});const I=Oh(j.length,g,m,Bn,Ar);let M=0;for(const[O,$]of L){const B=[];for(let T=0;T<$.length&&M<I.positions.length;T++,M++)B.push(I.positions[M]);N.set(O,B)}I.overflow>0&&A.set("all",I.overflow),g+=Ar}const F=g+12;for(let I=0;I<y.length;I++){const M=y[I];x.push({x1:M.x+M.w/2,y1:M.y+M.h,x2:b+qa/2,y2:w})}for(let I=0;I<_.length;I++){const M=_[I];x.push({x1:b+qa/2,y1:w+Dh,x2:M.x+M.w/2,y2:M.y})}for(const[I,M]of N){const O=h.findIndex($=>$.id===I);if(O>=0&&O<_.length){const $=_[O];for(const B of M)x.push({x1:$.x+$.w/2,y1:$.y+$.h,x2:B.x+B.w/2,y2:B.y})}}const z=l.slice(0,es-(C>0?1:0)),W=h.slice(0,es-(S>0?1:0)),P=j.slice(0,es-(A.size>0?1:0));return c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Graph"}),c.jsxs("div",{className:"relative connection-graph-wrap",children:[c.jsxs("svg",{width:m,height:F,className:"w-full",viewBox:`0 0 ${m} ${F}`,children:[x.map((I,M)=>c.jsx("line",{x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},M)),z.map((I,M)=>c.jsx(Ha,{item:I,x:y[M].x,y:y[M].y,w:Bn,h:Ar,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:f},I.id)),C>0&&c.jsxs("text",{x:y[y.length-1].x+Bn/2,y:y[0].y+Ar/2,textAnchor:"middle",dominantBaseline:"central",fontSize:rc,fill:"hsl(var(--muted-foreground))",children:["+",C," more"]}),c.jsx(Ha,{item:t,x:b,y:w,w:qa,h:Dh,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:f}),W.map((I,M)=>c.jsx(Ha,{item:I,x:_[M].x,y:_[M].y,w:Bn,h:Ar,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},I.id)),S>0&&c.jsxs("text",{x:_[_.length-1].x+Bn/2,y:_[0].y+Ar/2,textAnchor:"middle",dominantBaseline:"central",fontSize:rc,fill:"hsl(var(--muted-foreground))",children:["+",S," more"]}),P.map((I,M)=>{const $=[...N.values()].flat()[M];return $?c.jsx(Ha,{item:I,x:$.x,y:$.y,w:Bn,h:Ar,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},I.id):null})]}),c.jsx(Eq,{item:i,pos:o})]})]})}const Lq=["Untested","Low","Moderate","High","Crystallized"];function Aq({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=Lq[r]??"Untested",i=r===0?df[0]:df[r];return c.jsxs("span",{className:st("inline-flex items-center gap-1",e),children:[c.jsx("span",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(s=>c.jsx("span",{className:st("h-2.5 w-1.5 rounded-sm",s<=r?i:"bg-slate-600")},s))}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:n})]})}function Mq(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 Cx(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function Iq(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function Fq(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 Dq(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:Mq(new Date(n).toISOString(),e)}function Pq(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=Dq(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 Oq(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 kx({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:`${Cx(i.tokens_in)} / ${Cx(i.tokens_out)}`},{label:"USD",value:Iq(i.usd)},{label:"Wall clock",value:Fq(i.wall_clock_ms)},{label:"Final artifact",value:((o=t.final_artifact)==null?void 0:o.path)||"—"},...e];return c.jsx("div",{className:"space-y-1",children:s.map((a,l)=>c.jsxs("div",{className:"flex justify-between gap-2 text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground",children:a.label}),c.jsx("span",{className:"font-mono text-right truncate",title:typeof a.value=="string"?a.value:void 0,children:a.value})]},l))})}function $q({lineage:t,selectedPair:e=[],onSelectPair:r=()=>{},extraMetricsForBranch:n=()=>[],now:i=Date.now()}){var g,y;const[s,o]=k.useState(!1),{summary:a,canCompare:l,completeBranches:h}=Pq(t,i),[u,d]=Oq(h,e),f=()=>{l&&(o(C=>!C),!s&&u&&d&&r([u.branch_id,d.branch_id]))};if(!s)return c.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[c.jsx("span",{children:a}),c.jsx("button",{disabled:!l,onClick:f,className:"text-[10px] px-2 py-0.5 rounded border border-border "+(l?"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 c.jsxs("div",{className:"space-y-2 rounded border border-border p-2 bg-muted/10",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:a}),c.jsx("button",{onClick:()=>o(!1),className:"text-[10px] text-muted-foreground hover:text-foreground",children:"Collapse"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.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&&c.jsx(kx,{branch:u,extraRows:n(u)})]}),c.jsxs("div",{children:[c.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&&c.jsx(kx,{branch:d,extraRows:n(d)})]})]}),c.jsx("div",{className:"col-span-2",children:x?c.jsx(sf,{oldText:p,newText:m}):c.jsxs("div",{className:"text-[10px] italic text-muted-foreground",children:["No artifact produced on ",!p&&!m?"either branch":p?"branch B":"branch A","."]})})]})}const Rq={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function zq(t){return Rq[t]??t}function vx(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function Wq(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 qq({item:t}){const[e,r]=k.useState(!1),n=Wq(t);if(n.length===0)return null;const i=n.length;return c.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:[c.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:[c.jsx(oc,{size:13}),c.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?c.jsx(Zx,{size:13,style:{marginLeft:"auto"}}):c.jsx(Es,{size:13,style:{marginLeft:"auto"}})]}),e&&c.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse",marginTop:"4px"},"data-testid":"drift-ribbon-table",children:[c.jsx("thead",{children:c.jsxs("tr",{style:{color:"hsl(var(--muted-foreground))"},children:[c.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Axis"}),c.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Ratio"}),c.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Threshold"}),c.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Explanation"})]})}),c.jsx("tbody",{children:n.map(s=>c.jsxs("tr",{"data-testid":`drift-axis-row-${s.axis_id}`,children:[c.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--foreground))",fontWeight:500},children:zq(s.axis_id)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:vx(s.ratio)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:vx(s.threshold)}),c.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--muted-foreground))",maxWidth:"200px",wordBreak:"break-word"},children:s.explanation??""})]},s.axis_id))})]})]})}function Hq({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]=k.useState(r),[s,o]=k.useState((t==null?void 0:t.type)==="bug"?"bug":"feature"),[a,l]=k.useState(""),[h,u]=k.useState(!1),[d,f]=k.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{const y=await Mt("/api/build/start",{method:"POST",headers:Ki({"Content-Type":"application/json"}),body:JSON.stringify({featureCode:g,mode:s,description:a.trim()})});if(!y.ok){let C=null;try{C=await y.json()}catch{}throw new Error(C&&C.error||`Failed to start build (HTTP ${y.status})`)}e==null||e()}catch(y){f(y.message||"Failed to start build"),u(!1)}}return c.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:c.jsxs("form",{className:"p-2 space-y-2",onSubmit:p,children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-feature",children:"Feature code"}),c.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})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Mode"}),c.jsxs("div",{className:"flex items-center gap-1.5",role:"radiogroup","aria-label":"Build mode",children:[c.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"}),c.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"})]})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",htmlFor:"start-build-desc",children:"Description (optional)"}),c.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=>l(x.target.value),"data-testid":"start-build-description"})]}),d?c.jsx("div",{className:"text-[10px] text-destructive",role:"alert",children:d}):null,c.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[c.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"}),c.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 Uq({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 c.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:[c.jsx("span",{className:"text-xs text-muted-foreground",children:Nd[t]}),c.jsx("div",{className:"flex items-center gap-0.5",children:[0,1,2,3].map(i=>c.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 Yq({item:t,connections:e,items:r,onSelect:n,onDeleteConnection:i}){const s=new Map(r.map(l=>[l.id,l])),o=[];for(const l of e)if(l.type!=="contradicts"){if(l.fromId===t.id){const h=s.get(l.toId);h&&o.push({item:h,type:l.type,direction:"outgoing",connId:l.id})}if(l.toId===t.id){const h=s.get(l.fromId);h&&o.push({item:h,type:l.type,direction:"incoming",connId:l.id})}}if(o.length===0)return null;const a={};for(const l of o){const h=`${l.type}-${l.direction}`;a[h]||(a[h]={type:l.type,direction:l.direction,items:[]}),a[h].items.push({item:l.item,connId:l.connId})}return c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Connections"}),Object.values(a).map(l=>c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] text-muted-foreground mb-1",children:l.direction==="incoming"?`${l.type} from`:`${l.type} to`}),c.jsx("div",{className:"space-y-0.5",children:l.items.map(({item:h,connId:u})=>c.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:[c.jsxs("button",{onClick:()=>n(h.id),className:"flex flex-1 items-center gap-2 min-w-0",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:On[h.status]||On.planned}}),c.jsx("span",{className:"text-xs text-foreground truncate",children:h.title}),c.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:mr[h.type]},children:h.type})]}),i&&c.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:c.jsx(yn,{className:"h-3 w-3"})})]},u))})]},`${l.type}-${l.direction}`))]})}function Ua(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 Gq({featureCode:t,lineage:e}){const r=fr(i=>i.selectedBranches),n=fr(i=>i.setSelectedBranches);return c.jsx($q,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function Vq({featureCode:t}){const[e,r]=k.useState([]),[n,i]=k.useState(!0);return k.useEffect(()=>{const s=new AbortController;return i(!0),Mt(`/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:c.jsxs("div",{children:[c.jsxs("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Sessions (",e.length,")"]}),c.jsx("div",{className:"space-y-2",children:e.map(s=>{var o;return c.jsxs("div",{className:"text-xs text-muted-foreground border-l-2 border-border pl-2",children:[c.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," ")}`]}),c.jsxs("div",{children:[s.toolCount," tools · ",Math.round((new Date(s.endedAt)-new Date(s.startedAt))/6e4),"m"]})]},s.id)})})]})}const Xq=["informs","supports","blocks","contradicts"];function Kq({item:t,items:e,onCreateConnection:r,onDismiss:n}){const[i,s]=k.useState(""),[o,a]=k.useState("informs"),l=e.filter(u=>u.id===t.id?!1:i?u.title.toLowerCase().includes(i.toLowerCase()):!0).slice(0,8),h=k.useCallback(async u=>{await r({fromId:t.id,toId:u,type:o}),n()},[t.id,o,r,n]);return c.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50",children:c.jsxs("div",{className:"p-2 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.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:Xq.map(u=>c.jsx("option",{value:u,children:u},u))}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"to..."})]}),c.jsxs("div",{className:"relative",children:[c.jsx(bn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),c.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})]}),c.jsx("div",{className:"max-h-40 overflow-auto space-y-0.5",children:l.length===0?c.jsx("p",{className:"text-[10px] text-muted-foreground text-center py-2",children:"No items found"}):l.map(u=>c.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:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:On[u.status]||On.planned}}),c.jsx("span",{className:"text-xs text-foreground truncate",children:u.title}),c.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:mr[u.type]},children:u.type})]},u.id))})]})})}function Qq({gate:t,onResolveGate:e}){const[r,n]=k.useState(null),[i,s]=k.useState(""),o=()=>{e(t.id,"revised",i||void 0),n(null),s("")},a=()=>{i.trim()&&(e(t.id,"killed",i),n(null),s(""))};return c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(Pt,{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"}),c.jsx(Pt,{variant:"outline",size:"sm",className:st("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"}),c.jsx(Pt,{variant:"outline",size:"sm",className:st("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&&c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.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:l=>s(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(r==="revise"?o():a()),l.key==="Escape"&&n(null)},autoFocus:!0}),c.jsx(Pt,{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 Zq({item:t,items:e,connections:r,gates:n,onUpdate:i,onDelete:s,onCreateConnection:o,onDeleteConnection:a,onSelect:l,onClose:h,onPressureTest:u,onResolveGate:d}){var $,B,T,G,tt,D;const f=Yx(),[p,m]=k.useState(!1),[x,g]=k.useState(""),[y,C]=k.useState(!1),[b,w]=k.useState(""),[_,S]=k.useState(!1),[N,A]=k.useState(!1),[L,j]=k.useState("");k.useEffect(()=>{j((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const F=k.useCallback(()=>{const V=L.trim(),ht=(t==null?void 0:t.group)||"";V!==ht&&i(t.id,{group:V||null})},[L,t==null?void 0:t.id,t==null?void 0:t.group,i]),z=k.useCallback(()=>{g(t.title),m(!0)},[t==null?void 0:t.title]),W=k.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=k.useCallback(()=>{w(t.description||""),C(!0)},[t==null?void 0:t.description]),I=k.useCallback(()=>{b!==(t.description||"")&&i(t.id,{description:b}),C(!1)},[b,t==null?void 0:t.id,t==null?void 0:t.description,i]),M=k.useMemo(()=>{if(!t)return 0;let V=0;for(const ht of r)ht.type==="contradicts"&&(ht.fromId===t.id||ht.toId===t.id)&&V++;return V},[t==null?void 0:t.id,r]);if(!t)return null;const O=mr[t.type]||mr.task;return c.jsxs("div",{className:"w-full bg-card flex flex-col h-full",children:[c.jsxs("div",{className:"p-3 pb-2 flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[c.jsx(rr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:O,borderColor:O},children:t.type}),t.phase&&c.jsx(rr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:dl[t.phase]||t.phase})]}),p?c.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:V=>g(V.target.value),onBlur:W,onKeyDown:V=>{V.key==="Enter"&&W(),V.key==="Escape"&&m(!1)},autoFocus:!0}):c.jsx("h3",{className:"text-sm font-semibold text-foreground cursor-pointer hover:text-accent transition-colors",onDoubleClick:z,title:"Double-click to edit",children:t.title})]}),c.jsx(Pt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:h,children:c.jsx(yn,{className:"h-3.5 w-3.5"})})]}),c.jsx(Cl,{}),c.jsx($n,{className:"flex-1",children:c.jsxs("div",{className:"p-3 space-y-4",children:[c.jsx(qq,{item:t}),(($=t.lifecycle)==null?void 0:$.featureCode)&&c.jsx(Gq,{featureCode:t.lifecycle.featureCode,lineage:(B=t.lifecycle.lifecycle_ext)==null?void 0:B.branch_lineage}),c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.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:V=>i(t.id,{status:V.target.value}),children:OT.map(V=>c.jsx("option",{value:V,children:V.replace("_"," ")},V))}),c.jsx(Uq,{level:t.confidence||0,onChange:V=>i(t.id,{confidence:V})})]}),c.jsx(Aq,{level:t.confidence||0}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase"}),c.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:V=>i(t.id,{phase:V.target.value||null}),children:[c.jsx("option",{value:"",children:"No phase"}),o0.map(V=>c.jsx("option",{value:V,children:dl[V]},V))]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Group"}),c.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:L,placeholder:"(none)",onChange:V=>j(V.target.value),onBlur:F,onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),V.currentTarget.blur()),V.key==="Escape"&&(j(t.group||""),V.currentTarget.blur())},"data-testid":"item-detail-group-input"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),y?c.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:V=>w(V.target.value),onBlur:I,onKeyDown:V=>{V.key==="Escape"&&C(!1)},autoFocus:!0}):c.jsx("p",{className:st("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..."})]}),c.jsx(Yq,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),c.jsx(Bq,{item:t,items:e,connections:r,onSelect:l}),((T=t.lifecycle)==null?void 0:T.featureCode)&&c.jsx(Vq,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(V=>V.itemId===t.id))&&(()=>{var _t;const V=t.lifecycle,ht=n?n.filter(lt=>lt.itemId===t.id):[],ct=ht.filter(lt=>lt.status==="pending"),Ft=ht.filter(lt=>lt.status!=="pending");return c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Lifecycle"}),c.jsxs("div",{className:"space-y-1.5",children:[V&&c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Phase:"}),c.jsx("span",{className:"text-[10px] text-foreground font-medium",children:Ce[V.currentPhase]??V.currentPhase}),V.featureCode&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:V.featureCode})]}),((_t=V==null?void 0:V.phaseHistory)==null?void 0:_t.length)>1&&c.jsxs("div",{className:"px-2 py-1 rounded bg-muted/30",children:[c.jsx("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"History"}),c.jsx("div",{className:"flex flex-wrap gap-x-1 gap-y-0.5",children:V.phaseHistory.map((lt,Y)=>c.jsxs("span",{className:st("text-[10px]",lt.phase===V.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[Ce[lt.phase]??lt.phase,lt.outcome&&lt.outcome!=="approved"&&c.jsxs("span",{className:"text-amber-400",children:[" (",lt.outcome,")"]}),Y<V.phaseHistory.length-1&&" → "]},Y))})]}),ct.map(lt=>{var kt,Tt;const Y=lt.artifactAssessment,ot=a0[lt.fromPhase];return c.jsxs("div",{className:"rounded bg-amber-400/10 border border-amber-400/20 px-2 py-1.5",children:[c.jsxs("p",{className:"text-[10px] text-amber-400 font-medium mb-1",children:["Pending: ",mn[lt.stepId]??`${Ce[lt.fromPhase]??lt.fromPhase} → ${Ce[lt.toPhase]??lt.toPhase}`]}),Y&&Y.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[ot&&c.jsx("span",{className:"font-mono",children:ot}),ot&&": ",Math.round(Y.completeness*100),"% complete"," · ",Y.wordCount," words",((Tt=(kt=Y.sections)==null?void 0:kt.missing)==null?void 0:Tt.length)>0&&c.jsxs("span",{className:"text-amber-400",children:[" (missing: ",Y.sections.missing.join(", "),")"]}),!Y.meetsMinWordCount&&c.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),Y&&!Y.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[ot??"Artifact"," not found"]}),d&&c.jsx(Qq,{gate:lt,onResolveGate:d})]},lt.id)}),Ft.map(lt=>{const Y={approved:"text-success",revised:"text-amber-400",killed:"text-destructive"};return c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:mn[lt.stepId]??`${Ce[lt.fromPhase]??lt.fromPhase} → ${Ce[lt.toPhase]??lt.toPhase}`}),c.jsx(rr,{variant:"outline",className:st("text-[10px] px-1.5 py-0 h-4 ml-auto",Y[lt.outcome]||""),children:lt.outcome})]},lt.id)})]})]})})(),((tt=(G=t.evidence)==null?void 0:G.stratumViolations)==null?void 0:tt.length)>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1.5",children:["Blocked — Ensure Violations",t.evidence.violatedAt&&c.jsx("span",{className:"ml-2 font-normal normal-case text-muted-foreground",children:Ua(t.evidence.violatedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((V,ht)=>c.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),c.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:V})]},ht))})]}),((D=t.evidence)==null?void 0:D.stratumTrace)&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Stratum Trace",t.evidence.tracedAt&&c.jsx("span",{className:"ml-2 font-normal normal-case",children:Ua(t.evidence.tracedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(V=>c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--success))"}}),c.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:V.step_id}),V.attempts>1&&c.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[V.attempts,"x"]}),V.duration_ms!=null&&c.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:V.duration_ms<1e3?`${V.duration_ms}ms`:`${(V.duration_ms/1e3).toFixed(1)}s`})]},V.step_id))})]}),c.jsxs("div",{className:"space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",Ua(t.createdAt)]}),c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",Ua(t.updatedAt)]})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[!t.lifecycle&&t.status!=="killed"&&t.type!=="question"&&c.jsxs("div",{className:"relative",children:[c.jsxs(Pt,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",N&&"bg-accent/10 border-accent"),onClick:()=>A(!N),"data-testid":"item-start-build",title:"Start the build/bug-fix lifecycle for this item",children:[c.jsx(fT,{className:"h-3 w-3"})," Start"]}),N&&c.jsx(Hq,{item:t,onClose:()=>A(!1)})]}),c.jsxs("div",{className:"relative",children:[c.jsxs(Pt,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",_&&"bg-accent/10 border-accent"),onClick:()=>S(!_),children:[c.jsx(nT,{className:"h-3 w-3"})," Connect"]}),_&&c.jsx(Kq,{item:t,items:e,onCreateConnection:o,onDismiss:()=>S(!1)})]}),c.jsxs(Pt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:z,children:[c.jsx(i0,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&c.jsxs(Pt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[c.jsx(ul,{className:"h-3 w-3"})," Pressure Test",M>0&&c.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:M})]}),t.status!=="killed"&&c.jsxs(Pt,{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 V=await Mt(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!V.ok){const ht=await V.json().catch(()=>({}));console.error("[vision] Lifecycle kill failed:",ht.error),_e(`Kill failed: ${ht.error||V.status}`,"error")}}catch(V){console.error("[vision] Lifecycle kill failed:",V.message),_e(`Kill failed: ${V.message}`,"error")}else i(t.id,{status:"killed"})},children:[c.jsx(lf,{className:"h-3 w-3"})," Kill"]}),s&&c.jsxs(Pt,{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:[c.jsx(lf,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const $2=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];$2.map(t=>t.id);const Jq={overview:wi,pipeline:r0,sessions:t0,errors:oc,files:Td};function tH({activeTab:t="overview",onTabChange:e,errorCount:r=0}){return c.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:$2.map(({id:n,label:i})=>{const s=Jq[n],o=n===t,a=n==="errors"?r:0;return c.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:[c.jsx(s,{style:{width:10,height:10}}),i,a>0&&c.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 wx=[{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 ld(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 eH({item:t,activeBuild:e}){const[r,n]=k.useState(null),i=(t==null?void 0:t.phaseHistory)||[],s=(t==null?void 0:t.featureCode)||(t==null?void 0:t.text)||"";return c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"flex items-center gap-0 mb-3",children:wx.map((o,a)=>{const l=ld(o.id,i,e,s),h=uf[l],u=r===o.id;return c.jsxs(qt.Fragment,{children:[a>0&&c.jsx("div",{className:"flex-1 h-px",style:{background:l==="pending"?"hsl(var(--muted-foreground) / 0.2)":h,minWidth:"8px"}}),c.jsxs("button",{onClick:()=>n(u?null:o.id),className:"relative flex flex-col items-center group",title:o.label,children:[c.jsx("div",{className:["w-3 h-3 rounded-full border-2 transition-all",l==="active"?"animate-pulse":"",u?"ring-2 ring-accent/30":""].join(" "),style:{borderColor:h,background:l==="complete"||l==="failed"?h:"transparent"}}),c.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)})}),c.jsx("div",{className:"flex justify-between px-0.5",children:wx.map(o=>{const a=ld(o.id,i,e,s);return c.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider",style:{color:a==="pending"?"hsl(var(--muted-foreground) / 0.4)":uf[a]},children:o.label},o.id)})}),r&&c.jsx("div",{className:"mt-3 p-2 rounded border border-border/50 bg-muted/20",children:c.jsx(rH,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function rH({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=ld(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 c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-xs font-semibold text-foreground capitalize",children:t}),c.jsx("span",{className:`text-[10px] font-medium ${o[i]}`,children:i})]}),(s==null?void 0:s.summary)&&c.jsx("p",{className:"text-[10px] text-muted-foreground",children:s.summary}),(s==null?void 0:s.durationMs)!=null&&c.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)&&c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Agent: ",s.agent]}),i==="active"&&r&&c.jsx("p",{className:"text-[10px] text-accent",children:"Running..."}),i==="pending"&&c.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Not started"})]})}function nH(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 iH(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function sH({featureCode:t,sessions:e=[],items:r=[]}){const[n,i]=k.useState(null),s=k.useMemo(()=>t?new Set(r.filter(a=>{var l;return((l=a.lifecycle)==null?void 0:l.featureCode)===t||a.featureCode===t||a.feature_code===t}).map(a=>a.id)):new Set,[t,r]),o=k.useMemo(()=>s.size===0?e.slice(0,20):e.filter(a=>!!(a.featureCode===t||a.itemsWorked&&a.itemsWorked.some(l=>s.has(l))||a.summary&&a.summary.includes(t))),[e,t,s]);return o.length===0?c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"No sessions for this feature."}):c.jsxs("div",{className:"p-2 space-y-0.5",children:[c.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 l=n===a.id;return c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>i(l?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:[c.jsx("span",{className:"text-[10px] font-mono text-accent shrink-0 w-12 truncate",children:a.source||"agent"}),c.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 w-16 truncate",children:a.classification||a.workType||"—"}),c.jsxs("span",{className:"text-[9px] text-muted-foreground tabular-nums flex gap-1.5 shrink-0",children:[c.jsxs("span",{title:"reads",children:[a.reads||0,"r"]}),c.jsxs("span",{title:"writes",children:[a.writes||0,"w"]}),c.jsxs("span",{title:"errors",style:a.errors>0?{color:"hsl(var(--destructive))"}:{},children:[a.errors||0,"e"]})]}),c.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:iH(a.durationMs)}),c.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:nH(a.startedAt||a.createdAt)})]}),l&&a.summary&&c.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 oH(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 $h=10;function aH({featureCode:t,errors:e=[],items:r=[]}){const[n,i]=k.useState(null),[s,o]=k.useState(!1),a=k.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]),l=k.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(l.length===0)return c.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[c.jsx(AS,{style:{width:20,height:20,color:"hsl(var(--success, 160 60% 45%))"}}),c.jsx("span",{className:"text-[11px] italic",children:"No errors for this feature."})]});const h=s?l:l.slice(0,$h);return c.jsxs("div",{className:"p-2 space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Errors (",l.length,")"]}),h.map((u,d)=>{const f=n===d;return c.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:[c.jsxs("div",{className:"flex items-center gap-2 w-full",children:[c.jsx("span",{className:"text-[10px] text-destructive shrink-0",children:"✕"}),c.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0 w-16 truncate",children:u.tool||u.toolName||"unknown"}),c.jsx("span",{className:`text-[10px] text-foreground flex-1 ${f?"":"line-clamp-2"} truncate`,children:u.message||u.error||"Unknown error"}),c.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0 ml-auto",children:oH(u.timestamp||u.createdAt)})]}),f&&c.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&&l.length>$h&&c.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-$h," more"]})]})}function lH(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function cH(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 hH({featureCode:t,onOpenFile:e}){const[r,n]=k.useState([]),[i,s]=k.useState(!0);k.useEffect(()=>{const l=new AbortController;return s(!0),Mt("/api/files",{signal:l.signal}).then(h=>h.json()).then(h=>{l.signal.aborted||(n(Array.isArray(h)?h:h.files||[]),s(!1))}).catch(h=>{l.signal.aborted||(n([]),s(!1))}),()=>l.abort()},[t]);const o=`docs/features/${t}/`,a=k.useMemo(()=>r.filter(l=>(typeof l=="string"?l:l.path||l.name||"").startsWith(o)),[r,o]);return i?c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Loading files..."}):a.length===0?c.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[c.jsx(Td,{style:{width:20,height:20,opacity:.5}}),c.jsx("span",{className:"text-[11px] italic",children:"No files in feature folder."})]}):c.jsxs("div",{className:"p-2 space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Files (",a.length,")"]}),a.map((l,h)=>{const u=typeof l=="string"?l:l.path||l.name||"",d=u.split("/").pop(),f=typeof l=="object"?l.size:null,p=typeof l=="object"?l.modified||l.mtime:null;return c.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:[c.jsx(wi,{className:"h-3 w-3 shrink-0 text-accent"}),c.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:d}),f!=null&&c.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:lH(f)}),p&&c.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:cH(p)})]},h)})]})}function uH({itemId:t,onSelect:e,onClose:r,onOpenFile:n,onViewInGraph:i,onViewInTree:s}){var S;const{items:o,connections:a,gates:l,updateItem:h,deleteItem:u,createConnection:d,deleteConnection:f,resolveGate:p,activeBuild:m,sessions:x,agentErrors:g}=fr(_i(N=>({items:N.items,connections:N.connections,gates:N.gates,updateItem:N.updateItem,deleteItem:N.deleteItem,createConnection:N.createConnection,deleteConnection:N.deleteConnection,resolveGate:N.resolveGate,activeBuild:N.activeBuild,sessions:N.sessions,agentErrors:N.agentErrors}))),y=o.find(N=>N.id===t)||null,[C,b]=k.useState("overview"),w=((S=y==null?void 0:y.lifecycle)==null?void 0:S.featureCode)||(y==null?void 0:y.featureCode)||(y==null?void 0:y.feature_code)||"",_=k.useMemo(()=>w?g.filter(N=>N.featureCode===w||w&&N.message&&N.message.includes(w)):[],[g,w]);return y?c.jsxs("div",{className:"h-full flex flex-col",children:[c.jsx(tH,{activeTab:C,onTabChange:b,errorCount:_.length}),c.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[C==="overview"&&c.jsxs(c.Fragment,{children:[c.jsx(Zq,{item:y,items:o,connections:a,gates:l,onUpdate:(N,A)=>h(N,A),onDelete:N=>{u(N),r()},onCreateConnection:d,onDeleteConnection:f,onSelect:e,onClose:r,onPressureTest:()=>{},onResolveGate:p}),c.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 mt-1",style:{borderTop:"1px solid hsl(var(--border))"},children:[i&&c.jsxs("button",{onClick:()=>i(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[c.jsx("span",{style:{fontSize:10},children:"↑"})," View in Graph"]}),s&&c.jsxs("button",{onClick:()=>s(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[c.jsx("span",{style:{fontSize:10},children:"↓"})," View in Tree"]})]})]}),C==="pipeline"&&c.jsx(eH,{item:y,activeBuild:m}),C==="sessions"&&c.jsx(sH,{featureCode:w,sessions:x,items:o}),C==="errors"&&c.jsx(aH,{featureCode:w,errors:g,items:o}),C==="files"&&c.jsx(hH,{featureCode:w,onOpenFile:n})]})]}):c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function dH(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 pH(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function fH(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function mH(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,l=(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:l}}function gH(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 Sx(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const Tx=[{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 xH({tierMap:t,tierSummary:e}){const[r,n]=k.useState(null),i=s=>n(o=>o===s?null:s);return c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Tier Pipeline"}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[Tx.map((s,o)=>{var d;const a=t[s.id],l=(d=e==null?void 0:e.tiersSkipped)==null?void 0:d.includes(s.id);let h,u;return l?(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`),c.jsxs(qt.Fragment,{children:[o>0&&c.jsx("div",{className:"h-px w-3 bg-muted-foreground/20 shrink-0"}),c.jsxs("button",{className:"flex flex-col items-center gap-0.5 group",onClick:()=>i(s.id),title:u,children:[c.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":""}`}),c.jsx("span",{className:"text-[8px] text-muted-foreground leading-none",children:s.label})]})]},s.id)}),(e==null?void 0:e.costSaved)>0&&c.jsxs("span",{className:"ml-2 text-[9px] text-success/80",children:["saved ~$",e.costSaved.toFixed(2)]})]}),r&&c.jsx("div",{className:"mt-1.5 px-2 py-1 rounded bg-muted/20 text-[9px] text-muted-foreground",children:(()=>{var l;const s=t[r],o=(l=e==null?void 0:e.tiersSkipped)==null?void 0:l.includes(r),a=Tx.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 Rh(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function yH(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const _x={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function jx(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 bH({loopState:t,budget:e}){const[r,n]=k.useState(()=>Date.now());k.useEffect(()=>{if(!t||t.status!=="running")return;const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[t]);const i=mH(t,e,r);return i?c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Live Counters"}),c.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsxs("span",{className:"text-foreground font-mono font-medium",children:["attempt ",i.count,"/",i.maxIterations??"?"]}),c.jsx("span",{className:"text-muted-foreground",children:"·"}),c.jsxs("span",{className:"text-foreground font-mono",children:[jx(i.elapsedMs),i.timeoutMs!=null&&c.jsxs("span",{className:"text-muted-foreground",children:[" / ",jx(i.timeoutMs)]})]}),i.usedIterations!=null&&i.maxTotal!=null&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground",children:"·"}),c.jsxs("span",{className:"text-foreground font-mono",children:["cumulative ",i.usedIterations,"/",i.maxTotal]})]})]}),c.jsxs("div",{className:"text-muted-foreground/70 text-[9px]",children:["loop: ",i.loopType]})]})]}):null}function CH({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=fr(_i(L=>({activeBuild:L.activeBuild,iterationStates:L.iterationStates}))),[o,a]=k.useState(!1),[l,h]=k.useState(null),u=(i==null?void 0:i.featureCode)??null,d=k.useRef(null);k.useEffect(()=>{if(!u){h(null);return}u!==d.current&&(d.current=u,Mt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(L=>L.json()).then(L=>h(L)).catch(()=>{}))},[u]);const{step:f,allSteps:p}=k.useMemo(()=>i!=null&&i.steps?{step:i.steps.find(j=>j.id===t||j.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=k.useMemo(()=>{if(!r||r.length===0)return null;for(let L=r.length-1;L>=0;L--){const j=r[L];if(j.subtype==="health_score"&&typeof j.score=="number")return j}return null},[r]),{tierMap:x,tierSummary:g}=k.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const L={};let j=null;for(const F of e)F.subtype==="gate_tier_result"?L[F.tierId]=F.passed:F.subtype==="gate_tier_summary"&&(j=F);return{tierMap:L,tierSummary:j}},[e]),y=Object.keys(x).length>0||g!==null,C=k.useMemo(()=>{const L=p.filter(j=>j.cost_usd!=null);return L.length===0?[]:[...L].sort((j,F)=>o?(j.cost_usd??0)-(F.cost_usd??0):(F.cost_usd??0)-(j.cost_usd??0))},[p,o]),b=C.length>0?C[0].id:null,w=k.useMemo(()=>dH(f),[f]),_=k.useMemo(()=>pH(f),[f]),S=k.useMemo(()=>fH(s,t),[s,t]),N=k.useMemo(()=>{if(!n||n.length===0)return null;const L=n.filter(z=>z.stepId===t);if(L.length===0)return null;const j=L.filter(z=>z.severity==="violation").length,F=L.filter(z=>z.severity==="warning").length;return{total:L.length,hardViolations:j,warnings:F}},[n,t]);if(!f)return c.jsxs("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:["Step “",t,"” not found in active build."]});const A={done:"text-success",running:"text-accent",failed:"text-destructive",pending:"text-muted-foreground",skipped:"text-muted-foreground"};return c.jsxs("div",{className:"p-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Step"}),c.jsx("p",{className:"text-sm font-semibold text-foreground font-mono",children:f.id||f.step_id})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Status:"}),c.jsx("span",{className:`text-xs font-medium ${A[f.status]||"text-foreground"}`,children:f.status||"unknown"})]}),w&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Retries"}),c.jsxs("p",{className:"text-xs text-amber-400",children:["Retried ",w.count," ",w.count===1?"time":"times"]}),w.isArray&&w.items.length>0&&c.jsx("div",{className:"mt-1 space-y-0.5",children:w.items.map((L,j)=>c.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",j+1,L.reason?`: ${L.reason}`:""]},j))})]}),f.durationMs!=null&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Duration:"}),c.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&&c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Summary:"}),c.jsx("p",{className:"text-xs text-foreground mt-0.5",children:f.summary})]}),f.artifact&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Artifact:"}),c.jsx("span",{className:"text-xs text-foreground font-mono truncate",children:f.artifact})]}),f.agent&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Agent:"}),c.jsx("span",{className:"text-xs text-foreground font-mono",children:f.agent})]}),f.filesChanged&&f.filesChanged.length>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Files Changed (",f.filesChanged.length,")"]}),c.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:f.filesChanged.map((L,j)=>c.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:L},j))})]}),(f.input_tokens>0||f.output_tokens>0||f.cost_usd>0)&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Tokens & Cost"}),c.jsxs("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:[c.jsx("span",{className:"text-muted-foreground",children:"Input"}),c.jsx("span",{className:"text-muted-foreground",children:"Output"}),c.jsx("span",{className:"text-muted-foreground",children:"Cost"}),c.jsx("span",{className:"text-foreground font-mono",children:(f.input_tokens??0).toLocaleString()}),c.jsx("span",{className:"text-foreground font-mono",children:(f.output_tokens??0).toLocaleString()}),c.jsx("span",{className:"text-foreground font-mono",children:Sx(f.cost_usd)})]})]}),y&&c.jsx("div",{children:c.jsx(xH,{tierMap:x,tierSummary:g})}),_.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1",children:"Postcondition Violations"}),c.jsx("div",{className:"space-y-0.5",children:_.map((L,j)=>c.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),c.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:typeof L=="string"?L:L.message||JSON.stringify(L)})]},j))})]}),N&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Capability Findings"}),c.jsxs("p",{className:"text-xs text-amber-400",children:[N.total," ",N.total===1?"finding":"findings"," ","(",N.hardViolations," ",N.hardViolations===1?"violation":"violations",","," ",N.warnings," ",N.warnings===1?"warning":"warnings",")"]})]}),(S==null?void 0:S.status)==="running"&&c.jsx(bH,{loopState:S,budget:l}),m!=null&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Health Score"}),c.jsxs("div",{className:"flex items-baseline gap-2 mb-2",children:[c.jsx("span",{className:`text-2xl font-bold font-mono tabular-nums ${Rh(m.score)}`,children:m.score}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"/100"}),m.trend&&c.jsxs("span",{className:`text-sm font-mono ${Rh(m.score)}`,children:[yH(m.trend.direction),m.trend.delta!=null&&c.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&&c.jsxs("div",{className:"space-y-1",children:[Object.entries(m.breakdown).map(([L,j])=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:_x[L]??L}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted-foreground/20 overflow-hidden",children:c.jsx("div",{className:`h-full rounded-full transition-all ${j>=80?"bg-success":j>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${j}%`}})}),c.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${Rh(j)}`,children:j})]},L)),m.missing&&m.missing.length>0&&c.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-0.5",children:["No data: ",m.missing.map(L=>_x[L]??L).join(", ")]})]})]}),C.length>1&&c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Build Cost Breakdown"}),c.jsx("button",{className:"text-[9px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>a(L=>!L),children:o?"cost asc":"cost desc"})]}),c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-[10px] border-collapse",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-muted-foreground",children:[c.jsx("th",{className:"text-left pr-2 pb-0.5 font-medium",children:"Step"}),c.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"In"}),c.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"Out"}),c.jsx("th",{className:"text-right pb-0.5 font-medium",children:"Cost"}),c.jsx("th",{className:"text-right pb-0.5 pl-2 font-medium",children:"Dur"})]})}),c.jsx("tbody",{children:C.map(L=>{const j=L.id===b,F=L.id===t,z=L.durationMs!=null?L.durationMs<1e3?`${L.durationMs}ms`:L.durationMs<6e4?`${(L.durationMs/1e3).toFixed(1)}s`:`${(L.durationMs/6e4).toFixed(1)}m`:"—";return c.jsxs("tr",{className:`${j?"text-amber-400":"text-foreground"} ${F?"font-semibold":""}`,children:[c.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:L.id}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((L.input_tokens??0)/1e3).toFixed(1),"k"]}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((L.output_tokens??0)/1e3).toFixed(1),"k"]}),c.jsx("td",{className:"text-right py-0.5 font-mono",children:Sx(L.cost_usd)}),c.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:z})]},L.id)})})]})})]})]})}function R2(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 Nx(t,e){var l;const r=(e||[]).filter(h=>!h.superseded);if(r.length===0)return"";let n=`# Design Document
639
-
640
- `;const i=(t||[]).filter(h=>h.role==="human"&&h.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
641
-
642
- `,n+=i.map(h=>h.content).join(`
643
-
644
- `),n+=`
645
-
646
- `);for(const h of r){const u=h.selectedOption||{};n+=`## ${h.question}
647
-
648
- `,n+=`**Decision:** ${u.title||u.id||"Selected option"}
649
-
650
- `,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
651
- `),n+=`
652
-
653
- `),h.comment&&(n+=`*Note: ${h.comment}*
654
-
655
- `)}const s=(l=r[r.length-1])==null?void 0:l.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(`
656
- `);for(const d of u){const f=d.trim();f.endsWith("?")&&f.length>10&&f.length<200&&a.push(f)}}return n+=`## Open Threads
657
-
658
- `,a.length>0?(n+=a.map(h=>`- ${h}`).join(`
659
- `),n+=`
660
- `):n+=`_No open threads._
661
- `,n}function kH(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const co={es:null},Pn=Xd((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 l=e().scope;if(l)r=l,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 l=await Mt(`/api/design/session${a}`),{session:h}=await l.json();if(h){const u=h.messages||[],d=h.decisions||[],f=Nx(u,d),p=kH(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(l){t({error:l.message})}},startSession:async(r="product",n=null)=>{try{const i=await Mt("/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(l=>({messages:[...l.messages,a],status:"streaming"}));try{const l=await Mt("/api/design/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:s,featureCode:o,type:"text",content:r})});l.ok||t({messages:i,status:"active",error:`Failed to send message: ${l.status}`})}catch(l){t({messages:i,status:"active",error:l.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(l=>({messages:[...l.messages,a],status:"streaming"}));try{const l=await Mt("/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})});l.ok||t({messages:o,status:"active",error:`Failed to select card: ${l.status}`})}catch(l){t({messages:o,status:"active",error:l.message})}},reviseDecision:async r=>{const{session:n}=e();if(!n)return;const i=e().decisions[r];if(!(!i||i.superseded))try{const s=await Mt("/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 Mt("/api/design/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const{error:l}=await s.json().catch(()=>({error:"Unknown error"}));t({error:l,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(co.es)return;const{scope:r,featureCode:n}=e(),i=new URLSearchParams({scope:r||"product"});n&&i.set("featureCode",n);const s=new EventSource(`/api/design/stream?${i}`);co.es=s,s.addEventListener("ack",()=>{t(o=>o.status!=="streaming"?{status:"streaming"}:{})}),s.addEventListener("text",o=>{const a=JSON.parse(o.data);t(l=>l.streamingMessage?{streamingMessage:{...l.streamingMessage,content:l.streamingMessage.content+a.content}}:{status:"streaming",streamingMessage:{role:"assistant",type:"text",content:a.content,timestamp:new Date().toISOString()}})}),s.addEventListener("decision",o=>{const a=JSON.parse(o.data);t(l=>({status:"streaming",streamingMessage:l.streamingMessage?{...l.streamingMessage,type:"decision",decisionData:a}:{role:"assistant",type:"decision",content:"",decisionData:a,timestamp:new Date().toISOString()}}))}),s.addEventListener("done",()=>{t(o=>({messages:o.streamingMessage?[...o.messages,o.streamingMessage]:o.messages,streamingMessage:null,status:"active"})),e().hydrate()}),s.addEventListener("research",o=>{const a=JSON.parse(o.data);t(l=>({researchItems:[...l.researchItems,{id:a.id,tool:a.tool,input:a.input,timestamp:a.timestamp,summary:null}]}))}),s.addEventListener("research_result",o=>{const a=JSON.parse(o.data);t(l=>{const h=[...l.researchItems],u=a.id?h.findIndex(d=>d.id===a.id):-1;return u!==-1&&(h[u]={...h[u],summary:a.summary}),{researchItems:h}})}),s.addEventListener("error",o=>{try{const a=JSON.parse(o.data);t(l=>({status:"active",streamingMessage:null,error:a.message||"Agent error",messages:l.messages}))}catch{t({status:"active",streamingMessage:null})}}),s.onerror=()=>{t({status:"active"})}},disconnectSSE:()=>{co.es&&(co.es.close(),co.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=Nx(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function vH(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=Pn(_i(h=>({draftDoc:h.draftDoc,docManuallyEdited:h.docManuallyEdited,updateDraftDoc:h.updateDraftDoc,resetDocEdited:h.resetDocEdited}))),[i,s]=k.useState(!1),o=!t;let a="empty",l={color:"hsl(var(--muted-foreground))"};return e?(a="edited",l={color:"hsl(var(--primary))"}):o||(a="draft",l={color:"hsl(var(--muted-foreground))"}),c.jsxs("div",{className:"h-full flex flex-col",style:{fontFamily:"inherit"},children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[12px] font-semibold",style:{color:"hsl(var(--foreground))"},children:"Design Document"}),c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{...l,background:"hsl(var(--muted))"},children:a})]}),!o&&c.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"})]}),c.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o?c.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?c.jsxs("div",{className:"h-full flex flex-col p-2 gap-2",children:[c.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}),c.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"})]}):c.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:c.jsx(Hd,{remarkPlugins:[Vd],children:t})})})]})}const zh={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%)"}},Ex={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 wH({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?zh.done:zh[t])||zh.build,l=Ex[o]||Ex.steady,h=o==="exit"?"200ms":o==="flash"?"300ms":"200ms";return c.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`,...l},onClick:n,role:"button",tabIndex:0,onKeyDown:u=>{u.key==="Enter"&&n&&n()},children:[c.jsxs("span",{style:{fontSize:"12px",lineHeight:1},children:[t==="build"&&"▶",t==="gate"&&"⚠",t==="error"&&"✕",t==="done"&&"✓",t==="iteration"&&"↻"]}),c.jsx("span",{children:e}),r>0&&c.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&&c.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&&c.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 SH(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function TH(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function _H(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function jH({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",l=t.totalSteps?` · step ${t.currentStepIndex??"?"}/${t.totalSteps}`:"",h=SH(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}${l}${u}`,featureCode:t.featureCode,retries:t.retries??0})}if(Array.isArray(e)){for(const a of e)if(a.status==="pending"){const l=mn[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?`${l} — ${u}`:l,featureCode:a.featureCode||"",gateId:a.id})}}if(i){for(const[a,l]of i)if(l.status==="running"){const h=l.loopType==="review"?"review":"coverage",u=`${l.count}/${l.maxIterations}`;let d="";if(l.wallClockTimeout!=null&&l.startedAt){const f=s-new Date(l.startedAt).getTime();d=`, ${TH(f)}/${_H(l.wallClockTimeout)}`}o.push({key:`iter-${a}`,type:"iteration",label:`${h} ${u}${d}`})}}if(Array.isArray(n))for(const a of n){const l=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:`${l} · ${h}`,featureCode:l,timestamp:a.timestamp})}return o}function NH({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=fr(_i(P=>({activeBuild:P.activeBuild,gates:P.gates,items:P.items,recentErrors:P.recentErrors,resolveGate:P.resolveGate,iterationStates:P.iterationStates}))),[l,h]=k.useState(new Map),u=k.useRef([]),d=k.useRef(new Set),f=k.useRef(new Set),[p,m]=k.useState(null),x=k.useRef(null),g=(r==null?void 0:r.featureCode)??null;k.useEffect(()=>{if(!g){m(null),x.current=null;return}g!==x.current&&(x.current=g,Mt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(P=>P.json()).then(P=>m(P)).catch(()=>{}))},[g]);const y=k.useRef(0);k.useEffect(()=>{if(!g)return;const P=a?[...a.values()].reduce((I,M)=>I+(M.count??0),0):0;P!==y.current&&(y.current=P,Mt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(I=>I.json()).then(I=>m(I)).catch(()=>{}))},[a,g]);const C=k.useRef(r),[b,w]=k.useState(null);k.useEffect(()=>{const P=C.current;if(P&&P.featureCode&&!r){w({...P,status:"complete"});const I=setTimeout(()=>w(null),3e3);return C.current=r,()=>clearTimeout(I)}C.current=r},[r]);const _=r||b,[S,N]=k.useState(()=>Date.now()),A=a&&[...a.values()].some(P=>P.status==="running");k.useEffect(()=>{if(!A)return;const P=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(P)},[A]);const L=k.useMemo(()=>jH({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:S}),[_,n,i,s,a,S]),j=k.useMemo(()=>L.filter(P=>!d.current.has(P.key)),[L]);k.useEffect(()=>{const P=new Set(u.current.map(M=>M.key)),I=j.filter(M=>!P.has(M.key)).map(M=>M.key);I.length>0&&(h(M=>{const O=new Map(M);for(const $ of I)O.set($,"enter");return O}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{h(M=>{const O=new Map(M);for(const $ of I)O.get($)==="enter"&&O.set($,"steady");return O})})}));for(const M of j)M.type==="done"&&!f.current.has(M.key)&&(f.current.add(M.key),h(O=>{const $=new Map(O);return $.set(M.key,"flash"),$}),setTimeout(()=>{h(O=>{const $=new Map(O);return $.set(M.key,"exit"),$}),setTimeout(()=>{d.current.add(M.key),h(O=>{const $=new Map(O);return $.delete(M.key),$})},500)},2e3));u.current=j},[j]);const F=k.useCallback(P=>{h(I=>{const M=new Map(I);return M.set(P,"exit"),M}),setTimeout(()=>{d.current.add(P),h(I=>{const M=new Map(I);return M.delete(P),M})},200)},[]),z=k.useCallback(P=>{o&&o(P,"approve","Approved from ops strip")},[o]);if(t==="docs"||j.length===0)return null;const W=gH(p);return c.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:[j.map(P=>c.jsx(wH,{type:P.type,label:P.label,retries:P.retries,animationState:l.get(P.key)||"steady",onClick:e?()=>e(P.featureCode):void 0,onApprove:P.type==="gate"&&P.gateId?()=>z(P.gateId):void 0,onDismiss:P.type==="error"?()=>F(P.key):void 0},P.key)),W&&c.jsx("span",{className:"ml-auto text-[9px] text-muted-foreground font-mono shrink-0 opacity-70",title:"Cumulative budget usage: review / coverage",children:W})]})}const Wh=["dashboard","graph","tree","docs","design","gates","pipeline","sessions","build-history","ideabox"];function EH(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function BH(t){return(t==null?void 0:t[0])??null}const LH="compose:mainTabs",z2="compose:activeTab";function AH(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(LH);if(!e)return[...Wh];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of Wh)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[...Wh]}function MH(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(z2);if(r&&EH(t,r))return r}catch{}return BH(t)}function Bx(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(z2,t)}catch{}}function W2(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 q2(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const H2="compose:sidebarOpen",U2="compose:contextPanelOpen";function IH(){return W2(H2,!0)}function FH(t){return q2(H2,t)}function DH(){return W2(U2,!1)}function Lx(t){return q2(U2,t)}const Ax={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 PH(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 OH(t){return typeof t!="number"||t<=0?null:`$${t.toFixed(t<1?4:2)}`}function $H({builds:t=[],items:e=[],onSelectItem:r}){const[n,i]=k.useState(""),[s,o]=k.useState("all"),a=k.useMemo(()=>{let l=t;if(s!=="all"&&(l=l.filter(h=>h.status===s)),n.trim()){const h=n.toLowerCase();l=l.filter(u=>(u.featureCode||"").toLowerCase().includes(h))}return l},[t,n,s]);return c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[c.jsx(Gh,{className:"h-3 w-3"}),c.jsx("span",{children:"Past builds"})]}),c.jsx("div",{className:"h-4 w-px bg-border"}),c.jsxs("div",{className:"relative",children:[c.jsx(bn,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),c.jsx("input",{type:"text",placeholder:"Search feature…",value:n,onChange:l=>i(l.target.value),className:"text-xs pl-5 pr-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-36"})]}),c.jsxs("select",{value:s,onChange:l=>o(l.target.value),className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-foreground border border-border cursor-pointer",children:[c.jsx("option",{value:"all",children:"All status"}),["complete","failed","aborted","killed"].map(l=>c.jsx("option",{value:l,children:l},l))]}),c.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length,"/",t.length]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[a.length===0&&c.jsx(ep,{icon:Gh,title:"No past builds yet",description:"Builds are recorded here after each run completes",className:"py-8"}),a.map((l,h)=>c.jsx(RH,{build:l,items:e,onSelectItem:r},`${l.featureCode}-${l.completedAt}-${h}`))]})]})}function RH({build:t,items:e,onSelectItem:r}){const n=t.featureCode?e.find(o=>{var a;return o.featureCode===t.featureCode||o.feature_code===t.featureCode||((a=o.lifecycle)==null?void 0:a.featureCode)===t.featureCode}):null,i=Ax[t.status]||Ax.killed,s=OH(t.cost_usd);return c.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:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:st("text-[10px] px-1.5 py-0.5 rounded capitalize",i),children:t.status}),t.featureCode&&c.jsx("button",{onClick:()=>n&&(r==null?void 0:r(n.id)),className:st("text-[11px] font-mono",n?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:t.featureCode}),t.mode==="bug"&&c.jsx("span",{className:"text-[10px] px-1 py-0.5 rounded bg-rose-500/15 text-rose-400",children:"bug"}),c.jsx(N2,{date:t.completedAt,className:"ml-auto text-[10px] shrink-0"})]}),c.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[c.jsxs("span",{children:["⏱ ",PH(t.durationMs)]}),s&&c.jsxs("span",{children:["💵 ",s]}),typeof t.stepCount=="number"&&c.jsxs("span",{children:["◆ ",t.stepCount," steps"]})]}),t.failureReason&&c.jsx("p",{className:"text-[11px] text-red-400/90 truncate",children:t.failureReason})]})}const cd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("rounded-xl border bg-card text-card-foreground shadow",t),...e}));cd.displayName="Card";const hd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex flex-col space-y-1.5 p-6",t),...e}));hd.displayName="CardHeader";const ud=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("font-semibold leading-none tracking-tight",t),...e}));ud.displayName="CardTitle";const zH=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("text-sm text-muted-foreground",t),...e}));zH.displayName="CardDescription";const dd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("p-6 pt-0",t),...e}));dd.displayName="CardContent";const WH=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex items-center p-6 pt-0",t),...e}));WH.displayName="CardFooter";function qH(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 Mx({agent:t,toolCount:e,errorCount:r,currentTool:n,currentCategory:i,onStop:s}){const o=t.status==="running",a=t.status==="killed",l=t.status==="failed"||t.status==="error"||a,h=!o&&!l,u=t.silent,[d,f]=k.useState(()=>{const m=t.startedAt?new Date(t.startedAt).getTime():Date.now();return(t.completedAt?new Date(t.completedAt).getTime():Date.now())-m});k.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 c.jsxs("div",{className:"px-3 py-2 rounded border border-border bg-muted/20",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-[11px] text-foreground font-medium truncate",children:p}),c.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[c.jsx("span",{className:st("w-1.5 h-1.5 rounded-full inline-block",o&&!u&&"bg-green-400",o&&u&&"bg-yellow-400",h&&"bg-emerald-400",l&&"bg-red-400"),style:o&&!u?{animation:"phase-active-pulse 2s ease-in-out infinite"}:void 0}),c.jsx("span",{className:st("text-[10px]",o&&!u&&"text-green-400",o&&u&&"text-yellow-400",h&&"text-emerald-400",l&&"text-red-400"),children:u?"silent":t.status}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:qH(d)}),o&&s&&c.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"})]})]}),c.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:e!=null&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{children:[e," tools"]}),c.jsx("span",{className:"mx-1",children:"·"}),c.jsxs("span",{className:st(r>0&&"text-red-400"),children:[r??0," err"]}),o&&n&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"mx-1",children:"·"}),c.jsxs("span",{children:[i||"working"," (",n,")"]})]})]})})]})}function HH(t,e,r){const n=new Array(t);return new Proxy(n,{get(i,s,o){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=57){const l=+s;if(Number.isInteger(l)&&l>=0&&l<t){let h=i[l];if(!h){const u=e[l*2];h=i[l]={index:l,key:r(l),start:u,size:e[l*2+1],end:u+e[l*2+1],lane:0}}return h}}if(s==="length")return t}return Reflect.get(i,s,o)}})}function Ri(t,e,r){let n=r.initialDeps??[],i,s=!0;function o(){const a=t();return(a.length!==n.length||a.some((h,u)=>n[u]!==h))&&(n=a,i=e(...a),r!=null&&r.onChange&&!(s&&r.skipInitialOnChange)&&r.onChange(i),s=!1),i}return o.updateDeps=a=>{n=a},o}function Ix(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const UH=(t,e)=>Math.abs(t-e)<1.01,YH=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}};let ho;const qh=()=>{if(ho!==void 0)return ho;if(typeof navigator>"u")return ho=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ho=!0;const t=navigator.maxTouchPoints;return ho=navigator.platform==="MacIntel"&&t!==void 0&&t>0},Fx=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},GH=t=>t,VH=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,i=new Array(n);for(let s=0;s<n;s++)i[s]=e+s;return i},XH=(t,e)=>{const r=t.scrollElement;if(!r)return;const n=t.targetWindow;if(!n)return;const i=o=>{const{width:a,height:l}=o;e({width:Math.round(a),height:Math.round(l)})};if(i(Fx(r)),!n.ResizeObserver)return()=>{};const s=new n.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const h=l.borderBoxSize[0];if(h){i({width:h.inlineSize,height:h.blockSize});return}}i(Fx(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},nc={passive:!0},KH=typeof window>"u"?!0:"onscrollend"in window,QH=(t,e,r)=>{const n=t.scrollElement;if(!n)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&KH;let o=0;const a=s?null:YH(i,()=>e(o,!1),t.options.isScrollingResetDelay),l=d=>()=>{o=r(n),a==null||a(),e(o,d)},h=l(!0),u=l(!1);return n.addEventListener("scroll",h,nc),s&&n.addEventListener("scrollend",u,nc),()=>{n.removeEventListener("scroll",h),s&&n.removeEventListener("scrollend",u)}},ZH=(t,e)=>QH(t,e,r=>{const{horizontal:n,isRtl:i}=t.options;return n?r.scrollLeft*(i&&-1||1):r.scrollTop}),JH=(t,e,r)=>{if(r.options.useCachedMeasurements){const n=r.indexFromElement(t),i=r.options.getItemKey(n);return r.itemSizeCache.get(i)??r.options.estimateSize(n)}if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}if(!e){const n=r.indexFromElement(t),i=r.options.getItemKey(n),s=r.itemSizeCache.get(i);if(s!==void 0)return s}return t[r.options.horizontal?"offsetWidth":"offsetHeight"]},tU=(t,{adjustments:e=0,behavior:r},n)=>{var i,s;(s=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[n.options.horizontal?"left":"top"]:t+e,behavior:r})},eU=tU;class rU{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var 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,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[h,u]of this.elementsCache)if(u===a){this.elementsCache.delete(h);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,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=>{var n,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:GH,rangeExtractor:VH,onChange:()=>{},measureElement:JH,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in r){const p=r[f];p!==void 0&&(s[f]=p)}const o=this.options;let a=null,l=null,h=!1;if(o!==void 0&&o.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,p=s.count,m=this.getMeasurements(),x=f>0?((n=m[0])==null?void 0:n.key)??o.getItemKey(0):null,g=f>0?((i=m[f-1])==null?void 0:i.key)??o.getItemKey(f-1):null;if(p!==f||f>0&&p>0&&(s.getItemKey(0)!==x||s.getItemKey(p-1)!==g)){h=!0;const b=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??m[0]:null;b&&(a=[b.key,this.getScrollOffset()-b.start]);const w=s.followOnAppend===!0?"auto":s.followOnAppend||null;w&&p>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||s.getItemKey(p-1)!==g)&&(l=w)}}this.options=s,h&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(a&&this.scrollOffset!==null){const[f,p]=a,m=this.getMeasurements(),{count:x,getItemKey:g}=this.options;let y=0;for(;y<x&&g(y)!==f;)y++;if(y<x){const C=m[y];if(C){const b=C.start+p;b!==this.scrollOffset&&(d=b-this.scrollOffset,this.scrollOffset=b,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?a[0]:null,u?a[1]:0,l,d])},this.notify=r=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,r)},this.maybeNotify=Ri(()=>(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}if(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(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!qh()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,nc),s.addEventListener("touchend",a,nc),this.unsubs.push(()=>{s.removeEventListener("touchstart",o),s.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,o,a,l]=i;s!==null&&!a&&(qh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),n=this.getMaxScrollOffset();if(r<0||r>n)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=i,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 l=s.get(a.lane);if(l==null||a.end>l.end?s.set(a.lane,a):a.end<l.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=Ri(()=>[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,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Ri(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l},h)=>{const u=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const m of this.laneAssignments.keys())m>=r&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),a===1){const m=this.options.gap,x=r*2;let g=this._flatMeasurements;if(!g||g.length<x){const b=new Float64Array(x);g&&d>0&&b.set(g.subarray(0,d*2)),g=b,this._flatMeasurements=g}let y;if(d===0)y=n+i;else{const b=d-1;y=g[b*2]+g[b*2+1]+m}for(let b=d;b<r;b++){const w=s(b),_=u.get(w),S=typeof _=="number"?_:this.options.estimateSize(b);g[b*2]=y,g[b*2+1]=S,y+=S+m}const C=HH(r,g,s);return this.measurementsCache=C,C}const f=this.measurementsCache.slice(0,d),p=new Array(a).fill(void 0);for(let m=0;m<d;m++){const x=f[m];x&&(p[x.lane]=m)}for(let m=d;m<r;m++){const x=s(m),g=this.laneAssignments.get(m);let y,C;const b=l==="estimate"||u.has(x);if(g!==void 0&&this.options.lanes>1){y=g;const N=p[y],A=N!==void 0?f[N]:void 0;C=A?A.end+this.options.gap:n+i}else{const N=this.options.lanes===1?f[m-1]:this.getFurthestMeasurement(f,m);C=N?N.end+this.options.gap:n+i,y=N?N.lane:m%this.options.lanes,this.options.lanes>1&&b&&this.laneAssignments.set(m,y)}const w=u.get(x),_=typeof w=="number"?w:this.options.estimateSize(m),S=C+_;f[m]={index:m,start:C,size:_,end:S,key:x,lane:y},p[y]=m}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ri(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?nU({measurements:r,outerSize:n,scrollOffset:i,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ri(()=>{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,s;if(r<0||r>=this.options.count)return;let o,a,l;const h=this._flatMeasurements;if(this.options.lanes===1&&h!==null)l=this.options.getItemKey(r),a=h[r*2],o=h[r*2+1];else{const f=this.measurementsCache[r];if(!f)return;l=f.key,a=f.start,o=f.size}const u=this.itemSizeCache.get(l)??o,d=n-u;if(d!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=f?this.getTotalSize():0,m=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:l,start:a,size:o,end:a+o,lane:0},d,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||r<this.pendingMin)&&(this.pendingMin=r),this.itemSizeCache.set(l,n),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-p):m&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=Ri(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,n)=>{const i=[];for(let s=0,o=r.length;s<o;s++){const a=r[s],l=n[a];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const n=this.getMeasurements();if(n.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,o=Y2(0,n.length-1,s?a=>i[a*2]:a=>Ix(n[a]).start,r);return Ix(n[o])},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.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,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,l=this.now();this.scrollState={index:r,align:a,behavior:i,startedAt:l,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.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=n.length-1,o=this._flatMeasurements;o!=null?i=o[s*2]+o[s*2+1]:i=((r=n[s])==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.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const n=this.getMeasurements();for(const i of n)i&&this.itemSizeCache.has(i.key)&&r.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return r},this._scrollToOffset=(r,{adjustments:n,behavior:i})=>{this._intendedScrollOffset=r+(n??0),this.options.scrollToFn(r,{behavior:i,adjustments:n},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,r){e!==0&&(qh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:r}))}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&&UH(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(i-this.getScrollOffset()),h=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=i,h||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:h?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Y2=(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 nU({measurements:t,outerSize:e,scrollOffset:r,lanes:n,flat:i}){const s=t.length-1,o=i?u=>i[u*2]:u=>t[u].start,a=i?u=>i[u*2]+i[u*2+1]:u=>t[u].end;if(t.length<=n)return{startIndex:0,endIndex:s};let l=Y2(0,s,o,r),h=l;if(n===1)for(;h<s&&a(h)<r+e;)h++;else if(n>1){const u=Array(n).fill(0);for(;h<s&&u.some(f=>f<r+e);){const f=t[h];u[f.lane]=f.end,h++}const d=Array(n).fill(r+e);for(;l>=0&&d.some(f=>f>=r);){const f=t[l];d[f.lane]=f.start,l--}l=Math.max(0,l-l%n),h=Math.min(s,h+(n-1-h%n))}return{startIndex:l,endIndex:h}}const Hh=typeof document<"u"?k.useLayoutEffect:k.useEffect;function iU({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:r="transform",...n}){const i=k.useReducer(h=>h+1,0)[1],s=k.useRef({enabled:e,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=e,s.current.mode=r;const o=h=>{const u=s.current;if(!u.enabled)return;const d=h.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const y=h.options.horizontal?"width":"height";u.container.style[y]=`${d}px`}const f=!!h.options.horizontal,p=u.mode==="transform",m=f?"left":"top",x=h.options.scrollMargin,g=h.getVirtualItems();for(const y of g){const C=y.start-x,b=h.elementsCache.get(y.key);b&&u.lastPositions.get(b)!==C&&(u.lastPositions.set(b,C),p?b.style.transform=f?`translate3d(${C}px, 0, 0)`:`translate3d(0, ${C}px, 0)`:b.style[m]=`${C}px`)}},a={...n,onChange:(h,u)=>{var d;const f=s.current;let p=!0;if(f.enabled){o(h);const m=h.range,x=f.prevRange;p=!x||x.isScrolling!==h.isScrolling||x.startIndex!==(m==null?void 0:m.startIndex)||x.endIndex!==(m==null?void 0:m.endIndex),p&&(f.prevRange=m?{startIndex:m.startIndex,endIndex:m.endIndex,isScrolling:h.isScrolling}:null)}p&&(t&&u?uS.flushSync(i):i()),(d=n.onChange)==null||d.call(n,h,u)}},[l]=k.useState(()=>{const h=new rU(a);return Object.assign(h,{containerRef:u=>{const d=s.current;if(d.container=u,d.lastSize=null,u&&d.enabled){const f=h.getTotalSize();d.lastSize=f;const p=h.options.horizontal?"width":"height";u.style[p]=`${f}px`}}})});return l.setOptions(a),Hh(()=>l._didMount(),[]),Hh(()=>l._willUpdate()),Hh(()=>{o(l)}),l}function sU(t){return iU({observeElementRect:XH,observeElementOffset:ZH,scrollToFn:eU,...t})}function oU(t,e,r){var a,l;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:((l=h.errors)==null?void 0:l.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=mn[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 aU={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function lU(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 cU({event:t,onSelectItem:e,style:r}){const n=aU[t.category]||"●",i=HT[t.category]||"text-zinc-400",s=qT[t.severity]||"text-zinc-400";return c.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded",style:r,children:[c.jsx("span",{className:st("text-[11px] shrink-0 w-4 text-center leading-4",i),children:n}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:st("text-[11px] truncate",s),children:t.title}),t.detail&&c.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.detail})]}),c.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0 leading-4",children:lU(t.timestamp)})]})}const hU=["all","phase","gate","session","iteration","error"],Dx={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function uU({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=k.useState("all"),[s,o]=k.useState([]),a=k.useRef(null),l=fr(m=>m.gates),h=fr(m=>m.featureTimeline),u=fr(m=>m.setFeatureTimeline);k.useEffect(()=>{if(!t)return;let m=!1;return Mt(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=50`).then(x=>x.json()).then(x=>{if(m)return;const g=e?(l||[]).filter(C=>C.itemId===e):l||[],y=oU(x.sessions||[],g,{id:e});o(y)}).catch(()=>{m||o([])}),()=>{m=!0}},[t,e]);const d=k.useMemo(()=>{var g,y;const m=new Map;for(const C of s)m.set(C.id,C);for(const C of h){const b=(g=C.meta)==null?void 0:g.itemId,w=(y=C.meta)==null?void 0:y.featureCode;(!b&&!w||b===e||w===t)&&m.set(C.id,C)}const x=[...m.values()];return x.sort((C,b)=>C.timestamp.localeCompare(b.timestamp)),x},[s,h,e,t]),f=k.useMemo(()=>n==="all"?d:d.filter(m=>m.category===n),[d,n]),p=sU({count:f.length,getScrollElement:()=>a.current,estimateSize:()=>48,overscan:5});return k.useEffect(()=>{u&&u([])},[t]),t?c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsx("div",{className:"flex flex-wrap gap-1 px-2 py-2 border-b border-border",children:hU.map(m=>c.jsxs("button",{className:st("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:[Dx[m],m!=="all"&&c.jsx("span",{className:"ml-1 text-[9px] opacity-60",children:d.filter(x=>x.category===m).length})]},m))}),c.jsx("div",{className:"px-2 py-1",children:c.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[f.length," event",f.length!==1?"s":""]})}),c.jsx("div",{ref:a,className:"flex-1 overflow-auto",children:f.length===0?c.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2 py-4 text-center",children:["No events",n!=="all"?` in "${Dx[n]}"`:"","."]}):c.jsx("div",{style:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"},children:p.getVirtualItems().map(m=>c.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${m.size}px`,transform:`translateY(${m.start}px)`},children:c.jsx(cU,{event:f[m.index],onSelectItem:r})},m.key))})})]}):c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"Select a feature to see its timeline."})})}const Ao=["explore_design","prd","architecture","blueprint","plan","execute","report"];function dU(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 pU({currentPhase:t}){const e=Ao.indexOf(t);return c.jsx("div",{className:"space-y-1.5",children:Ao.map((r,n)=>{const i=e>n,s=e===n,o=Ce[r]??r;return c.jsxs("div",{className:"flex items-center gap-2",style:{animation:`phase-slide-in 300ms ease-out ${n*50}ms both`},children:[i?c.jsx(Jx,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?c.jsx(Kx,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):c.jsx(PS,{className:"w-3.5 h-3.5 text-muted-foreground/40 shrink-0"}),c.jsx("span",{className:st("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 fU({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=k.useMemo(()=>{const a=["design.md","blueprint.md","plan.md","prd.md","architecture.md"],l=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:l.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 c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents"}),i.length===0&&s.length===0&&c.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-1",children:"No agents active"}),c.jsxs("div",{className:"mt-1 space-y-1.5",children:[i.map((a,l)=>c.jsx(Mx,{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||l)),s.map((a,l)=>c.jsx(Mx,{agent:a},a.agentId||`r-${l}`))]})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Artifacts"}),c.jsx("div",{className:"mt-1 space-y-1",children:o.map(a=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(wi,{className:st("w-3 h-3",a.done?"text-emerald-400":"text-muted-foreground/40")}),c.jsx("span",{className:st("text-[11px] font-mono",a.done?"text-foreground":"text-muted-foreground/50"),children:a.name})]},a.name))})]})]})}function mU({gates:t,allGates:e,items:r,onResolveGate:n}){const i=dS(),s=k.useMemo(()=>{const o=new Map,a=(e||[]).filter(l=>l.resolvedAt&&(l.outcome==="revised"||l.outcome==="revise")).sort((l,h)=>new Date(h.resolvedAt)-new Date(l.resolvedAt));for(const l of t||[]){const h=a.find(u=>u.stepId===l.stepId&&u.itemId===l.itemId);h!=null&&h.artifactSnapshot&&l.artifactSnapshot&&o.set(l.id,{priorSnapshot:h.artifactSnapshot,currentSnapshot:l.artifactSnapshot})}return o},[t,e]);return!t||t.length===0?c.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No gates pending."}):c.jsx("div",{className:"space-y-2",children:t.map(o=>{var h;const a=r.find(u=>u.id===o.itemId),l=(h=o.artifactAssessment)==null?void 0:h.completeness;return c.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/30",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-[11px] text-foreground truncate",children:(a==null?void 0:a.title)??"Unknown"}),c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[mn[o.stepId]??Ce[o.fromPhase]??o.fromPhase??"Gate",l!=null&&` · ${Math.round(l*100)}% complete`]}),s.has(o.id)&&c.jsx("div",{className:"mt-1",children:c.jsx(sf,{oldText:s.get(o.id).priorSnapshot,newText:s.get(o.id).currentSnapshot})})]}),c.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[c.jsx(Pt,{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"}),c.jsx(Pt,{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"}),c.jsx(Pt,{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 gU({sessions:t,items:e,onSelect:r}){const n=(t||[]).slice(-5).reverse();return n.length===0?c.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No sessions yet."}):c.jsx("div",{className:"space-y-1",children:n.map(i=>{const s=i.featureCode||i.feature_code,o=s?e.find(l=>{var h;return l.featureCode===s||l.feature_code===s||((h=l.lifecycle)==null?void 0:h.featureCode)===s}):null,a=i.startedAt||i.created_date;return c.jsxs("div",{className:st("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:[c.jsx(LT,{className:"w-3 h-3 text-muted-foreground shrink-0"}),c.jsx("span",{className:"text-[11px] text-foreground",children:i.agent||"agent"}),s&&c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:s}),c.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:dU(a)}),c.jsx("span",{className:st("w-1.5 h-1.5 rounded-full shrink-0",i.status==="active"?"bg-emerald-400":"bg-slate-600")})]},i.id)})})}function xU({items:t=[],gates:e=[],sessions:r=[],activeBuild:n,spawnedAgents:i=[],featureCode:s,sessionState:o,agentActivity:a,iterationStates:l,onSelect:h,onResolveGate:u,onOpenGate:d,onCreateFeature:f,isEmptyProject:p}){var S;const m=k.useMemo(()=>t.find(N=>{var A;return N.featureCode===s||((A=N.lifecycle)==null?void 0:A.featureCode)===s}),[t,s]),[x,g]=k.useState(()=>{try{return localStorage.getItem("compose:timeline-open")==="true"}catch{return!1}}),y=k.useCallback(()=>{g(N=>{const A=!N;try{localStorage.setItem("compose:timeline-open",String(A))}catch{}return A})},[]),C=((S=m==null?void 0:m.lifecycle)==null?void 0:S.currentPhase)||(m==null?void 0:m.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,b=Ao.indexOf(C),w=C?Math.max(0,(b+1)/Ao.length):0,_=k.useMemo(()=>{let N=e.filter(A=>A.status==="pending"||!A.resolvedAt);if(s){const A=new Set(t.filter(L=>{var j;return L.featureCode===s||((j=L.lifecycle)==null?void 0:j.featureCode)===s}).map(L=>L.id));N=N.filter(L=>A.has(L.itemId))}return N},[e,t,s]);if(!s){const N=t.filter(A=>A.type==="feature"&&(A.status==="complete"||A.status==="done")).slice(-5);return c.jsx("div",{className:"flex-1 overflow-auto p-4",children:c.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-center",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:p?"No items yet.":"No feature in progress."}),p&&f&&c.jsx(Pt,{variant:"outline",size:"sm",onClick:f,children:"Create your first feature"}),c.jsx("p",{className:"text-[11px] text-muted-foreground/70 font-mono",children:"Run /compose <feature-code> in the terminal to start."}),N.length>0&&c.jsxs("div",{className:"mt-6 w-full max-w-sm",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recently completed"}),c.jsx("div",{className:"mt-2 space-y-1",children:N.map(A=>c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>h(A.id),children:[c.jsx(Jx,{className:"w-3 h-3 text-emerald-400 shrink-0"}),c.jsx("span",{className:"text-[11px] text-foreground truncate",children:A.title}),A.featureCode&&c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:A.featureCode})]},A.id))})]})]})})}return c.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[c.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4 min-w-0",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h2",{className:"text-sm font-semibold text-foreground truncate",children:(m==null?void 0:m.title)??s}),c.jsx(rr,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),C&&c.jsx(rr,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:Ce[C]??C}),c.jsxs("button",{className:st("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:[c.jsx(sT,{className:"w-3 h-3"}),"Timeline"]})]}),c.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-muted overflow-hidden",children:c.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)"}})}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:b>=0?`${b+1} of ${Ao.length} phases`:"Phase unknown"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs(cd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[c.jsx(hd,{className:"p-3 pb-2",children:c.jsx(ud,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),c.jsx(dd,{className:"p-3 pt-0",children:c.jsx(pU,{currentPhase:C})})]}),c.jsxs(cd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[c.jsx(hd,{className:"p-3 pb-2",children:c.jsx(ud,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),c.jsx(dd,{className:"p-3 pt-0",children:c.jsx(fU,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),l&&l.size>0&&c.jsx("div",{className:"space-y-2",children:[...l.values()].map(N=>c.jsxs("div",{className:"px-3 py-2.5 rounded border border-blue-500/30 bg-blue-500/10",children:[c.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[c.jsxs("span",{className:"text-[11px] text-blue-400 font-medium",children:[N.status==="running"?"↻":N.outcome==="clean"?"✓":"✗"," ",N.loopType==="review"?"Review Loop":"Coverage Sweep"]}),c.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[N.count," of ",N.maxIterations]})]}),c.jsx("div",{className:"h-1.5 rounded-full bg-blue-500/20 overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.round(N.count/N.maxIterations*100)}%`,transition:"width 600ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:N.outcome==="clean"?"#22c55e":N.outcome==="max_reached"?"#ef4444":"#3b82f6"}})}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:N.status==="running"?N.loopType==="review"?"Waiting for clean review...":"Waiting for tests passing...":N.outcome==="clean"?"Clean!":N.outcome==="max_reached"?"Max iterations reached":"Aborted"})]},N.loopId))}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Pending Gates"}),_.length>0&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:_.length})]}),c.jsx(mU,{gates:_,allGates:e,items:t,onResolveGate:u})]}),c.jsxs("div",{children:[c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recent Sessions"}),c.jsx("div",{className:"mt-2",children:c.jsx(gU,{sessions:r,items:t,onSelect:h})})]})]}),x&&c.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0",children:[c.jsx("div",{className:"px-3 py-2 border-b border-border",children:c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Event Timeline"})}),c.jsx(uU,{featureCode:s,itemId:m==null?void 0:m.id,onSelectItem:h})]})]})}function yU(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 bU(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:yU(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function CU({results:t,onClose:e}){const r=k.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 c.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:c.jsx(fi,{className:"w-5 h-5 text-emerald-400"})}),c.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Triage complete"}),c.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Triaged ",n," of ",t.length," ideas"]}),c.jsxs("div",{className:"flex gap-3 text-[11px]",children:[r.P0>0&&c.jsxs("span",{className:"text-red-400",children:[r.P0," P0"]}),r.P1>0&&c.jsxs("span",{className:"text-amber-400",children:[r.P1," P1"]}),r.P2>0&&c.jsxs("span",{className:"text-blue-400",children:[r.P2," P2"]}),r.promoted>0&&c.jsxs("span",{className:"text-emerald-400",children:[r.promoted," promoted"]}),r.killed>0&&c.jsxs("span",{className:"text-muted-foreground",children:[r.killed," killed"]}),r.skipped>0&&c.jsxs("span",{className:"text-muted-foreground/60",children:[r.skipped," skipped"]})]}),c.jsx(Pt,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function kU({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=ys(),[o,a]=k.useState(()=>[...t]),[l,h]=k.useState(0),[u,d]=k.useState([]),[f,p]=k.useState(!1),[m,x]=k.useState(""),[g,y]=k.useState(!1),[C,b]=k.useState(!1),w=o[l]??null;o.length-l;const _=k.useMemo(()=>w?bU(w,s.filter(F=>F.id!==w.id)):[],[w,s]),S=k.useCallback(()=>{const F=l+1;F>=o.length?p(!0):(h(F),y(!1),x(""))},[l,o.length]),N=k.useCallback(async F=>{if(!(!w||C)){b(!0);try{await r(w.id,F),d(z=>[...z,{id:w.id,action:"priority",priority:F}]),S()}finally{b(!1)}}},[w,C,r,S]),A=k.useCallback(async()=>{if(!(!w||C)){b(!0);try{await n(w.id,m),d(F=>[...F,{id:w.id,action:"kill"}]),y(!1),x(""),S()}finally{b(!1)}}},[w,C,n,m,S]),L=k.useCallback(()=>{w&&(d(F=>[...F,{id:w.id,action:"skip"}]),S())},[w,S]),j=k.useCallback(async()=>{if(!(!w||C)){b(!0);try{await i(w.id),d(F=>[...F,{id:w.id,action:"promote"}]),S()}finally{b(!1)}}},[w,C,i,S]);return k.useEffect(()=>{const F=z=>{if(z.key==="Escape"){e();return}g||(z.key==="0"&&N("P0"),z.key==="1"&&N("P1"),z.key==="2"&&N("P2"),(z.key==="s"||z.key==="ArrowRight")&&L(),z.key==="k"&&y(!0))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[g,N,L,e]),c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"hsl(var(--background) / 0.8)",backdropFilter:"blur(4px)"},children:c.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:[c.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[c.jsx(fi,{className:"w-4 h-4 text-amber-400 shrink-0"}),c.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Triage"}),!f&&c.jsxs("span",{className:"text-[11px] text-muted-foreground ml-1",children:[l+1," of ",o.length," untriaged"]}),c.jsx("div",{className:"flex-1"}),c.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:c.jsx(yn,{className:"w-4 h-4"})})]}),!f&&c.jsx("div",{className:"h-1 bg-muted",children:c.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${Math.round(l/o.length*100)}%`}})}),c.jsx("div",{className:"flex-1 p-4",children:f?c.jsx(CU,{results:u,onClose:e}):w?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:w.id}),w.cluster&&c.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:w.cluster})]}),c.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:w.title}),w.description&&c.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:w.description}),c.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(w.tags||[]).map(F=>c.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:F},F))}),w.source&&c.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",w.source]})]}),_.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Similar to:"}),c.jsx("div",{className:"space-y-1",children:_.map(F=>c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-muted/30 border border-border/40",children:[c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:F.id}),c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:F.title})]},F.id))})]}),g&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing (optional)…",value:m,onChange:F=>x(F.target.value),onKeyDown:F=>{F.key==="Enter"&&A(),F.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"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Pt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),c.jsx(Pt,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:A,disabled:C,children:"Confirm Kill"})]})]})]}):c.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-8",children:"No more untriaged ideas."})}),!f&&w&&!g&&c.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[c.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[c.jsxs(Pt,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>N("P0"),disabled:C,title:"Press 0",children:["P0 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),c.jsxs(Pt,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>N("P1"),disabled:C,title:"Press 1",children:["P1 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),c.jsxs(Pt,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>N("P2"),disabled:C,title:"Press 2",children:["P2 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"2"})]})]}),c.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[c.jsx(Pt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:j,disabled:C,children:"Promote"}),c.jsxs(Pt,{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 ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"k"})]}),c.jsxs(Pt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:L,title:"Press s or →",children:[c.jsx(s0,{className:"w-3 h-3"}),"Skip ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function Px(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 vU(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
662
-
663
- **Date:** ${r}
664
- **Promoted from:** ${t.id}
665
- **Priority:** ${t.priority||"TBD"}
666
- **Tags:** ${n}
667
-
668
- ## Context
669
-
670
- ${t.description||t.title}
671
-
672
- ## Source
673
-
674
- ${t.source||"Internal idea"}
675
-
676
- ## Goals
677
-
678
- - [ ] Define acceptance criteria
679
- - [ ] Identify affected components
680
- - [ ] Estimate effort
681
-
682
- ## Related
683
-
684
- ${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
685
- `.trimStart()}function wU({step:t,current:e}){const r=e>t,n=e===t;return c.jsx("div",{className:"flex items-center gap-1.5",children:c.jsx("div",{className:st("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?c.jsx(Qo,{className:"w-3 h-3"}):t})})}function SU({idea:t,onClose:e}){var _;const{promoteIdea:r}=ys(),[n,i]=k.useState(1),[s,o]=k.useState(()=>Px(t)),[a,l]=k.useState(""),[h,u]=k.useState(""),[d,f]=k.useState(!1),[p,m]=k.useState(null),x=k.useRef(null);k.useEffect(()=>{u(vU(t,s||"FEAT-?"))},[t,s]),k.useEffect(()=>{n===1&&setTimeout(()=>{var S;return(S=x.current)==null?void 0:S.focus()},50)},[n]);const g=()=>s.trim()?/^[A-Z0-9][A-Z0-9-]*[A-Z0-9]$/i.test(s.trim())?(l(""),!0):(l("Use format like FEAT-1 or COMP-UI-5"),!1):(l("Feature code is required"),!1),y=()=>{n===1&&!g()||i(S=>S+1)},C=()=>i(S=>S-1),b=async()=>{if(!d){f(!0);try{await r(t.id,s.trim().toUpperCase()),m({featureCode:s.trim().toUpperCase()}),i(4)}catch(S){l(S.message||"Failed to promote"),i(1)}finally{f(!1)}}},w=["Feature ID","Preview","Confirm"];return c.jsx(bd,{open:!0,onOpenChange:S=>!S&&e(),children:c.jsxs(Cd,{className:"max-w-lg",children:[c.jsx(kd,{children:c.jsxs(vd,{className:"flex items-center gap-2",children:[c.jsx(fi,{className:"w-4 h-4 text-amber-400"}),"Promote to Feature"]})}),n<4&&c.jsx("div",{className:"px-6 -mt-1 mb-1",children:c.jsx("div",{className:"flex items-center gap-2",children:[1,2,3].map((S,N)=>c.jsxs(qt.Fragment,{children:[c.jsx(wU,{step:S,current:n}),c.jsx("span",{className:st("text-[10px] transition-colors",n===S?"text-foreground font-medium":"text-muted-foreground/60"),children:w[N]}),N<2&&c.jsx(pi,{className:"w-3 h-3 text-muted-foreground/30 mx-0.5"})]},S))})}),c.jsxs("div",{className:"px-6 pb-2",children:[n<4&&c.jsxs("div",{className:"mb-4 px-3 py-2 rounded border border-border/50 bg-muted/20",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:t.id}),t.priority&&t.priority!=="—"&&c.jsx("span",{className:st("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})]}),c.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug",children:t.title})]}),n===1&&c.jsxs("div",{className:"space-y-3",children:[c.jsxs("label",{className:"block",children:[c.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Feature Code"}),c.jsx("input",{ref:x,type:"text",value:s,onChange:S=>{o(S.target.value.toUpperCase()),l("")},onKeyDown:S=>{S.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&&c.jsx("p",{className:"text-[11px] text-destructive mt-1",children:a})]}),t.cluster&&c.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Suggested from cluster: ",c.jsx("span",{className:"text-muted-foreground",children:t.cluster})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Suggestions"}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:[Px(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((S,N,A)=>A.indexOf(S)===N).map(S=>c.jsx("button",{onClick:()=>{o(S),l("")},className:st("text-[10px] px-2 py-1 rounded border font-mono transition-colors",s===S?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:S},S))})]})]}),n===2&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Generated plan.md stub"}),c.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}),c.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&&c.jsxs("div",{className:"space-y-3",children:[c.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Promote ",c.jsx("span",{className:"text-foreground font-medium",children:t.id})," to feature"," ",c.jsx("span",{className:"font-mono text-accent font-semibold",children:s}),"?"]}),c.jsxs("p",{className:"text-[11px] text-muted-foreground/70",children:["The idea will be marked ",c.jsxs("span",{className:"font-mono",children:["PROMOTED (",s,")"]})," in the ideabox."]})]}),n===4&&p&&c.jsxs("div",{className:"flex flex-col items-center gap-3 py-4 text-center",children:[c.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:c.jsx(Qo,{className:"w-5 h-5 text-emerald-400"})}),c.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Promoted!"}),c.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t.id," is now linked to feature"," ",c.jsx("span",{className:"font-mono text-accent font-semibold",children:p.featureCode})]}),c.jsx(Pt,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&c.jsxs(Gx,{children:[n>1&&c.jsxs(Pt,{variant:"ghost",size:"sm",onClick:C,disabled:d,children:[c.jsx(Qx,{className:"w-3 h-3 mr-1"}),"Back"]}),c.jsx(Pt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?c.jsxs(Pt,{size:"sm",onClick:y,children:["Next",c.jsx(pi,{className:"w-3 h-3 ml-1"})]}):c.jsx(Pt,{size:"sm",onClick:b,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const pd=["S","M","L"],TU=["high","medium","low"],_U={"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"},Ox={"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"},$x=["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 jU({idea:t,onSubmit:e,onCancel:r}){const[n,i]=k.useState(t.effort||""),[s,o]=k.useState(t.impact||"");return c.jsxs("div",{className:"p-2 bg-card border border-border rounded-lg shadow-md w-52",children:[c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-2 truncate font-medium",children:[t.id,": ",t.title]}),c.jsxs("div",{className:"mb-2",children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Effort"}),c.jsx("div",{className:"flex gap-1",children:pd.map(a=>c.jsx("button",{onClick:()=>i(a),className:st("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))})]}),c.jsxs("div",{className:"mb-2.5",children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Impact"}),c.jsx("div",{className:"flex gap-1",children:["high","medium","low"].map(a=>c.jsx("button",{onClick:()=>o(a),className:st("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))})]}),c.jsxs("div",{className:"flex gap-1",children:[c.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"}),c.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 NU({ideas:t,selectedIdeaId:e,onSelectIdea:r,onUpdateIdea:n}){const[i,s]=k.useState(null),o=k.useMemo(()=>{const u=[...new Set(t.map(f=>f.cluster||"__none__"))],d={};return u.forEach((f,p)=>{d[f]=$x[p%$x.length]}),d},[t]),a=k.useMemo(()=>t.filter(u=>u.effort&&u.impact),[t]),l=k.useMemo(()=>t.filter(u=>!u.effort||!u.impact),[t]),h=k.useCallback(async(u,d)=>{await n(u,d),s(null)},[n]);return c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"flex mb-1 ml-12",children:pd.map(u=>c.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),TU.map(u=>c.jsxs("div",{className:"flex mb-1",children:[c.jsx("div",{className:"w-12 shrink-0 flex items-center justify-end pr-2",children:c.jsx("span",{className:"text-[9px] text-muted-foreground capitalize",children:u})}),pd.map(d=>{const f=`${u}-${d}`,p=_U[f],m=a.filter(x=>x.impact===u&&x.effort===d);return c.jsxs("div",{className:st("flex-1 min-h-[90px] rounded border p-1.5 mr-1 relative transition-colors",Ox[p]||"border-border/30"),children:[c.jsx("span",{className:"absolute top-1 right-1 text-[8px] text-muted-foreground/50 italic",children:p}),c.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 c.jsx("button",{onClick:()=>r==null?void 0:r(x.id),title:`${x.id}: ${x.title}`,className:st("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)),c.jsx("div",{className:"flex ml-12",children:c.jsx("div",{className:"flex-1 text-center text-[9px] text-muted-foreground/60 mt-0.5",children:"Effort (S = small, M = medium, L = large)"})})]}),c.jsx("div",{className:"flex flex-wrap gap-3 text-[10px]",children:Object.entries(Ox).map(([u,d])=>c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("div",{className:st("w-2.5 h-2.5 rounded-sm border",d)}),c.jsx("span",{className:"text-muted-foreground",children:u})]},u))}),l.length>0&&c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-2",children:["Unassigned (",l.length,") — click to assign effort/impact"]}),c.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(u=>c.jsxs("div",{className:"relative",children:[c.jsxs("button",{onClick:()=>s((i==null?void 0:i.id)===u.id?null:u),className:st("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:[c.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&&c.jsx("div",{className:"absolute left-0 top-full mt-1 z-10",children:c.jsx(jU,{idea:u,onSubmit:h,onCancel:()=>s(null)})})]},u.id))})]})]})}function Uh({value:t,max:e,color:r="bg-primary/60"}){const n=e>0?Math.round(t/e*100):0;return c.jsx("div",{className:"flex-1 h-1.5 bg-muted/50 rounded-full overflow-hidden",children:c.jsx("div",{className:st("h-full rounded-full transition-all",r),style:{width:`${n}%`}})})}function EU({ideas:t,killed:e}){const[r,n]=k.useState(!1),i=k.useMemo(()=>{var C,b,w,_;const s=[...t,...e||[]],o={};for(const S of s){const N=((C=S.source)==null?void 0:C.trim())||"(no source)",A=N.length>30?N.slice(0,30)+"…":N;o[A]=(o[A]||0)+1}const a=Object.entries(o).sort((S,N)=>N[1]-S[1]).slice(0,6),l=((b=a[0])==null?void 0:b[1])||1,h=s.filter(S=>S.status==="NEW").length,u=s.filter(S=>S.status==="DISCUSSING").length,d=s.filter(S=>{var N;return(N=S.status)==null?void 0:N.startsWith("PROMOTED")}).length,f=(e||[]).length,p=t.length,m=s.length>0?Math.round(f/s.length*100):0,x={};for(const S of s){const N=S.cluster||"(unclustered)";x[N]||(x[N]={total:0,promoted:0}),x[N].total+=1,(w=S.status)!=null&&w.startsWith("PROMOTED")&&(x[N].promoted+=1)}const g=Object.entries(x).sort((S,N)=>N[1].total-S[1].total).slice(0,5),y=((_=g[0])==null?void 0:_[1].total)||1;return{sourceEntries:a,maxSourceCount:l,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:c.jsxs("div",{className:"mt-1.5",children:[c.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?c.jsx(Es,{className:"w-3 h-3"}):c.jsx(pi,{className:"w-3 h-3"}),c.jsx(TS,{className:"w-3 h-3"}),c.jsx("span",{children:"Analytics"})]}),r&&c.jsxs("div",{className:"mt-2 space-y-3 border border-border/30 rounded-lg p-3 bg-muted/10",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Status Funnel"}),c.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})=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-16 text-[9px] text-muted-foreground shrink-0",children:s}),c.jsx(Uh,{value:o,max:Math.max(i.newCount,i.discussingCount,i.promotedCount,i.killedCount,1),color:a}),c.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))}),i.killRate>0&&c.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-1",children:["Kill rate: ",i.killRate,"%"]})]}),i.sourceEntries.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"By Source"}),c.jsx("div",{className:"space-y-1",children:i.sourceEntries.map(([s,o])=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),c.jsx(Uh,{value:o,max:i.maxSourceCount,color:"bg-violet-400/50"}),c.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))})]}),i.clusterEntries.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Cluster Health"}),c.jsx("div",{className:"space-y-1",children:i.clusterEntries.map(([s,{total:o,promoted:a}])=>{const l=o>0?Math.round(a/o*100):0;return c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),c.jsx(Uh,{value:o,max:i.maxClusterTotal,color:"bg-cyan-400/50"}),c.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o}),l>0&&c.jsxs("span",{className:"text-[9px] text-blue-400 shrink-0",children:[l,"%"]})]},s)})})]})]})]})}const BU=[{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 Rx(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function G2({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 c.jsx("span",{className:st("inline-block w-2 h-2 rounded-full shrink-0",e),title:t})}function LU({priority:t}){if(!t||t==="—")return c.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 c.jsx("span",{className:st("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 AU({idea:t,selected:e,onClick:r,onDragStart:n,onDragEnd:i}){var s;return c.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:st("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:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),c.jsx(G2,{status:t.status}),c.jsx("div",{className:"flex-1"}),c.jsx(LU,{priority:t.priority})]}),c.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&&c.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[t.tags.slice(0,4).map(o=>c.jsx("span",{className:"text-[9px] text-muted-foreground/70 font-mono",children:o},o)),t.tags.length>4&&c.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["+",t.tags.length-4]})]}),t.source&&c.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.source})]})}function MU({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,C,b,w;const[o,a]=k.useState(""),[l,h]=k.useState(!1),[u,d]=k.useState(!1),[f,p]=k.useState(""),[m,x]=k.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 c.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0 overflow-hidden",children:[c.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),c.jsx(G2,{status:t.status}),c.jsx("span",{className:"text-[11px] text-muted-foreground flex-1 truncate",children:t.status}),c.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground text-xs px-1",children:"x"})]}),c.jsxs("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Title"}),c.jsx("p",{className:"text-[13px] text-foreground font-medium leading-snug",children:t.title})]}),t.description&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),c.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:t.description})]}),t.source&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Source"}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.source})]}),t.cluster&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Cluster"}),c.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.cluster})]}),((y=t.tags)==null?void 0:y.length)>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Tags"}),c.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(_=>c.jsx("span",{className:"text-[10px] bg-muted/50 px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:_},_))})]}),t.mapsTo&&c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Maps To"}),c.jsx("p",{className:"text-[11px] text-muted-foreground font-mono",children:t.mapsTo})]}),c.jsxs("div",{children:[c.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5 flex items-center gap-1",children:[c.jsx(sc,{className:"w-3 h-3"}),"Discussion",((C=t.discussion)==null?void 0:C.length)>0&&c.jsxs("span",{className:"text-muted-foreground/50",children:["(",t.discussion.length,")"]})]}),((b=t.discussion)==null?void 0:b.length)>0&&c.jsx("div",{className:"space-y-1.5 mb-2",children:t.discussion.map((_,S)=>c.jsxs("div",{className:"px-2 py-1.5 rounded bg-muted/30 border border-border/30",children:[c.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[c.jsx("span",{className:st("text-[9px] font-mono font-semibold",_.author==="agent"?"text-blue-400":"text-emerald-400"),children:_.author}),c.jsx("span",{className:"text-[9px] text-muted-foreground/50",children:_.date})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground leading-relaxed",children:_.text})]},S))}),c.jsxs("div",{className:"flex gap-1.5 items-end",children:[c.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}),c.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:c.jsx(_d,{className:"w-3 h-3"})})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Priority"}),c.jsx("div",{className:"flex gap-1.5",children:["P0","P1","P2","—"].map(_=>c.jsx("button",{onClick:()=>i(t.id,_),className:st("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"&&c.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[c.jsx(Pt,{size:"sm",className:"w-full h-7 text-[11px]",onClick:()=>r(t),children:"Promote to Feature"}),l?c.jsxs("div",{className:"space-y-1.5",children:[c.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"}),c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx(Pt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{h(!1),a("")},children:"Cancel"}),c.jsx(Pt,{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"})]})]}):c.jsx(Pt,{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 IU({killed:t,onResurrect:e}){const[r,n]=k.useState(!1);return t.length===0?null:c.jsxs("div",{className:"mt-4 border border-border/40 rounded-lg overflow-hidden",children:[c.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?c.jsx(Es,{className:"w-3 h-3 text-muted-foreground"}):c.jsx(pi,{className:"w-3 h-3 text-muted-foreground"}),c.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Graveyard"}),c.jsxs("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:["(",t.length,")"]})]}),r&&c.jsx("div",{className:"p-3 grid grid-cols-1 gap-2 bg-muted/10",children:t.map(i=>c.jsx("div",{className:"px-3 py-2 rounded border border-border/40 bg-card/40",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[c.jsx(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0 opacity-60",children:i.id}),c.jsx("p",{className:"text-[11px] text-muted-foreground/70 line-clamp-1 font-medium",children:i.title})]}),i.killedDate&&c.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Killed ",i.killedDate,i.killedReason?` — ${i.killedReason}`:""]})]}),c.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 FU(){const{ideas:t,killed:e,loading:r,error:n,selectedIdeaId:i,filters:s,hydrate:o,setPriority:a,killIdea:l,resurrectIdea:h,setSelectedIdea:u,updateFilters:d,addDiscussion:f,updateIdea:p}=ys(),[m,x]=k.useState(!1),[g,y]=k.useState(null),[C,b]=k.useState(null),[w,_]=k.useState(null),[S,N]=k.useState("cards"),A=k.useMemo(()=>{var tt;const O=t.filter(D=>D.status==="NEW").length,$=t.filter(D=>!D.priority||D.priority==="—").length,B=t.filter(D=>D.priority==="P0").length,T={};t.filter(D=>D.priority==="P0"&&D.cluster).forEach(D=>{T[D.cluster]=(T[D.cluster]||0)+1});const G=((tt=Object.entries(T).sort((D,V)=>V[1]-D[1])[0])==null?void 0:tt[0])??null;return{newCount:O,untriaged:$,p0Count:B,topCluster:G}},[t]),L=k.useMemo(()=>{const O=new Set;return t.forEach($=>($.tags||[]).forEach(B=>O.add(B))),[...O].sort()},[t]),j=k.useMemo(()=>t.filter(O=>{var $;if(s.tag&&!(($=O.tags)!=null&&$.includes(s.tag))||s.status&&(O.status||"").split(/\s+/)[0]!==s.status||s.priority&&O.priority!==s.priority)return!1;if(s.search){const B=s.search.toLowerCase();if(!`${O.title} ${O.description} ${O.id} ${(O.tags||[]).join(" ")}`.toLowerCase().includes(B))return!1}return!0}),[t,s]),F=k.useMemo(()=>{const O=new Map,$=[];j.forEach(G=>{G.cluster?(O.has(G.cluster)||O.set(G.cluster,[]),O.get(G.cluster).push(G)):$.push(G)});const B=G=>[...G].sort((tt,D)=>Rx(tt.priority)-Rx(D.priority)),T=[];for(const[G,tt]of O)T.push({cluster:G,ideas:B(tt)});return $.length>0&&T.push({cluster:null,ideas:B($)}),T},[j]),z=k.useMemo(()=>t.find(O=>O.id===i)||e.find(O=>O.id===i)||null,[t,e,i]),W=k.useCallback((O,$)=>{b($),O.dataTransfer.effectAllowed="move"},[]),P=k.useCallback(()=>{b(null),_(null)},[]),I=k.useCallback((O,$)=>{O.preventDefault(),O.dataTransfer.dropEffect="move",_($)},[]),M=k.useCallback(async(O,$)=>{O.preventDefault(),C&&await a(C,$),b(null),_(null)},[C,a]);return c.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[c.jsxs("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[c.jsx(fi,{className:"w-4 h-4 text-amber-400 shrink-0"}),c.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Ideabox"}),r&&c.jsx(hl,{className:"w-3 h-3 text-muted-foreground animate-spin"}),c.jsx("div",{className:"flex-1"}),c.jsxs("div",{className:"flex items-center gap-0.5 border border-border/50 rounded-md p-0.5",children:[c.jsx("button",{onClick:()=>N("cards"),className:st("text-[10px] px-2 py-0.5 rounded transition-colors",S==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Cards"}),c.jsx("button",{onClick:()=>N("matrix"),className:st("text-[10px] px-2 py-0.5 rounded transition-colors",S==="matrix"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Matrix"})]}),c.jsx("button",{onClick:()=>o(),className:"text-[10px] text-muted-foreground/60 hover:text-muted-foreground transition-colors",title:"Refresh",children:c.jsx(hl,{className:"w-3 h-3"})}),c.jsxs(Pt,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:A.untriaged===0,children:["Triage (",A.untriaged,")"]})]}),c.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[A.newCount>0&&c.jsxs("span",{className:"text-emerald-400",children:[A.newCount," new"]}),c.jsxs("span",{children:[A.untriaged," untriaged"]}),A.p0Count>0&&c.jsxs("span",{className:"text-red-400",children:[A.p0Count," P0"]}),A.topCluster&&c.jsxs("span",{children:["top cluster: ",c.jsx("span",{className:"text-foreground",children:A.topCluster})]}),c.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),c.jsx(EU,{ideas:t,killed:e})]}),c.jsxs("div",{className:"px-4 py-2 border-b border-border shrink-0 flex items-center gap-2 flex-wrap",children:[c.jsx(YS,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),c.jsxs("select",{value:s.tag,onChange:O=>d({tag:O.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[c.jsx("option",{value:"",children:"All tags"}),L.map(O=>c.jsx("option",{value:O,children:O},O))]}),c.jsxs("select",{value:s.status,onChange:O=>d({status:O.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[c.jsx("option",{value:"",children:"All statuses"}),c.jsx("option",{value:"NEW",children:"New"}),c.jsx("option",{value:"DISCUSSING",children:"Discussing"}),c.jsx("option",{value:"PROMOTED",children:"Promoted"})]}),c.jsxs("select",{value:s.priority,onChange:O=>d({priority:O.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[c.jsx("option",{value:"",children:"All priorities"}),c.jsx("option",{value:"P0",children:"P0"}),c.jsx("option",{value:"P1",children:"P1"}),c.jsx("option",{value:"P2",children:"P2"}),c.jsx("option",{value:"—",children:"Untriaged"})]}),c.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[120px]",children:[c.jsx(bn,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),c.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:O=>d({search:O.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)&&c.jsx("button",{onClick:()=>ys.getState().clearFilters(),className:"text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors",children:"Clear"})]}),c.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&c.jsx("div",{className:"mb-4 px-3 py-2 rounded border border-destructive/30 bg-destructive/10",children:c.jsx("p",{className:"text-[11px] text-destructive",children:n})}),S==="matrix"&&c.jsx(NU,{ideas:j,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:p}),S==="cards"&&j.length===0&&!r&&c.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-2",children:[c.jsx(fi,{className:"w-8 h-8 text-muted-foreground/30"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"No ideas yet."}),c.jsxs("p",{className:"text-[11px] text-muted-foreground/60",children:["Use the CLI: ",c.jsx("span",{className:"font-mono",children:'compose idea "Your idea title"'})]})]}),S==="cards"&&F.map(({cluster:O,ideas:$})=>c.jsxs("div",{className:"mb-6",children:[O&&c.jsxs("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold mb-3 flex items-center gap-2",children:[c.jsx("span",{children:O}),c.jsxs("span",{className:"text-muted-foreground/40 normal-case tracking-normal font-normal",children:["(",$.length,")"]})]}),c.jsx("div",{className:"grid grid-cols-4 gap-3",children:BU.map(B=>{const T=$.filter(tt=>tt.priority===B.key),G=w===B.key&&C;return c.jsxs("div",{className:st("rounded-lg border p-2 min-h-[80px] transition-colors",B.bg,B.border,G&&"ring-1 ring-accent"),onDragOver:tt=>I(tt,B.key),onDrop:tt=>M(tt,B.key),children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[c.jsx("span",{className:st("text-[10px] font-semibold uppercase tracking-wider",B.color),children:B.label}),c.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["(",T.length,")"]})]}),c.jsxs("div",{className:"space-y-1.5",children:[T.map(tt=>c.jsx(AU,{idea:tt,selected:i===tt.id,onClick:u,onDragStart:W,onDragEnd:P},tt.id)),T.length===0&&c.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},B.key)})})]},O||"__unclustered__")),S==="cards"&&c.jsx(IU,{killed:e,onResurrect:h})]})]}),z&&c.jsx(MU,{idea:z,onClose:()=>u(null),onPromote:O=>y(O),onKill:l,onSetPriority:a,onAddDiscussion:f}),m&&c.jsx(kU,{ideas:t.filter(O=>!O.priority||O.priority==="—"),onClose:()=>x(!1)}),g&&c.jsx(SU,{idea:g,onClose:()=>y(null)})]})}const DU=["A","B","C","D","E","F","G","H"];function PU({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)?DU[s]??t.id:t.id;return c.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)&&c.jsx("span",{className:"absolute top-2 right-2 text-accent",children:r?c.jsx(Qo,{style:{width:14,height:14}}):c.jsx(jT,{style:{width:14,height:14}})}),c.jsxs("span",{className:"block text-[12px] font-bold text-foreground",children:[o,". ",t.title]}),((a=t.bullets)==null?void 0:a.length)>0&&c.jsx("ul",{className:"mt-1.5 space-y-0.5 list-none pl-0",children:t.bullets.map((l,h)=>c.jsxs("li",{className:"text-[11px] text-muted-foreground leading-snug",children:[c.jsx("span",{className:"mr-1",children:"•"}),l]},h))})]})}function OU(){var z;const{session:t,messages:e,decisions:r,status:n,error:i,streamingMessage:s,designDocPath:o,hydrate:a,startSession:l,sendMessage:h,selectCard:u,completeDesign:d,connectSSE:f,disconnectSSE:p,reset:m}=Pn(),[x,g]=k.useState(""),[y,C]=k.useState(null),[b,w]=k.useState(""),_=k.useRef(null),S=Vx();k.useEffect(()=>(Pn.setState({scope:null,featureCode:null}),a(),()=>p()),[]),k.useEffect(()=>{var W;(W=_.current)==null||W.scrollIntoView({behavior:"smooth"})},[e,s]);const N=k.useCallback(()=>{x.trim()&&(h(x.trim()),g(""))},[x,h]),A=k.useCallback((W,P)=>{C({messageIndex:P,cardId:W})},[]),L=k.useCallback(()=>{y&&(u(y.cardId,b||null,y.messageIndex),C(null),w(""))},[y,b,u]),j=n==="streaming"||n==="summarizing",F=e.reduce((W,P,I)=>P.role==="assistant"&&P.content&&R2(P.content).parts.some(M=>M.type==="decision")?I:W,-1);return t?c.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[i&&c.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"&&c.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:[c.jsx(af,{style:{width:12,height:12},className:"text-green-400"}),c.jsx("span",{className:"text-green-400 font-medium",children:"Design complete."}),o&&c.jsxs("span",{className:"text-muted-foreground",children:["Document written to ",c.jsx("code",{className:"text-foreground",children:o})]}),c.jsx("div",{className:"flex-1"}),c.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"})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.map((W,P)=>c.jsx(zx,{messageIndex:P,message:W,onCardSelect:A,selectedCard:y,isStreaming:j,cardsDisabled:j||P!==F},P)),s&&c.jsx(zx,{message:s,onCardSelect:A,selectedCard:y,isStreaming:j}),!i&&(n==="active"||n==="streaming")&&!s&&e.length>0&&((z=e[e.length-1])==null?void 0:z.role)==="human"&&c.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:c.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[c.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))"}}),c.jsx("span",{children:"Agent thinking..."})]})}),n==="summarizing"&&c.jsx("div",{className:"flex justify-start",role:"status","aria-live":"polite",children:c.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2 bg-muted text-muted-foreground text-[12px]",children:[c.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))"}}),c.jsx("span",{children:"Generating design document..."})]})}),c.jsx("div",{ref:_})]}),n!=="complete"&&c.jsxs("div",{className:"border-t border-border p-3 shrink-0",children:[y?c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Selected: ",c.jsx("span",{className:"font-semibold text-foreground",children:y.cardId})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",value:b,onChange:W=>w(W.target.value),onKeyDown:W=>W.key==="Enter"&&L(),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"}),c.jsx("button",{onClick:L,disabled:j,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"}),c.jsx("button",{onClick:()=>{C(null),w("")},className:"px-3 py-1.5 text-[11px] rounded border border-border text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}):c.jsxs("div",{className:"flex gap-2",children:[c.jsx("input",{type:"text",value:x,onChange:W=>g(W.target.value),onKeyDown:W=>W.key==="Enter"&&!W.shiftKey&&N(),placeholder:j?"Waiting for response...":"Type a response...",disabled:j,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"}),c.jsx("button",{onClick:N,disabled:j||!x.trim(),className:"px-3 py-1.5 rounded bg-accent text-accent-foreground disabled:opacity-50 transition-opacity",children:c.jsx(_d,{style:{width:14,height:14}})})]}),n==="active"&&r.length>=2&&c.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:[c.jsx(af,{style:{width:12,height:12}}),"Complete Design"]})]})]}):c.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8",children:[c.jsx(sc,{className:"text-muted-foreground",style:{width:48,height:48}}),c.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:"Start a Design Conversation"}),c.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&&c.jsx("p",{className:"text-[11px] text-red-400 text-center max-w-md",children:i}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:()=>l("product"),className:"px-4 py-2 text-[11px] font-medium rounded bg-accent text-accent-foreground hover:opacity-90 transition-opacity",children:"Product Design"}),c.jsx("button",{onClick:async()=>{const W=await S({title:"Feature code",required:!0});W&&l("feature",W)},className:"px-4 py-2 text-[11px] font-medium rounded border border-border text-foreground hover:bg-muted transition-colors",children:"Feature Design"})]})]})}function zx({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,h;const o=t.role==="human",a=!o&&t.content?R2(t.content):null;return c.jsx("div",{className:st("flex",o?"justify-end":"justify-start"),children:c.jsx("div",{className:st("max-w-[85%] rounded-lg px-3 py-2 text-[12px]",o?"bg-accent/20 text-foreground":"bg-muted text-foreground"),children:o?c.jsx("div",{children:t.type==="card_select"?c.jsxs("span",{children:["Selected ",c.jsx("strong",{children:(l=t.content)==null?void 0:l.cardId}),(h=t.content)!=null&&h.comment?`: ${t.content.comment}`:""]}):c.jsx("span",{children:t.content})}):a?c.jsx("div",{className:"space-y-3",children:a.parts.map((u,d)=>{var f,p;return u.type==="text"?c.jsx("div",{className:"whitespace-pre-wrap",children:u.content},d):c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"flex flex-col gap-2 mt-2",children:(f=u.content.options)==null?void 0:f.map(m=>{var x;return c.jsx(PU,{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)&&c.jsx("div",{className:"text-[11px] text-muted-foreground italic mt-1",children:u.content.recommendation.rationale})]},d)})}):c.jsx("div",{className:"whitespace-pre-wrap",children:t.content})})})}const $U=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),RU=new Set(["WebSearch","web_search"]);function zU({expanded:t}){return c.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:c.jsx("path",{d:"M3 2L7 5L3 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function WU(){return c.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:[c.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--accent))",strokeWidth:"1.2"}),c.jsx("path",{d:"M3 5l1.5 1.5L7 3.5",stroke:"hsl(var(--accent))",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function qU(){return c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:c.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.2"})})}function Yh({title:t,count:e,defaultExpanded:r,children:n}){const[i,s]=k.useState(r);return c.jsxs("div",{className:"border-b",style:{borderColor:"hsl(var(--sidebar-border))"},children:[c.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:[c.jsx(zU,{expanded:i}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider flex-1",style:{color:"hsl(var(--muted-foreground))"},children:t}),e>0&&c.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&&c.jsx("div",{className:"pb-1",children:n})]})}function Ya(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function Wx(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function HU({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>$U.has(o.tool)),n=t.filter(o=>RU.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return c.jsx($n,{className:"flex-1",children:c.jsxs("div",{children:[c.jsx(Yh,{title:"Topic Outline",count:e.length,defaultExpanded:e.length>0,children:e.length===0?c.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No topics yet"}):c.jsx("ul",{className:"px-3 space-y-1 pt-0.5",children:e.map((o,a)=>c.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[c.jsx("span",{className:"mt-0.5",children:o.decided?c.jsx(WU,{}):c.jsx(qU,{})}),c.jsx("span",{className:"text-[11px] leading-snug",style:{color:o.decided?"hsl(var(--foreground))":"hsl(var(--muted-foreground))"},children:o.title})]},a))})}),c.jsx(Yh,{title:"Codebase Refs",count:r.length,defaultExpanded:r.length>0,children:r.length===0?c.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No file references yet"}):c.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:i.map((o,a)=>c.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.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}),c.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:Ya(Wx(o.tool,o.input),50)})]}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ya(o.summary,100)})]},a))})}),c.jsx(Yh,{title:"Web Searches",count:n.length,defaultExpanded:n.length>0,children:n.length===0?c.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No web searches yet"}):c.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:s.map((o,a)=>c.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[c.jsx("p",{className:"text-[10px] font-medium leading-snug",style:{color:"hsl(var(--foreground))"},children:Ya(Wx(o.tool,o.input),80)}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ya(o.summary,100)})]},a))})})]})})}function UU({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=k.useState("decisions"),o=t.filter(h=>!h.superseded).length,a=Pn(h=>h.researchItems)||[],l=Pn(h=>h.topicOutline)||[];return c.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:n??208},children:[c.jsx("div",{className:"p-3 pb-0",children:c.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--foreground))"},children:"Design"})}),c.jsxs("div",{className:"flex px-2 pt-2 gap-1",style:{borderBottom:"1px solid hsl(var(--sidebar-border))"},children:[c.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&&c.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})]}),c.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&&c.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"&&c.jsx($n,{className:"flex-1",children:t.length===0?c.jsx("div",{className:"px-3 py-6 text-center text-[11px]",style:{color:"hsl(var(--muted-foreground))"},children:"No decisions yet"}):c.jsx("div",{className:"px-2 pb-2 pt-1",children:t.map((h,u)=>{var d;return c.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:[c.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&&c.jsx("span",{className:"text-[10px] leading-snug mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:h.comment}),h.superseded&&c.jsx("span",{className:"text-[9px] mt-0.5 uppercase tracking-wider font-medium",style:{color:"hsl(var(--muted-foreground))"},children:"superseded"})]},u)})})}),i==="research"&&c.jsx(HU,{researchItems:a,topicOutline:l})]})}function YU(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function GU(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 VU(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 XU=320,KU=40,QU={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function V2(t){return t?`compose:${t}:openLoopsCollapsed`:null}function qx(t){const e=V2(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function ZU(t,e){const r=V2(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function JU({onConfirm:t,onCancel:e}){const[r,n]=k.useState("deferred"),[i,s]=k.useState(""),[o,a]=k.useState(""),l=h=>{h.preventDefault(),i.trim()&&t({kind:r,summary:i.trim(),ttl_days:o?parseInt(o,10):void 0})};return c.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:c.jsxs("form",{onSubmit:l,style:{background:"#1e1e2e",borderRadius:8,padding:24,width:360,display:"flex",flexDirection:"column",gap:12},children:[c.jsx("h3",{style:{margin:0,color:"#cdd6f4",fontSize:14},children:"Add Open Loop"}),c.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Kind",c.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:[c.jsx("option",{value:"deferred",children:"Deferred"}),c.jsx("option",{value:"blocked",children:"Blocked"}),c.jsx("option",{value:"open_question",children:"Open Question"})]})]}),c.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Summary (max 280 chars)",c.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"}})]}),c.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["TTL days (optional, default 90)",c.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"}})]}),c.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[c.jsx("button",{type:"button",onClick:e,style:{padding:"6px 16px",background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,cursor:"pointer"},children:"Cancel"}),c.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 tY({loop:t,onResolve:e,nowMs:r}){const n=VU(t,r),i=!!t.resolution;return c.jsxs("div",{"data-testid":`loop-row-${t.id}`,style:{padding:"8px 12px",borderBottom:"1px solid #313244",opacity:i?.5:1},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx("span",{style:{fontSize:10,color:"#6c7086",background:"#313244",borderRadius:3,padding:"1px 5px"},children:QU[t.kind]||t.kind}),n&&!i&&c.jsx("span",{"data-testid":`stale-badge-${t.id}`,style:{fontSize:10,color:"#f38ba8",background:"#3e1111",borderRadius:3,padding:"1px 5px"},children:">TTL"}),c.jsx("span",{style:{fontSize:10,color:"#6c7086",marginLeft:"auto"},children:GU(t.created_at,r)})]}),c.jsx("p",{style:{margin:"4px 0 6px",fontSize:12,color:n&&!i?"#f38ba8":"#cdd6f4",lineHeight:1.4},children:t.summary}),!i&&c.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&&c.jsx("span",{style:{fontSize:11,color:"#a6e3a1"},children:"Resolved"})]})}function eY({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var y,C;const i=Vx(),[s,o]=k.useState(()=>qx(t)),[a,l]=k.useState(!1),[h,u]=k.useState(()=>Date.now());k.useEffect(()=>{const b=setInterval(()=>u(Date.now()),6e4);return()=>clearInterval(b)},[]),k.useEffect(()=>{o(qx(t))},[t]);const d=k.useCallback(()=>{o(b=>{const w=!b;return ZU(t,w),w})},[t]),f=k.useMemo(()=>!t||!e?null:e.find(b=>{var w;return((w=b.lifecycle)==null?void 0:w.featureCode)===t})??null,[t,e]),p=((C=(y=f==null?void 0:f.lifecycle)==null?void 0:y.lifecycle_ext)==null?void 0:C.open_loops)??[],m=k.useMemo(()=>YU(p.filter(b=>b.resolution==null)),[p]),x=k.useCallback(async b=>{if(l(!1),r)try{await r(t,b)}catch(w){console.error("[OpenLoopsPanel] addLoop failed:",w.message),_e(`Could not add loop: ${w.message}`,"error")}},[t,r]),g=k.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),_e(`Could not resolve loop: ${_.message}`,"error")}}},[t,n,i]);return t?s?c.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:KU,background:"#181825",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:12,borderLeft:"1px solid #313244",flexShrink:0},children:[c.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&&c.jsx("span",{style:{fontSize:10,color:"#f5c2e7",marginTop:4},children:m.length})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{"data-testid":"open-loops-panel",style:{width:XU,background:"#181825",display:"flex",flexDirection:"column",borderLeft:"1px solid #313244",flexShrink:0,overflow:"hidden"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid #313244",gap:8},children:[c.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#cdd6f4",flex:1},children:["Open Loops ",m.length>0&&c.jsxs("span",{style:{color:"#a6adc8"},children:["(",m.length,")"]})]}),c.jsx("button",{"data-testid":"add-loop-btn",onClick:()=>l(!0),title:"Add open loop",style:{background:"none",border:"1px solid #45475a",color:"#a6e3a1",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12},children:"+"}),c.jsx("button",{"data-testid":"open-loops-collapse-btn",onClick:d,title:"Collapse",style:{background:"none",border:"none",cursor:"pointer",color:"#6c7086",fontSize:16},children:"›"})]}),c.jsx("div",{style:{flex:1,overflowY:"auto"},children:m.length===0?c.jsxs("div",{"data-testid":"open-loops-empty",style:{padding:"16px 12px",color:"#6c7086",fontSize:12,textAlign:"center"},children:["No open loops for this feature",c.jsx("br",{}),c.jsx("button",{onClick:()=>l(!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=>c.jsx(tY,{loop:b,onResolve:g,nowMs:h},b.id))})]}),a&&c.jsx(JU,{onConfirm:x,onCancel:()=>l(!1)})]}):null}const zi={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},rY=new Set(["blocks","informs"]);function Hx(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 nY(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function iY(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=zi.error;else if(o==="running"){const h=a&&a.endsWith("_gate"),u=Hx(e,s);h&&u&&n.some(f=>f.itemId===u.id&&!f.resolvedAt)?i[s]=zi.gate_pending:i[s]=zi.building}const l=Hx(e,s);if(l&&(i[s]===zi.building||i[s]===zi.gate_pending)){const h=new Set([l.id]),u=sY(h,r),d=new Map(e.map(f=>[f.id,nY(f)]));for(const f of u){const p=d.get(f);p&&!i[p]&&(i[p]=zi.blocked_downstream)}}return i}function sY(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)rY.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 l of a)n.has(l)||(n.add(l),s.add(l),i.push(l))}return s}function oY(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(l=>l.agentId));for(const l of t){const h=l.agentType||"claude",u=UT[h]||"#3b82f6";r.push({data:{id:`agent-${l.agentId}`,label:`${h}
686
- ${l.agentId.slice(0,6)}`,isAgentNode:!0,agentType:h,agentStatus:l.status||"running",agentColor:u,parent:"agent-topology"}});const f=l.parentSessionId&&i.has(l.parentSessionId)?`agent-${l.parentSessionId}`:"agent-session",p=`relay-${f}-agent-${l.agentId}`;n.has(p)||n.set(p,{data:{id:p,source:f,target:`agent-${l.agentId}`,isRelayEdge:!0}})}const s=Date.now()-3e4,o=new Set,a=l=>l==="session"?"agent-session":i.has(l)?`agent-${l}`:"agent-session";for(const l of e||[]){if(new Date(l.timestamp).getTime()<s)continue;const h=a(l.fromAgentId),u=a(l.toAgentId),d=l.direction==="dispatch"?`relay-${h}-${u}`:`relay-${u}-${h}`;o.add(d)}return{nodes:r,edges:[...n.values()],activeEdgeIds:o}}class yr extends qt.Component{constructor(){super(...arguments);Jt(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?c.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:[c.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"}),c.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)}),c.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 aY extends qt.Component{constructor(){super(...arguments);Jt(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.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:[c.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)]}),c.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"})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(f0,{})})]}):this.props.children}}const fd="compose:fontSize",lY="compose:theme",Mo=13,md=10,gd=20;function cY(){try{const t=parseInt(localStorage.getItem(fd),10);return t>=md&&t<=gd?t:Mo}catch{return Mo}}const Ux=new URLSearchParams(window.location.search).get("popout");function hY(){return Ux?c.jsx(QW,{path:Ux}):c.jsx(aY,{children:c.jsx(dY,{})})}function uY({activeView:t,items:e,filteredItems:r,phaseFilteredItems:n,phaseFilteredGates:i,connections:s,filteredConnections:o,sessions:a,activeBuild:l,pipelineDraft:h,buildHistory:u,gates:d,settings:f,selectedPhase:p,selectedItemId:m,buildStateMap:x,agentOverlay:g,spawnedAgents:y,agentRelays:C,docsSelectedFile:b,onDocsSelectedFileChange:w,docsPreviousView:_,onDocsBack:S,visibleTracks:N,hiddenGroups:A,onSelect:L,onUpdate:j,onCreate:F,onCreateFeature:z,isEmptyProject:W,onDelete:P,onOpenGate:I,onCreateConnection:M,onDeleteConnection:O,onRefreshBuild:$,onSelectStep:B,onResolveGate:T,onUpdateSettings:G,onResetSettings:tt,projectRoot:D,featureCode:V,focusActive:ht,onToggleFocus:ct,sessionState:Ft,agentActivity:_t,iterationStates:lt}){switch(t){case"dashboard":return c.jsx(xU,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:y,featureCode:V,sessionState:Ft,agentActivity:_t,iterationStates:lt,onSelect:L,onResolveGate:T,onOpenGate:I,onCreateFeature:z,isEmptyProject:W});case"tree":return c.jsx(Ry,{items:r,connections:o,selectedItemId:m,onSelect:L,onCreate:F,onCreateFeature:z,isEmptyProject:W,featureCode:V,focusActive:ht,onToggleFocus:ct});case"graph":return c.jsx(Wy,{items:e,connections:s,selectedItemId:m,onSelect:L,onCreateFeature:z,isEmptyProject:W,visibleTracks:N,hiddenGroups:A,buildStateMap:x,resolveGate:T,gates:d,spawnedAgents:y,agentRelays:C,agentOverlay:g,featureCode:V,focusActive:ht,onToggleFocus:ct});case"pipeline":return c.jsx(v2,{activeBuild:l,pipelineDraft:h,onSelectStep:B,onRefresh:$});case"sessions":return c.jsx(E2,{sessions:a,items:e,onSelectItem:L,featureCode:V,focusActive:ht,onToggleFocus:ct});case"build-history":return c.jsx($H,{builds:u,items:e,onSelectItem:L});case"gates":return c.jsx(y2,{gates:i,items:n,onResolve:T,onSelect:L,featureCode:V,focusActive:ht,onToggleFocus:ct});case"docs":return c.jsx(g2,{items:n,selectedFile:b,onSelectedFileChange:w,previousView:_,onBack:S,featureCode:V,focusActive:ht,onToggleFocus:ct});case"design":return c.jsx(OU,{},D);case"ideabox":return c.jsx(FU,{});case"settings":return c.jsx(k2,{settings:f,onSettingsChange:G,onReset:tt});case"stratum":return c.jsx(sq,{});default:return c.jsxs("div",{className:"flex-1 flex items-center justify-center text-[12px] text-muted-foreground italic",children:["View “",t,"” not found."]})}}function dY(){const{refresh:t}=pS(),e=Pn(q=>q.decisions),r=Pn(q=>q.status),[n,i]=k.useState(cY),[s,o]=k.useState(()=>document.documentElement.classList.contains("dark")),[a]=k.useState(AH),[l,h]=k.useState(()=>MH(a)),[u,d]=k.useState(xq),[f,p]=k.useState(IH),[m,x]=k.useState(DH),[g,y]=k.useState(null),[C,b]=k.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[w,_]=k.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:S,connections:N,connected:A,uiCommand:L,clearUICommand:j,recentChanges:F,createItem:z,updateItem:W,deleteItem:P,createConnection:I,deleteConnection:M,agentActivity:O,agentErrors:$,spawnedAgents:B,agentRelays:T,sessionState:G,registerSnapshotProvider:tt,gates:D,gateEvent:V,resolveGate:ht,settings:ct,updateSettings:Ft,resetSettings:_t,activeBuild:lt,setActiveBuild:Y,pipelineDraft:ot,sessions:kt,iterationStates:Tt,buildHistory:ee,fetchBuildHistory:le,selectedPhase:Zt,setSelectedPhase:$e,statusSnapshots:Xt,setStatusSnapshot:Re}=fr(_i(q=>({items:q.items,connections:q.connections,connected:q.connected,uiCommand:q.uiCommand,clearUICommand:q.clearUICommand,recentChanges:q.recentChanges,createItem:q.createItem,updateItem:q.updateItem,deleteItem:q.deleteItem,createConnection:q.createConnection,deleteConnection:q.deleteConnection,agentActivity:q.agentActivity,agentErrors:q.agentErrors,spawnedAgents:q.spawnedAgents,agentRelays:q.agentRelays,sessionState:q.sessionState,registerSnapshotProvider:q.registerSnapshotProvider,gates:q.gates,gateEvent:q.gateEvent,resolveGate:q.resolveGate,settings:q.settings,updateSettings:q.updateSettings,resetSettings:q.resetSettings,activeBuild:q.activeBuild,setActiveBuild:q.setActiveBuild,pipelineDraft:q.pipelineDraft,sessions:q.sessions,iterationStates:q.iterationStates,buildHistory:q.buildHistory,fetchBuildHistory:q.fetchBuildHistory,selectedPhase:q.selectedPhase,setSelectedPhase:q.setSelectedPhase,statusSnapshots:q.statusSnapshots,setStatusSnapshot:q.setStatusSnapshot}))),re=(G==null?void 0:G.featureCode)||null;k.useEffect(()=>{re&&(Xt&&Xt[re]||Mt(`/api/lifecycle/status?featureCode=${encodeURIComponent(re)}`).then(q=>q.json()).then(q=>{q!=null&&q.snapshot&&Re&&Re(re,q.snapshot)}).catch(()=>{}))},[re,Xt,Re]);const[Ae,X]=k.useState(null),nt=k.useRef(!!localStorage.getItem("compose:activeView")),[Z,dt]=k.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[H,rt]=k.useState(""),ft=k.useCallback(q=>{b(q),localStorage.setItem("compose:contextWidthPx",String(Math.round(q)))},[]),wt=k.useRef(!1),Ot=k.useCallback(q=>{q.preventDefault(),wt.current=!0;const yt=ue=>{if(!wt.current)return;const lr=ue.clientX-16,Us=Math.max(160,Math.min(window.innerWidth*.4,lr));_(Us),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(Us)))},vt=()=>{wt.current=!1,document.removeEventListener("mousemove",yt),document.removeEventListener("mouseup",vt)};document.addEventListener("mousemove",yt),document.addEventListener("mouseup",vt)},[]),[pe,ce]=k.useState(null),[Ne,wr]=k.useState(null),[ye,ve]=k.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[Me,Ie]=k.useState(()=>{try{const q=localStorage.getItem("compose:visibleTracks");if(q){const yt=JSON.parse(q);return new Set(yt)}}catch{}return null}),[Gn,Sr]=k.useState(new Set),[Sn,Ps]=k.useState(!1),Os=k.useCallback(q=>{Sr(yt=>{const vt=new Set(yt);return vt.has(q)?vt.delete(q):vt.add(q),vt})},[]),[da,$s]=k.useState(null),[Rs,Vn]=k.useState(!1),[Xn,ji]=k.useState(!1),[Fc,he]=k.useState("task"),[Tn,pa]=k.useState(!1),[fa,Ni]=k.useState(""),[zs,Ws]=k.useState("");k.useEffect(()=>{Mt("/api/project").then(q=>q.json()).then(q=>{Ni(q.name||""),Ws(q.targetRoot||"")}).catch(()=>{})},[]);const Dc=k.useCallback(async q=>{try{const vt=await(await Mt("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:q})})).json();return vt.ok?(await t(),Ni(vt.name),Ws(vt.targetRoot),!0):!1}catch{return!1}},[t]),sr=u===He.MAXIMIZED,on=k.useCallback(q=>{h(q),Bx(q),dt(q)},[]),Xe=k.useCallback(q=>{dt(q),h(q),Bx(q)},[]);k.useEffect(()=>{localStorage.setItem("compose:activeView",Z),Z!=="docs"&&(wr(null),ce(null))},[Z]),k.useEffect(()=>{ye?localStorage.setItem("compose:selectedTrack",ye):localStorage.removeItem("compose:selectedTrack")},[ye]),k.useEffect(()=>{Ae?sessionStorage.setItem("vision-selectedItemId",Ae):sessionStorage.removeItem("vision-selectedItemId")},[Ae]),k.useEffect(()=>{try{Me?localStorage.setItem("compose:visibleTracks",JSON.stringify([...Me])):localStorage.removeItem("compose:visibleTracks")}catch{}},[Me]);const qs=k.useRef(!1);k.useEffect(()=>{var q;qs.current||nt.current||(q=ct==null?void 0:ct.ui)!=null&&q.defaultView&&(Xe(ct.ui.defaultView),qs.current=!0)},[ct]),k.useEffect(()=>{L&&(L.view&&Xe(L.view),L.phase!==void 0&&$e(L.phase),L.select!==void 0&&Lr(L.select),j())},[L,j]),k.useEffect(()=>{const q=()=>{var vt;return["INPUT","TEXTAREA","SELECT"].includes((vt=document.activeElement)==null?void 0:vt.tagName)},yt=vt=>{(vt.metaKey||vt.ctrlKey)&&vt.key==="k"&&(vt.preventDefault(),Vn(ue=>!ue)),(vt.metaKey||vt.ctrlKey)&&vt.key==="n"&&(vt.preventDefault(),ji(!0)),vt.key===","&&!vt.metaKey&&!vt.ctrlKey&&!q()&&pa(!0)};return window.addEventListener("keydown",yt),()=>window.removeEventListener("keydown",yt)},[]);const an=k.useMemo(()=>{let q=S;if(Zt&&(q=q.filter(yt=>yt.phase===Zt)),ye&&(q=q.filter(yt=>{const vt=(yt.description||"").match(/Track:\s*(\w+)/i);return vt&&vt[1].toLowerCase()===ye})),H){const yt=H.toLowerCase();q=q.filter(vt=>vt.title.toLowerCase().includes(yt)||(vt.description||"").toLowerCase().includes(yt))}return q},[S,Zt,ye,H]),_n=k.useMemo(()=>Zt?S.filter(q=>q.phase===Zt):S,[S,Zt]),ln=k.useMemo(()=>new Set(_n.map(q=>q.id)),[_n]),Ei=k.useMemo(()=>Zt?D.filter(q=>ln.has(q.itemId)):D,[D,ln,Zt]),Br=k.useMemo(()=>{if(!Zt&&!ye&&!H)return N;const q=new Set(an.map(yt=>yt.id));return N.filter(yt=>q.has(yt.fromId)&&q.has(yt.toId))},[N,an,Zt,ye,H]),ma=k.useMemo(()=>iY(lt,S,N,D),[lt,S,N,D]),ga=k.useMemo(()=>oY(B,T),[B,T]),Ke=k.useCallback(q=>{y(q)},[]),Lr=k.useCallback(q=>{X(yt=>yt===q?(Ke(null),null):(Ke({type:"item",id:q}),q))},[Ke]),xa=k.useCallback(async q=>{try{const yt=await Mt(`/api/agent/${q}/stop`,{method:"POST",headers:Ki({"Content-Type":"application/json"})});yt.ok||_e(`Could not stop agent (${yt.status})`,"error")}catch(yt){console.error(`[App] Failed to stop agent ${q}:`,yt.message),_e(`Could not stop agent: ${yt.message}`,"error")}},[]),Kn=k.useRef(lt);k.useEffect(()=>{!Kn.current&&lt&&lt.featureItemId&&Lr(lt.featureItemId),Kn.current=lt},[lt]);const Hr=k.useCallback(q=>{if(!q)return;const yt=S.find(vt=>{var ue,lr;return((ue=vt.lifecycle)==null?void 0:ue.featureCode)===q||vt.featureCode===q||vt.feature_code===q||((lr=vt.title)==null?void 0:lr.includes(q))});yt&&Lr(yt.id)},[S,Lr]);k.useEffect(()=>{const q=yt=>{const{featureCode:vt}=yt.detail||{};vt&&Hr(vt)};return window.addEventListener("compose:select-feature",q),()=>window.removeEventListener("compose:select-feature",q)},[Hr]);const mt=k.useCallback(q=>S.find(yt=>{var vt;return((vt=yt.lifecycle)==null?void 0:vt.featureCode)===q})||null,[S]),R=k.useCallback(async(q,yt)=>{const vt=mt(q);if(!vt)throw new Error(`No item found for feature ${q}`);const ue=await Mt(`/api/vision/items/${vt.id}/loops`,{method:"POST",headers:Ki({"Content-Type":"application/json"}),body:JSON.stringify(yt)});if(!ue.ok)throw new Error(`Add loop failed: ${ue.status}`)},[mt]),et=k.useCallback(async(q,yt,{note:vt})=>{const ue=mt(q);if(!ue)throw new Error(`No item found for feature ${q}`);const lr=await Mt(`/api/vision/items/${ue.id}/loops/${yt}/resolve`,{method:"POST",headers:Ki({"Content-Type":"application/json"}),body:JSON.stringify({note:vt})});if(!lr.ok)throw new Error(`Resolve loop failed: ${lr.status}`)},[mt]);k.useEffect(()=>{tt(()=>({activeView:Z,selectedPhase:Zt,searchQuery:H,selectedItemId:Ae,totalItems:S.length,filteredCount:an.length,connected:A}))},[tt,Z,Zt,H,Ae,S.length,an.length,A]),k.useEffect(()=>{const q=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return q.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>q.disconnect()},[]),k.useEffect(()=>{g&&!m&&(x(!0),Lx(!0))},[g]),k.useEffect(()=>{Z==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[Z]),k.useEffect(()=>{Z==="build-history"&&le()},[Z,le]);const ut=k.useCallback(()=>{const q=s?"light":"dark";document.documentElement.classList.toggle("dark",q==="dark"),localStorage.setItem(lY,q),Mt("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:q}})}).catch(()=>{})},[s]),Gt=k.useCallback(q=>{i(yt=>{const vt=Math.min(Math.max(yt+q,md),gd);return localStorage.setItem(fd,vt),vt})},[]),Rt=k.useCallback(()=>{i(Mo),localStorage.setItem(fd,Mo)},[]),ne=k.useCallback(q=>{d(q),yq(q)},[]),be=k.useCallback(()=>{p(q=>(FH(!q),!q))},[]),or=k.useCallback(()=>{x(q=>(Lx(!q),!q))},[]),ar=k.useCallback((q,yt)=>{W(q,yt)},[W]),Hs=k.useCallback(async()=>{const yt=await z({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Zt||"vision"});yt&&yt.id&&Lr(yt.id)},[z,Zt]),we=k.useCallback(()=>{he("feature"),ji(!0)},[]),ya=S.length===0,ba=k.useCallback(async q=>{await P(q),Ae===q&&(X(null),Ke(null))},[P,Ae,Ke]),Pc=k.useCallback(q=>{const yt=D.find(vt=>vt.id===q);yt&&(X(yt.itemId),Ke({type:"item",id:yt.itemId}))},[D,Ke]),X2=k.useCallback(async q=>I(q),[I]),K2=k.useCallback(async q=>M(q),[M]),Q2=k.useCallback(()=>{Mt("/api/build/state").then(q=>q.json()).then(q=>Y(q.state??null)).catch(()=>{})},[Y]),Z2=k.useCallback(q=>{Ke({type:"step",id:q})},[Ke]),Ca=k.useCallback(q=>{const yt=S.find(lr=>lr.id===q);if(!yt)return;const vt=(yt.description||"").match(/Track:\s*(\w+)/i),ue=vt?vt[1].toLowerCase():null;ye&&ue&&ye!==ue&&ve(null),ue&&Me&&!Me.has(ue)&&Ie(lr=>{const Us=new Set(lr);return Us.add(ue),Us})},[S,ye,Me]),J2=k.useCallback(q=>{Ca(q),X(q),Ke({type:"item",id:q}),Xe("graph")},[Xe,Ke,Ca]),tS=k.useCallback(q=>{Ca(q),X(q),Ke({type:"item",id:q}),Xe("tree")},[Xe,Ke,Ca]),eS=k.useCallback(q=>{wr(Z),ce(q),Xe("docs")},[Z,Xe]),rS=k.useCallback(()=>{Ne&&(Xe(Ne),wr(null),ce(null))},[Ne,Xe]);return c.jsx(dc.Provider,{value:F,children:c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[c.jsx(yr,{zone:"header",children:c.jsxs("header",{className:"h-9 flex items-center px-3 gap-3 shrink-0 justify-between",style:{borderBottom:"1px solid hsl(var(--border))"},children:[c.jsx(oq,{projectName:fa,projectRoot:zs,onSwitch:Dc}),c.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:c.jsx(lq,{tabs:a,activeTab:l,onTabChange:on,onOpenPalette:()=>Vn(q=>!q),badges:{gates:D.filter(q=>!q.resolvedAt).length}})}),c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!A&&c.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),c.jsx("button",{className:"compose-btn-icon",onClick:ut,title:s?"Switch to light mode":"Switch to dark mode",children:s?"☀":"☾"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{className:"compose-btn-icon",onClick:()=>Gt(-1),disabled:n<=md,title:"Decrease font size",children:"A−"}),c.jsx("span",{className:"text-[10px] tabular-nums min-w-[20px] text-center text-muted-foreground",children:n}),c.jsx("button",{className:"compose-btn-icon",onClick:()=>Gt(1),disabled:n>=gd,title:"Increase font size",children:"A+"})]}),c.jsx("button",{className:"compose-btn-icon",onClick:Rt,disabled:n===Mo,title:"Reset to default size",children:"100%"})]})]})}),c.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!sr&&c.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[c.jsx(yr,{zone:"sidebar",children:c.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[c.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:be,title:f?"Collapse sidebar":"Expand sidebar","aria-expanded":f,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:f?"‹":"›"}),f&&c.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0 order-last",onMouseDown:Ot}),f&&(Z==="design"?c.jsx(UU,{decisions:e,sessionComplete:r==="complete",onReviseDecision:q=>Pn.getState().reviseDecision(q),widthPx:w}):c.jsx(Oy,{items:S,gates:D,activeBuild:lt,onViewChange:Xe,selectedPhase:Zt,onPhaseSelect:$e,selectedTrack:ye,onTrackSelect:ve,visibleTracks:Me,onToggleVisibleTrack:(q,yt)=>Ie(vt=>{if(!vt){const lr=new Set(yt);return lr.delete(q),lr}const ue=new Set(vt);return ue.has(q)?ue.delete(q):ue.add(q),yt&&ue.size>=yt.length?null:ue}),onShowAllTracks:()=>Ie(null),hiddenGroups:Gn,onToggleGroup:Os,searchQuery:H,onSearchChange:rt,connected:A,agentActivity:O,agentErrors:$,spawnedAgents:B,agentRelays:T,sessionState:G,onSelectItem:Lr,onStopAgent:xa,onThemeChange:Ft,onNewItem:()=>ji(!0),widthPx:w}))]})}),c.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[c.jsx(F2,{featureCode:re,snapshot:re?(Xt==null?void 0:Xt[re])??null:null}),re&&c.jsx(I2,{currentFeatureCode:re}),c.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:c.jsx(yr,{children:c.jsx(uY,{activeView:Z,items:S,filteredItems:an,phaseFilteredItems:_n,phaseFilteredGates:Ei,connections:N,filteredConnections:Br,sessions:kt,buildHistory:ee,activeBuild:lt,pipelineDraft:ot,gates:D,settings:ct,selectedPhase:Zt,selectedItemId:Ae,onSelect:Lr,onUpdate:ar,onCreate:Hs,onCreateFeature:we,isEmptyProject:ya,onDelete:ba,onOpenGate:Pc,onCreateConnection:X2,onDeleteConnection:K2,onRefreshBuild:Q2,onSelectStep:Z2,onResolveGate:ht,onUpdateSettings:Ft,onResetSettings:_t,visibleTracks:Me,hiddenGroups:Gn,buildStateMap:ma,agentOverlay:ga,spawnedAgents:B,agentRelays:T,docsSelectedFile:pe,onDocsSelectedFileChange:ce,docsPreviousView:Ne,onDocsBack:rS,projectRoot:zs,featureCode:re,focusActive:Sn,onToggleFocus:()=>Ps(q=>!q),sessionState:G,agentActivity:O,iterationStates:Tt})})})]}),Z!=="docs"&&c.jsx(yr,{children:c.jsxs(Sq,{isOpen:m,onToggle:or,widthPx:C,onResizePx:ft,activeBuild:lt,gates:D,agentErrors:$,items:S,children:[(g==null?void 0:g.type)==="item"&&c.jsx(uH,{itemId:g.id,onSelect:q=>{y({type:"item",id:q}),X(q)},onClose:()=>{y(null),X(null)},onOpenFile:eS,onViewInGraph:J2,onViewInTree:tS}),(g==null?void 0:g.type)==="step"&&c.jsx(CH,{stepId:g.id,tierEvents:lt==null?void 0:lt.tierEvents,healthEvents:(lt==null?void 0:lt.health_score)!=null?[{score:lt.health_score,breakdown:lt.health_breakdown,missing:lt.health_missing}]:void 0,capabilityEvents:lt==null?void 0:lt.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&c.jsx(vH,{})]})}),re&&Z!=="docs"&&c.jsx(yr,{zone:"open loops panel",children:c.jsx(eY,{featureCode:re,items:S,onAddLoop:R,onResolveLoop:et})})]}),c.jsx(yr,{zone:"ops strip",children:c.jsx(NH,{activeView:Z,onSelectFeature:Hr})}),c.jsx(yr,{zone:"agent bar",children:c.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",sr?"flex-1 min-h-0":gq(u)].join(" "),children:c.jsx(kq,{barState:u,onStateChange:ne})})})]}),c.jsx(yr,{zone:"notifications",children:c.jsx(XA,{})}),c.jsx(yr,{zone:"gate notifications",children:c.jsx(M2,{onOpenGate:Pc})}),c.jsx(yr,{zone:"challenge modal",children:da&&(()=>{const q=S.find(yt=>yt.id===da);return q?c.jsx(C2,{item:q,items:S,connections:N,onUpdate:ar,onClose:()=>$s(null)}):null})()}),c.jsx(b2,{event:V,items:S,onNavigate:()=>Xe("gates")}),c.jsx(yr,{zone:"command palette",children:c.jsx(B2,{open:Rs,onClose:()=>Vn(!1),onSelectItem:q=>{Lr(q),Vn(!1)},onSelectGate:q=>{Pc(q),Vn(!1)}})}),c.jsx(yr,{zone:"item form",children:c.jsx(L2,{open:Xn,initialType:Fc,onClose:()=>{ji(!1),he("task")}})}),c.jsx(yr,{zone:"settings",children:c.jsx(A2,{open:Tn,onClose:()=>pa(!1),settings:ct,onSettingsChange:Ft})})]})})}const YY=Object.freeze(Object.defineProperty({__proto__:null,default:hY},Symbol.toStringTag,{value:"Module"}));export{pb as $,kY as A,Fn as B,t3 as C,me as D,RM as E,Op as F,eb as G,mO as H,bD as I,TP as J,U3 as K,Po as L,yY as M,Sc as N,CM as O,ub as P,Pm as Q,hD as R,Tu as S,fO as T,ra as U,Wr as V,K as W,Q as X,NM as Y,oO as Z,v as _,IM as a,$Y as a$,oD as a0,gp as a1,TY as a2,NY as a3,Fi as a4,ng as a5,rg as a6,BY as a7,EY as a8,jY as a9,DP as aA,AP as aB,$P as aC,YC as aD,FP as aE,GP as aF,YP as aG,UP as aH,XP as aI,VP as aJ,IP as aK,GC as aL,RP as aM,OP as aN,PP as aO,VC as aP,jP as aQ,ir as aR,to as aS,$p as aT,ek as aU,Ci as aV,sk as aW,Yy as aX,s6 as aY,zY as aZ,qY as a_,wY as aa,SY as ab,_Y as ac,AY as ad,LY as ae,nR as af,aw as ag,WY as ah,It as ai,Zr as aj,vn as ak,ca as al,B$ as am,E$ as an,Dp as ao,gt as ap,A$ as aq,Lp as ar,Ep as as,nl as at,HP as au,qP as av,WP as aw,zP as ax,MP as ay,UC as az,MM as b,Ct as b0,RY as b1,IR as b2,ER as b3,NR as b4,aD as b5,xY as b6,dp as b7,An as b8,Ro as b9,Km as ba,RF as bb,bt as bc,ok as bd,pr as be,MF as bf,up as bg,jb as bh,sa as bi,Bb as bj,vY as bk,JA as bl,YY as bm,Kt as c,Wt as d,db as e,Be as f,DM as g,xn as h,zr as i,BP as j,na as k,it as l,nk as m,bY as n,UY as o,PM as p,OM as q,HY as r,FM as s,_P as t,Pr as u,wR as v,yO as w,MY as x,bs as y,AM as z};