@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.
- package/dist/assets/App-DQblyoua.js +696 -0
- package/dist/assets/{arc-fd_r6IIl.js → arc-B4fPSjcd.js} +1 -1
- package/dist/assets/{architectureDiagram-3BPJPVTR-UehcfvE8.js → architectureDiagram-3BPJPVTR-SiqLJ2Dv.js} +1 -1
- package/dist/assets/{blockDiagram-GPEHLZMM-Dm-THFZ6.js → blockDiagram-GPEHLZMM-DgA84B2f.js} +1 -1
- package/dist/assets/{c4Diagram-AAUBKEIU-CIZ7QDGR.js → c4Diagram-AAUBKEIU-B-tXpPJU.js} +1 -1
- package/dist/assets/channel-D60Ea_Qi.js +1 -0
- package/dist/assets/{chunk-2J33WTMH-COBZ5eyU.js → chunk-2J33WTMH-Ch2s7Kg8.js} +1 -1
- package/dist/assets/{chunk-4BX2VUAB-w3bqdoNF.js → chunk-4BX2VUAB-B0CaezI4.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-D18v8dR4.js → chunk-55IACEB6-B7bap9LR.js} +1 -1
- package/dist/assets/{chunk-727SXJPM-2MAwFz_9.js → chunk-727SXJPM-CMksbsjL.js} +1 -1
- package/dist/assets/{chunk-AQP2D5EJ-Dp_jdVPB.js → chunk-AQP2D5EJ-ChOCnmMe.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-mPSIpSeS.js → chunk-FMBD7UC4-qcUlmmEN.js} +1 -1
- package/dist/assets/{chunk-ND2GUHAM-gkRIeuOg.js → chunk-ND2GUHAM-BWwR4JBR.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-DJ7h7c2i.js → chunk-QZHKN3VN-DuRbBL0q.js} +1 -1
- package/dist/assets/classDiagram-4FO5ZUOK-Vt88epYI.js +1 -0
- package/dist/assets/classDiagram-v2-Q7XG4LA2-Vt88epYI.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-BC5rkVLI.js → cose-bilkent-S5V4N54A-Dd3Ids4E.js} +1 -1
- package/dist/assets/{dagre-BM42HDAG-DBwRZbPz.js → dagre-BM42HDAG-C2fmFG1L.js} +1 -1
- package/dist/assets/{diagram-2AECGRRQ-CmljsTYt.js → diagram-2AECGRRQ-gZjYzjSJ.js} +1 -1
- package/dist/assets/{diagram-5GNKFQAL-Pcdh-Hev.js → diagram-5GNKFQAL-uxJ9zL35.js} +1 -1
- package/dist/assets/{diagram-KO2AKTUF-CrEqfa_s.js → diagram-KO2AKTUF--9DBGjk3.js} +1 -1
- package/dist/assets/{diagram-LMA3HP47-pmYhkUAj.js → diagram-LMA3HP47-DkhUcRJZ.js} +1 -1
- package/dist/assets/{diagram-OG6HWLK6-1mWNdTnP.js → diagram-OG6HWLK6-BaJ__gNW.js} +1 -1
- package/dist/assets/{erDiagram-TEJ5UH35-BuNJLn2I.js → erDiagram-TEJ5UH35-DWszA5vM.js} +1 -1
- package/dist/assets/{flowDiagram-I6XJVG4X-D84i8zUb.js → flowDiagram-I6XJVG4X-DKGbnIHA.js} +1 -1
- package/dist/assets/{ganttDiagram-6RSMTGT7-DW_1tH7v.js → ganttDiagram-6RSMTGT7-D5CoNr7u.js} +1 -1
- package/dist/assets/{gitGraphDiagram-PVQCEYII-Mo99IrfD.js → gitGraphDiagram-PVQCEYII-wraCb0iO.js} +1 -1
- package/dist/assets/{graph-BqpC5g-G.js → graph-BlEwG9Ro.js} +1 -1
- package/dist/assets/{index-DfocQEE0.js → index-CE1ehTQn.js} +3 -3
- package/dist/assets/index-D9M5IzwO.css +1 -0
- package/dist/assets/{infoDiagram-5YYISTIA-BJvJda4j.js → infoDiagram-5YYISTIA-CLT2YJ_w.js} +1 -1
- package/dist/assets/{ishikawaDiagram-YF4QCWOH-Dl7ib9vb.js → ishikawaDiagram-YF4QCWOH-1WQ5ViOx.js} +1 -1
- package/dist/assets/{journeyDiagram-JHISSGLW-DmgxLRyA.js → journeyDiagram-JHISSGLW-CbYKANnV.js} +1 -1
- package/dist/assets/{kanban-definition-UN3LZRKU-DV6cN2Fc.js → kanban-definition-UN3LZRKU-CYNaaEmw.js} +1 -1
- package/dist/assets/{linear-ChPnBFTg.js → linear-C6l6Hee2.js} +1 -1
- package/dist/assets/{mindmap-definition-RKZ34NQL-C0dgdrrD.js → mindmap-definition-RKZ34NQL-DzXKDTRa.js} +1 -1
- package/dist/assets/mobile-4lQex-UI.js +17 -0
- package/dist/assets/mobile-D8UQvJ1i.css +1 -0
- package/dist/assets/{pieDiagram-4H26LBE5-N-HzAPPi.js → pieDiagram-4H26LBE5-CppszhAX.js} +1 -1
- package/dist/assets/{quadrantDiagram-W4KKPZXB-YEX6PyFG.js → quadrantDiagram-W4KKPZXB-jpp555QD.js} +1 -1
- package/dist/assets/{requirementDiagram-4Y6WPE33-CCpgQqwO.js → requirementDiagram-4Y6WPE33-nKJCyHfW.js} +1 -1
- package/dist/assets/{sankeyDiagram-5OEKKPKP-BSUvtggj.js → sankeyDiagram-5OEKKPKP-D-oX8o5g.js} +1 -1
- package/dist/assets/{sequenceDiagram-3UESZ5HK-Dh8UHRBI.js → sequenceDiagram-3UESZ5HK-CcOMecR8.js} +1 -1
- package/dist/assets/{stateDiagram-AJRCARHV-DKvZ4fLX.js → stateDiagram-AJRCARHV-D0yHv9PM.js} +1 -1
- package/dist/assets/stateDiagram-v2-BHNVJYJU-CFwFamMD.js +1 -0
- package/dist/assets/{timeline-definition-PNZ67QCA-qunNDnlH.js → timeline-definition-PNZ67QCA-hsR-T0Te.js} +1 -1
- package/dist/assets/{vennDiagram-CIIHVFJN-D5a-gmIU.js → vennDiagram-CIIHVFJN-C9b10oqu.js} +1 -1
- package/dist/assets/{wardley-L42UT6IY-akIUfw-F.js → wardley-L42UT6IY-BHnzDf0e.js} +1 -1
- package/dist/assets/{wardleyDiagram-YWT4CUSO-R1zmVC27.js → wardleyDiagram-YWT4CUSO-DReamCcN.js} +1 -1
- package/dist/assets/{xychartDiagram-2RQKCTM6-Do2YVGeZ.js → xychartDiagram-2RQKCTM6-CrSsH0ZL.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/server/graph-export.js +8 -3
- package/server/journal-routes.js +130 -0
- package/server/vision-routes.js +2 -66
- package/server/vision-server.js +9 -2
- package/dist/assets/App-BD4lfyhF.js +0 -686
- package/dist/assets/channel-C0cFeemU.js +0 -1
- package/dist/assets/classDiagram-4FO5ZUOK-7kNnlTD1.js +0 -1
- package/dist/assets/classDiagram-v2-Q7XG4LA2-7kNnlTD1.js +0 -1
- package/dist/assets/index-vDKys15R.css +0 -1
- package/dist/assets/mobile-5PV1E6OC.css +0 -1
- package/dist/assets/mobile-DAxPPzok.js +0 -17
- package/dist/assets/stateDiagram-v2-BHNVJYJU-DF_adEfb.js +0 -1
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-BM42HDAG-C2fmFG1L.js","assets/graph-CAnANduQ.js","assets/layout-DGIYPm2g.js","assets/mobile-4lQex-UI.js","assets/mobile-D8UQvJ1i.css","assets/index-CE1ehTQn.js","assets/index-D9M5IzwO.css","assets/graph-BlEwG9Ro.js","assets/cose-bilkent-S5V4N54A-Dd3Ids4E.js","assets/c4Diagram-AAUBKEIU-B-tXpPJU.js","assets/chunk-ND2GUHAM-BWwR4JBR.js","assets/flowDiagram-I6XJVG4X-DKGbnIHA.js","assets/chunk-FMBD7UC4-qcUlmmEN.js","assets/chunk-55IACEB6-B7bap9LR.js","assets/chunk-2J33WTMH-Ch2s7Kg8.js","assets/channel-D60Ea_Qi.js","assets/erDiagram-TEJ5UH35-DWszA5vM.js","assets/gitGraphDiagram-PVQCEYII-wraCb0iO.js","assets/chunk-4BX2VUAB-B0CaezI4.js","assets/chunk-QZHKN3VN-DuRbBL0q.js","assets/wardley-L42UT6IY-BHnzDf0e.js","assets/ganttDiagram-6RSMTGT7-D5CoNr7u.js","assets/linear-C6l6Hee2.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-5YYISTIA-CLT2YJ_w.js","assets/pieDiagram-4H26LBE5-CppszhAX.js","assets/arc-B4fPSjcd.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-W4KKPZXB-jpp555QD.js","assets/xychartDiagram-2RQKCTM6-CrSsH0ZL.js","assets/requirementDiagram-4Y6WPE33-nKJCyHfW.js","assets/sequenceDiagram-3UESZ5HK-CcOMecR8.js","assets/classDiagram-4FO5ZUOK-Vt88epYI.js","assets/chunk-727SXJPM-CMksbsjL.js","assets/classDiagram-v2-Q7XG4LA2-Vt88epYI.js","assets/stateDiagram-AJRCARHV-D0yHv9PM.js","assets/chunk-AQP2D5EJ-ChOCnmMe.js","assets/stateDiagram-v2-BHNVJYJU-CFwFamMD.js","assets/journeyDiagram-JHISSGLW-CbYKANnV.js","assets/timeline-definition-PNZ67QCA-hsR-T0Te.js","assets/mindmap-definition-RKZ34NQL-DzXKDTRa.js","assets/kanban-definition-UN3LZRKU-CYNaaEmw.js","assets/sankeyDiagram-5OEKKPKP-D-oX8o5g.js","assets/diagram-LMA3HP47-DkhUcRJZ.js","assets/diagram-2AECGRRQ-gZjYzjSJ.js","assets/blockDiagram-GPEHLZMM-DgA84B2f.js","assets/diagram-5GNKFQAL-uxJ9zL35.js","assets/architectureDiagram-3BPJPVTR-SiqLJ2Dv.js","assets/diagram-KO2AKTUF--9DBGjk3.js","assets/ishikawaDiagram-YF4QCWOH-1WQ5ViOx.js","assets/vennDiagram-CIIHVFJN-C9b10oqu.js","assets/diagram-OG6HWLK6-BaJ__gNW.js","assets/wardleyDiagram-YWT4CUSO-DReamCcN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var fS=Object.defineProperty;var mS=(t,e,r)=>e in t?fS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var re=(t,e,r)=>mS(t,typeof e!="symbol"?e+"":e,r);import{a as k,j as c,b as Wt,d as gS,g as _d,w as Nt,e as xS,f as Pn,n as oe,h as yS,m as bS,P as mf,N as CS}from"./mobile-4lQex-UI.js";import{c as St,a as st,b as kS,u as Es,P as Bs,d as uc,e as vS,f as hi,g as si,h as wS,I as jd,B as Dt,X as kn,_ as Vt,i as e0,D as Nd,j as Ed,k as Bd,l as Ld,m as r0,r as SS,n as TS,o as n0,p as _S}from"./index-CE1ehTQn.js";import{c as sa,b as i0,f as jS}from"./graph-BlEwG9Ro.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 NS=[["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"}]],Ad=St("activity",NS);/**
|
|
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 ES=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],BS=St("arrow-down-to-line",ES);/**
|
|
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 LS=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],AS=St("arrow-left",LS);/**
|
|
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 MS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],s0=St("arrow-right",MS);/**
|
|
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 IS=[["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"}]],FS=St("bell",IS);/**
|
|
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 DS=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],o0=St("book-open",DS);/**
|
|
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 PS=[["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"}]],Ji=St("bot",PS);/**
|
|
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 OS=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],$S=St("chart-no-axes-column",OS);/**
|
|
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 RS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],oa=St("check",RS);/**
|
|
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 zS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ls=St("chevron-down",zS);/**
|
|
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 WS=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],a0=St("chevron-left",WS);/**
|
|
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 qS=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fi=St("chevron-right",qS);/**
|
|
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 HS=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],l0=St("chevron-up",HS);/**
|
|
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 US=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],YS=St("circle-check-big",US);/**
|
|
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 VS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],c0=St("circle-check",VS);/**
|
|
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 GS=[["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"}]],XS=St("circle-x",GS);/**
|
|
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 KS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],QS=St("circle",KS);/**
|
|
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 ZS=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],h0=St("clock",ZS);/**
|
|
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 JS=[["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"}]],Md=St("cpu",JS);/**
|
|
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 tT=[["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"}]],u0=St("eye",tT);/**
|
|
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 eT=[["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"}]],Si=St("file-text",eT);/**
|
|
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 rT=[["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"}]],nT=St("folder-open",rT);/**
|
|
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 iT=[["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"}]],Id=St("folder",iT);/**
|
|
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 sT=[["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"}]],oT=St("funnel",sT);/**
|
|
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 aT=[["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"}]],d0=St("git-branch",aT);/**
|
|
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 lT=[["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"}]],nu=St("history",lT);/**
|
|
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 cT=[["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"}]],hT=St("inbox",cT);/**
|
|
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 uT=[["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"}]],dT=St("layers",uT);/**
|
|
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 pT=[["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"}]],fT=St("layout-dashboard",pT);/**
|
|
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 mT=[["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"}]],mi=St("lightbulb",mT);/**
|
|
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 gT=[["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"}]],xT=St("link-2",gT);/**
|
|
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 yT=[["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"}]],bT=St("list",yT);/**
|
|
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 CT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],p0=St("loader-circle",CT);/**
|
|
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 kT=[["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"}]],dc=St("message-square",kT);/**
|
|
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 vT=[["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"}]],wT=St("moon",vT);/**
|
|
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 ST=[["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"}]],TT=St("network",ST);/**
|
|
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 _T=[["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"}]],f0=St("pencil",_T);/**
|
|
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 jT=[["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"}]],NT=St("play",jT);/**
|
|
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 ET=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xl=St("plus",ET);/**
|
|
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 BT=[["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"}]],Wo=St("refresh-cw",BT);/**
|
|
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 LT=[["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"}]],AT=St("rotate-ccw",LT);/**
|
|
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 MT=[["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"}]],IT=St("save",MT);/**
|
|
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 FT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],vn=St("search",FT);/**
|
|
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 DT=[["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"}]],Fd=St("send",DT);/**
|
|
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 PT=[["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"}]],As=St("shield-check",PT);/**
|
|
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 OT=[["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"}]],$T=St("shield",OT);/**
|
|
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 RT=[["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"}]],m0=St("skip-forward",RT);/**
|
|
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 zT=[["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"}]],gf=St("sparkles",zT);/**
|
|
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 WT=[["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"}]],qT=St("star",WT);/**
|
|
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 HT=[["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"}]],UT=St("sun",HT);/**
|
|
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 YT=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],VT=St("terminal",YT);/**
|
|
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 GT=[["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"}]],xf=St("trash-2",GT);/**
|
|
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 XT=[["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"}]],pc=St("triangle-alert",XT);/**
|
|
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 KT=[["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"}]],Dd=St("user",KT);/**
|
|
273
|
+
* @license lucide-react v0.563.0 - ISC
|
|
274
|
+
*
|
|
275
|
+
* This source code is licensed under the ISC license.
|
|
276
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
+
*/const QT=[["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"}]],ZT=St("workflow",QT);/**
|
|
278
|
+
* @license lucide-react v0.563.0 - ISC
|
|
279
|
+
*
|
|
280
|
+
* This source code is licensed under the ISC license.
|
|
281
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
282
|
+
*/const JT=[["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"}]],yl=St("zap",JT),xr={feature:"#3b82f6",bug:"#ef4444",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},zn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b",superseded:"#6b5b8a"},t_=["planned","ready","in_progress","review","complete","blocked","parked","killed","superseded"],g0=["vision","specification","planning","implementation","verification","release"],bl={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},Pd=["Untested","Low","Moderate","High","Crystallized"],Te={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"},x0={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},y0=["claude","codex","gemini","human","unassigned"],yf={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"},yn={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 qo(t,e){const r=yn[t.stepId]??(t.fromPhase&&t.toPhase?`${Te[t.fromPhase]??t.fromPhase} → ${Te[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const bf={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"}},e_={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%)"},Cf={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},r_={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"},n_={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"}},i_={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},kf=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],s_={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},o_={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},a_={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},vf={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))"},b0={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 l_(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function c_(t){return`violations (${Array.isArray(t)?t.length:0})`}function h_(t){return t?"▾":"▸"}function u_({violations:t=[],expanded:e,onToggle:r}){const[n,i]=k.useState(!1),s=e!==void 0,o=s?e:n,a=l_(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const h=h_(o),u=c_(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 d_({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(u_,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const p_=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,wf=20;function f_({summary:t,output:e}){const[r,n]=k.useState(!1),[i,s]=k.useState(!1),o=e?p_.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
|
|
283
|
+
`):[],h=l.length>wf,u=r&&!i&&h?l.slice(0,wf):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(`
|
|
284
|
+
`),!i&&h&&c.jsxs(c.Fragment,{children:[`
|
|
285
|
+
`,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 m_={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 g_(t){return e_[m_[t]||"thinking"]}function x_(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function y_(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function b_({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 C_({block:t}){const e=g_(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(b_,{input:t.input})]})}function k_({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(Wt.Fragment,{children:[c.jsx(C_,{block:n}),s&&t._toolResult&&c.jsx(f_,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function v_({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:x_(t.duration_ms)}),t.total_cost_usd!=null&&c.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:y_(t.total_cost_usd)}),e&&t.errors&&c.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function w_({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 S_({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(d_,{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(k_,{msg:t}):t.type==="user"?c.jsx(w_,{msg:t}):t.type==="result"?c.jsx(v_,{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 T_({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 C0="compose:verboseStream",Cl={verboseStream:!1};function k0(){return Cl.verboseStream}function __(t,e){Cl.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(C0,String(Cl.verboseStream))}catch{}}function j_(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(C0);r!==null&&(Cl.verboseStream=r==="true")}catch{}}function N_(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 E_(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 v0=parseInt("4002",10),B_="compose-agent-session",Sf=500,L_=8,A_=2e3,w0=3e4,Tf={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"},M_={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};j_();const tt={es:null,connected:!1,connecting:!1,reconnectTimer:null,reconnectAttempts:0,sessionId:null,messages:[],agentStatus:"idle",agentTool:null,agentCategory:null,currentActivity:null,activityLog:[],_idleTimer:null,sourceStatus:{build:null,interactive:null},parallelTasks:null,streamError:null,retryInfo:null,stalled:!1,onConnectedChange:null,onMessagesChange:null,onAgentStatusChange:null,onStreamErrorChange:null};function I_(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=Tf[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=Tf[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 Kc(t,e,r){const n=Date.now(),i=tt.agentStatus,s=tt.agentTool;if(tt._idleTimer&&(clearTimeout(tt._idleTimer),tt._idleTimer=null),i==="working"&&(t==="idle"||e!==s)){const a=tt.currentActivity;a&&(a.endTime=n,a.duration=n-a.startTime,tt.activityLog.push(a),tt.activityLog.length>L_&&tt.activityLog.shift())}t==="working"&&e!==s?tt.currentActivity={tool:e,category:r,startTime:n,endTime:null,duration:null}:t==="idle"&&(tt.currentActivity=null),tt.agentStatus=t,tt.agentTool=e,tt.agentCategory=r;const o={status:t,tool:e,category:r,activityLog:tt.activityLog,currentActivity:tt.currentActivity,parallelTasks:tt.parallelTasks};tt.onAgentStatusChange&&tt.onAgentStatusChange({...o}),window.dispatchEvent(new CustomEvent("compose:agent-status",{detail:o}))}function _f(){const t=tt.sourceStatus.build,e=tt.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?Kc(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?Kc(t.status,t.tool,t.category):tt._idleTimer=setTimeout(()=>{tt._idleTimer=null,Kc("idle",null,null)},A_)}function iu(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("∥"))?(tt.parallelTasks||(tt.parallelTasks={total:0,completed:0,failed:0,active:0,tasks:{}}),tt.parallelTasks.total++,tt.parallelTasks.active++,tt.parallelTasks.tasks[t.stepId]="working"):t.subtype==="build_step_done"&&((o=(s=tt.parallelTasks)==null?void 0:s.tasks)!=null&&o[t.stepId])?(tt.parallelTasks.active=Math.max(0,tt.parallelTasks.active-1),tt.parallelTasks.completed++,tt.parallelTasks.tasks[t.stepId]="complete"):t.subtype==="build_step_done"&&tt.parallelTasks&&!((a=t.stepNum)!=null&&a.toString().startsWith("∥"))&&(tt.parallelTasks=null)),t._source==="build"&&t.type==="error"&&((h=(l=tt.parallelTasks)==null?void 0:l.tasks)!=null&&h[t.stepId])&&(tt.parallelTasks.active=Math.max(0,tt.parallelTasks.active-1),tt.parallelTasks.failed++,tt.parallelTasks.tasks[t.stepId]="failed");const e=I_(t);if(e){const u=e._source==="build"?"build":"interactive";tt.sourceStatus[u]=e,e.status==="idle"?(tt.parallelTasks=null,_f()):(tt._idleTimer&&(clearTimeout(tt._idleTimer),tt._idleTimer=null),_f())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(tt.sessionId=t.session_id,sessionStorage.setItem(B_,t.session_id));const{include:r,msg:n}=N_(t,k0());r&&(tt.messages=[...tt.messages,n],tt.messages.length>Sf&&(tt.messages=tt.messages.slice(-Sf)),tt.onMessagesChange&&tt.onMessagesChange(tt.messages))}function Qc(){if(tt.es)return;const t=`${window.location.protocol}//${window.location.hostname}:${v0}/api/agent/stream`,e=gS({url:t,namedEvents:["hydrate"],onOpen:()=>{tt.connected=!0,tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,tt.sourceStatus.build=null,tt.onConnectedChange&&tt.onConnectedChange(!0),tt.onStreamErrorChange&&tt.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})},onClose:()=>{tt.connected=!1,tt.onConnectedChange&&tt.onConnectedChange(!1)},onError:r=>{tt.streamError=(r==null?void 0:r.message)||"Connection error",tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:tt.retryInfo,stalled:tt.stalled})},onRetry:r=>{tt.retryInfo=r,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:r,stalled:tt.stalled})},onStall:()=>{tt.stalled=!0,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:tt.retryInfo,stalled:!0})},onExhausted:()=>{tt.es=null,tt.retryInfo=null,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:tt.streamError,retryInfo:null,stalled:tt.stalled})},onEvent:(r,n)=>{if((tt.stalled||tt.streamError)&&(tt.stalled=!1,tt.streamError=null,tt.retryInfo=null,tt.onStreamErrorChange&&tt.onStreamErrorChange({error:null,retryInfo:null,stalled:!1})),n==="hydrate"){if(Array.isArray(r))for(const i of r)iu(i);return}iu(r)},maxBackoffMs:8e3,maxRetries:5,stallTimeoutMs:w0});tt.es=e}async function Zc(t,e){const r=await fetch(`${window.location.protocol}//${window.location.hostname}:${v0}${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 jf(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 S0(){var L;const[t,e]=k.useState(tt.connected),[r,n]=k.useState(tt.messages),[i,s]=k.useState({status:tt.agentStatus,tool:tt.agentTool,category:tt.agentCategory,activityLog:tt.activityLog,currentActivity:tt.currentActivity}),[o,a]=k.useState(!1),[l,h]=k.useState(null),[u,d]=k.useState({error:tt.streamError,retryInfo:tt.retryInfo,stalled:tt.stalled}),f=k.useRef(null),p=k.useRef(null),m=k.useRef(!1),x=r.length===0||r.every(A=>A.type==="system"&&(A.subtype==="init"||A.subtype==="connected"));k.useEffect(()=>(tt.onConnectedChange=e,tt.onMessagesChange=n,tt.onAgentStatusChange=s,tt.onStreamErrorChange=d,()=>{tt.onConnectedChange=null,tt.onMessagesChange=null,tt.onAgentStatusChange=null,tt.onStreamErrorChange=null}),[]),k.useEffect(()=>{Qc()},[]);const g=k.useCallback(()=>{const A=p.current;if(!A)return;const j=A.scrollHeight-A.scrollTop-A.clientHeight<48;m.current=!j},[]);k.useEffect(()=>{var A;m.current||(A=f.current)==null||A.scrollIntoView({behavior:"smooth"})},[r.length]),k.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){h(null);return}const A=i.currentActivity.startTime,j=()=>h(Date.now()-A);j();const I=setInterval(j,1e3);return()=>clearInterval(I)},[i.status,(L=i.currentActivity)==null?void 0:L.startTime]);const y=k.useCallback(async A=>{a(!0);const j=A.match(/[A-Z]+-\d+/);j&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:j[0]}}));try{x||!tt.sessionId?await Zc("/api/agent/session",{prompt:A}):await Zc("/api/agent/message",{prompt:A})}catch(I){iu({type:"error",message:`Failed to send: ${I.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?M_[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((A,j)=>c.jsx("div",{className:"h-1 rounded-full",title:`${A.tool||"thinking"} — ${jf(A.duration)}`,style:{width:Math.max(6,Math.min(20,(A.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:jf(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…"})]}),E_(r).map((A,j)=>c.jsx(S_,{msg:A},A.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}),!tt.es&&u.error&&c.jsx("button",{onClick:()=>{tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),Qc()},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 ",w0/1e3,"s — connection may be stalled."]}),c.jsx("button",{onClick:()=>{tt.es&&(tt.es.close(),tt.es=null),tt.connected=!1,tt.onConnectedChange&&tt.onConnectedChange(!1),tt.streamError=null,tt.retryInfo=null,tt.stalled=!1,d({error:null,retryInfo:null,stalled:!1}),Qc()},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(T_,{onSend:y,disabled:b||!t,placeholder:b?"Working…":"Message Claude…"})]})}function F_(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const D_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,P_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O_={};function Nf(t,e){return(O_.jsx?P_:D_).test(t)}const $_=/[ \t\n\f\r]/g;function R_(t){return typeof t=="object"?t.type==="text"?Ef(t.value):!1:Ef(t)}function Ef(t){return t.replace($_,"")===""}class aa{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}aa.prototype.normal={};aa.prototype.property={};aa.prototype.space=void 0;function T0(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new aa(r,n,e)}function su(t){return t.toLowerCase()}class yr{constructor(e,r){this.attribute=r,this.property=e}}yr.prototype.attribute="";yr.prototype.booleanish=!1;yr.prototype.boolean=!1;yr.prototype.commaOrSpaceSeparated=!1;yr.prototype.commaSeparated=!1;yr.prototype.defined=!1;yr.prototype.mustUseProperty=!1;yr.prototype.number=!1;yr.prototype.overloadedBoolean=!1;yr.prototype.property="";yr.prototype.spaceSeparated=!1;yr.prototype.space=void 0;let z_=0;const Ft=Ti(),Ee=Ti(),ou=Ti(),ot=Ti(),ae=Ti(),ui=Ti(),vr=Ti();function Ti(){return 2**++z_}const au=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ft,booleanish:Ee,commaOrSpaceSeparated:vr,commaSeparated:ui,number:ot,overloadedBoolean:ou,spaceSeparated:ae},Symbol.toStringTag,{value:"Module"})),Jc=Object.keys(au);class Od extends yr{constructor(e,r,n,i){let s=-1;if(super(e,r),Bf(this,"space",i),typeof n=="number")for(;++s<Jc.length;){const o=Jc[s];Bf(this,Jc[s],(n&au[o])===au[o])}}}Od.prototype.defined=!0;function Bf(t,e,r){r&&(t[e]=r)}function Ms(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new Od(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[su(n)]=n,r[su(s.attribute)]=n}return new aa(e,r,t.space)}const _0=Ms({properties:{ariaActiveDescendant:null,ariaAtomic:Ee,ariaAutoComplete:null,ariaBusy:Ee,ariaChecked:Ee,ariaColCount:ot,ariaColIndex:ot,ariaColSpan:ot,ariaControls:ae,ariaCurrent:null,ariaDescribedBy:ae,ariaDetails:null,ariaDisabled:Ee,ariaDropEffect:ae,ariaErrorMessage:null,ariaExpanded:Ee,ariaFlowTo:ae,ariaGrabbed:Ee,ariaHasPopup:null,ariaHidden:Ee,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ae,ariaLevel:ot,ariaLive:null,ariaModal:Ee,ariaMultiLine:Ee,ariaMultiSelectable:Ee,ariaOrientation:null,ariaOwns:ae,ariaPlaceholder:null,ariaPosInSet:ot,ariaPressed:Ee,ariaReadOnly:Ee,ariaRelevant:null,ariaRequired:Ee,ariaRoleDescription:ae,ariaRowCount:ot,ariaRowIndex:ot,ariaRowSpan:ot,ariaSelected:Ee,ariaSetSize:ot,ariaSort:null,ariaValueMax:ot,ariaValueMin:ot,ariaValueNow:ot,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function j0(t,e){return e in t?t[e]:e}function N0(t,e){return j0(t,e.toLowerCase())}const W_=Ms({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ui,acceptCharset:ae,accessKey:ae,action:null,allow:null,allowFullScreen:Ft,allowPaymentRequest:Ft,allowUserMedia:Ft,alpha:Ft,alt:null,as:null,async:Ft,autoCapitalize:null,autoComplete:ae,autoFocus:Ft,autoPlay:Ft,blocking:ae,capture:null,charSet:null,checked:Ft,cite:null,className:ae,closedBy:null,colorSpace:null,cols:ot,colSpan:ot,command:null,commandFor:null,content:null,contentEditable:Ee,controls:Ft,controlsList:ae,coords:ot|ui,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ft,defer:Ft,dir:null,dirName:null,disabled:Ft,download:ou,draggable:Ee,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ft,formTarget:null,headers:ae,height:ot,hidden:ou,high:ot,href:null,hrefLang:null,htmlFor:ae,httpEquiv:ae,id:null,imageSizes:null,imageSrcSet:null,inert:Ft,inputMode:null,integrity:null,is:null,isMap:Ft,itemId:null,itemProp:ae,itemRef:ae,itemScope:Ft,itemType:ae,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ft,low:ot,manifest:null,max:null,maxLength:ot,media:null,method:null,min:null,minLength:ot,multiple:Ft,muted:Ft,name:null,nonce:null,noModule:Ft,noValidate:Ft,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:Ft,optimum:ot,pattern:null,ping:ae,placeholder:null,playsInline:Ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ft,referrerPolicy:null,rel:ae,required:Ft,reversed:Ft,rows:ot,rowSpan:ot,sandbox:ae,scope:null,scoped:Ft,seamless:Ft,selected:Ft,shadowRootClonable:Ft,shadowRootCustomElementRegistry:Ft,shadowRootDelegatesFocus:Ft,shadowRootMode:null,shadowRootSerializable:Ft,shape:null,size:ot,sizes:null,slot:null,span:ot,spellCheck:Ee,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ot,step:null,style:null,tabIndex:ot,target:null,title:null,translate:null,type:null,typeMustMatch:Ft,useMap:null,value:Ee,width:ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ae,axis:null,background:null,bgColor:null,border:ot,borderColor:null,bottomMargin:ot,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ft,declare:Ft,event:null,face:null,frame:null,frameBorder:null,hSpace:ot,leftMargin:ot,link:null,longDesc:null,lowSrc:null,marginHeight:ot,marginWidth:ot,noResize:Ft,noHref:Ft,noShade:Ft,noWrap:Ft,object:null,profile:null,prompt:null,rev:null,rightMargin:ot,rules:null,scheme:null,scrolling:Ee,standby:null,summary:null,text:null,topMargin:ot,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ot,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ft,disablePictureInPicture:Ft,disableRemotePlayback:Ft,exportParts:ui,part:ae,prefix:null,property:null,results:ot,security:null,unselectable:null},space:"html",transform:N0}),q_=Ms({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:vr,accentHeight:ot,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ot,amplitude:ot,arabicForm:null,ascent:ot,attributeName:null,attributeType:null,azimuth:ot,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ot,by:null,calcMode:null,capHeight:ot,className:ae,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ot,diffuseConstant:ot,direction:null,display:null,dur:null,divisor:ot,dominantBaseline:null,download:Ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:ot,enableBackground:null,end:null,event:null,exponent:ot,externalResourcesRequired:null,fill:null,fillOpacity:ot,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ui,g2:ui,glyphName:ui,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ot,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ot,horizOriginX:ot,horizOriginY:ot,id:null,ideographic:ot,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ot,k:ot,k1:ot,k2:ot,k3:ot,k4:ot,kernelMatrix:vr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ot,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ot,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ot,overlineThickness:ot,paintOrder:null,panose1:null,path:null,pathLength:ot,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ae,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ot,pointsAtY:ot,pointsAtZ:ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ot,specularExponent:ot,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ot,strikethroughThickness:ot,string:null,stroke:null,strokeDashArray:vr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ot,strokeOpacity:ot,strokeWidth:null,style:null,surfaceScale:ot,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vr,tabIndex:ot,tableValues:null,target:null,targetX:ot,targetY:ot,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ot,underlineThickness:ot,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ot,values:null,vAlphabetic:ot,vMathematical:ot,vectorEffect:null,vHanging:ot,vIdeographic:ot,version:null,vertAdvY:ot,vertOriginX:ot,vertOriginY:ot,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ot,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:j0}),E0=Ms({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()}}),B0=Ms({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:N0}),L0=Ms({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),H_={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"},U_=/[A-Z]/g,Lf=/-[a-z]/g,Y_=/^data[-\w.:]+$/i;function V_(t,e){const r=su(e);let n=e,i=yr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Y_.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Lf,X_);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Lf.test(s)){let o=s.replace(U_,G_);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Od}return new i(n,e)}function G_(t){return"-"+t.toLowerCase()}function X_(t){return t.charAt(1).toUpperCase()}const K_=T0([_0,W_,E0,B0,L0],"html"),$d=T0([_0,q_,E0,B0,L0],"svg");function Q_(t){return t.join(" ").trim()}var Ii={},th,Af;function Z_(){if(Af)return th;Af=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=`
|
|
286
|
+
`,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 M=P.match(e);M&&(C+=M.length);var F=P.lastIndexOf(l);b=~F?P.length-F:b+P.length}function _(){var P={line:C,column:b};return function(M){return M.position=new S(P),A(),M}}function S(P){this.start=P,this.end={line:C,column:b},this.source=y.source}S.prototype.content=g;function N(P){var M=new Error(y.source+":"+C+":"+b+": "+P);if(M.reason=P,M.filename=y.source,M.line=C,M.column=b,M.source=g,!y.silent)throw M}function L(P){var M=P.exec(g);if(M){var F=M[0];return w(F),g=g.slice(F.length),M}}function A(){L(r)}function j(P){var M;for(P=P||[];M=I();)M!==!1&&P.push(M);return P}function I(){var P=_();if(!(h!=g.charAt(0)||u!=g.charAt(1))){for(var M=2;d!=g.charAt(M)&&(u!=g.charAt(M)||h!=g.charAt(M+1));)++M;if(M+=2,d===g.charAt(M-1))return N("End of comment missing");var F=g.slice(2,M-2);return b+=2,w(F),g=g.slice(M),b+=2,P({type:f,comment:F})}}function z(){var P=_(),M=L(n);if(M){if(I(),!L(i))return N("property missing ':'");var F=L(s),O=P({type:p,property:x(M[0].replace(t,d)),value:F?x(F[0].replace(t,d)):d});return L(o),O}}function W(){var P=[];j(P);for(var M;M=z();)M!==!1&&(P.push(M),j(P));return P}return A(),W()}function x(g){return g?g.replace(a,d):d}return th=m,th}var Mf;function J_(){if(Mf)return Ii;Mf=1;var t=Ii&&Ii.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.default=r;const e=t(Z_());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 Ii}var Zs={},If;function tj(){if(If)return Zs;If=1,Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.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 Zs.camelCase=l,Zs}var Js,Ff;function ej(){if(Ff)return Js;Ff=1;var t=Js&&Js.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(J_()),r=tj();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,Js=n,Js}var rj=ej();const nj=_d(rj),A0=M0("end"),Rd=M0("start");function M0(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 ij(t){const e=Rd(t),r=A0(t);if(e&&r)return{start:e,end:r}}function Bo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Df(t.position):"start"in t||"end"in t?Df(t):"line"in t||"column"in t?lu(t):""}function lu(t){return Pf(t&&t.line)+":"+Pf(t&&t.column)}function Df(t){return lu(t&&t.start)+"-"+lu(t&&t.end)}function Pf(t){return t&&typeof t=="number"?t:1}class Ze 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=Bo(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}}Ze.prototype.file="";Ze.prototype.name="";Ze.prototype.reason="";Ze.prototype.message="";Ze.prototype.stack="";Ze.prototype.column=void 0;Ze.prototype.line=void 0;Ze.prototype.ancestors=void 0;Ze.prototype.cause=void 0;Ze.prototype.fatal=void 0;Ze.prototype.place=void 0;Ze.prototype.ruleId=void 0;Ze.prototype.source=void 0;const zd={}.hasOwnProperty,sj=new Map,oj=/[A-Z]/g,aj=new Set(["table","tbody","thead","tfoot","tr"]),lj=new Set(["td","th"]),I0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function cj(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=xj(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=gj(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"?$d:K_,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=F0(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function F0(t,e,r){if(e.type==="element")return hj(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return uj(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return pj(t,e,r);if(e.type==="mdxjsEsm")return dj(t,e);if(e.type==="root")return fj(t,e,r);if(e.type==="text")return mj(t,e)}function hj(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=$d,t.schema=i),t.ancestors.push(e);const s=P0(t,e.tagName,!1),o=yj(t,e);let a=qd(t,e);return aj.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!R_(l):!0})),D0(t,o,s,e),Wd(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function uj(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)}Ho(t,e.position)}function dj(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Ho(t,e.position)}function pj(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=$d,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:P0(t,e.name,!0),o=bj(t,e),a=qd(t,e);return D0(t,o,s,e),Wd(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function fj(t,e,r){const n={};return Wd(n,qd(t,e)),t.create(e,t.Fragment,n,r)}function mj(t,e){return e.value}function D0(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function Wd(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function gj(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 xj(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=Rd(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 yj(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&zd.call(e.properties,i)){const s=Cj(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&lj.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 bj(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 Ho(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 Ho(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function qd(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:sj;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=F0(t,s,o);a!==void 0&&r.push(a)}return r}function Cj(t,e,r){const n=V_(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?F_(r):Q_(r)),n.property==="style"){let i=typeof r=="object"?r:kj(t,String(r));return t.stylePropertyNameCase==="css"&&(i=vj(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?H_[n.property]||n.property:n.attribute,r]}}function kj(t,e){try{return nj(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Ze("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=I0+"#cannot-parse-style-attribute",i}}function P0(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=Nf(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=Nf(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return zd.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Ho(t)}function Ho(t,e){const r=new Ze("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=I0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function vj(t){const e={};let r;for(r in t)zd.call(t,r)&&(e[wj(r)]=t[r]);return e}function wj(t){let e=t.replace(oj,Sj);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Sj(t){return"-"+t.toLowerCase()}const eh={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"]},Tj={};function Hd(t,e){const r=Tj,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return O0(t,n,i)}function O0(t,e,r){if(_j(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 Of(t.children,e,r)}return Array.isArray(t)?Of(t,e,r):""}function Of(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=O0(t[i],e,r);return n.join("")}function _j(t){return!!(t&&typeof t=="object")}const $f=document.createElement("i");function Ud(t){const e="&"+t+";";$f.innerHTML=e;const r=$f.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function wr(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 Nr(t,e){return t.length>0?(wr(t,t.length,0,e),t):e}const Rf={}.hasOwnProperty;function $0(t){const e={};let r=-1;for(;++r<t.length;)jj(e,t[r]);return e}function jj(t,e){let r;for(r in e){const i=(Rf.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Rf.call(i,o)||(i[o]=[]);const a=s[o];Nj(i[o],Array.isArray(a)?a:a?[a]:[])}}}function Nj(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);wr(t,0,0,n)}function R0(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 nr=Gn(/[A-Za-z]/),Ke=Gn(/[\dA-Za-z]/),Ej=Gn(/[#-'*+\--9=?A-Z^-~]/);function kl(t){return t!==null&&(t<32||t===127)}const cu=Gn(/\d/),Bj=Gn(/[\dA-Fa-f]/),Lj=Gn(/[!-/:-@[-`{-~]/);function _t(t){return t!==null&&t<-2}function ce(t){return t!==null&&(t<0||t===32)}function Ut(t){return t===-2||t===-1||t===32}const fc=Gn(new RegExp("\\p{P}|\\p{S}","u")),gi=Gn(/\s/);function Gn(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Is(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&Ke(t.charCodeAt(r+1))&&Ke(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 Gt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ut(l)?(t.enter(r),a(l)):e(l)}function a(l){return Ut(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const Aj={tokenize:Mj};function Mj(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"),Gt(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 _t(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const Ij={tokenize:Fj},zf={tokenize:Dj};function Fj(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 wr(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(zf,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(zf,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 _t(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 L=N,A,j;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(A){j=e.events[L][1].end;break}A=!0}for(y(n),S=N;S<e.events.length;)e.events[S][1].end={...j},S++;wr(e.events,L+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 Dj(t,e,r){return Gt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ys(t){if(t===null||ce(t)||gi(t))return 1;if(fc(t))return 2}function mc(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 hu={name:"attention",resolveAll:Pj,tokenize:Oj};function Pj(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};Wf(d,-l),Wf(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=Nr(h,[["enter",t[n][1],e],["exit",t[n][1],e]])),h=Nr(h,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),h=Nr(h,mc(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),h=Nr(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=Nr(h,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,wr(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 Oj(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=ys(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=ys(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 Wf(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const $j={name:"autolink",tokenize:Rj};function Rj(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 nr(p)?(t.consume(p),o):p===64?r(p):h(p)}function o(p){return p===43||p===45||p===46||Ke(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||Ke(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||kl(p)?r(p):(t.consume(p),l)}function h(p){return p===64?(t.consume(p),u):Ej(p)?(t.consume(p),h):r(p)}function u(p){return Ke(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||Ke(p))&&n++<63){const m=p===45?f:d;return t.consume(p),m}return r(p)}}const la={partial:!0,tokenize:zj};function zj(t,e,r){return n;function n(s){return Ut(s)?Gt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||_t(s)?e(s):r(s)}}const z0={continuation:{tokenize:qj},exit:Hj,name:"blockQuote",tokenize:Wj};function Wj(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 Ut(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function qj(t,e,r){const n=this;return i;function i(o){return Ut(o)?Gt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(z0,e,r)(o)}}function Hj(t){t.exit("blockQuote")}const W0={name:"characterEscape",tokenize:Uj};function Uj(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 Lj(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const q0={name:"characterReference",tokenize:Yj};function Yj(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=Ke,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=Bj,u):(t.enter("characterReferenceValue"),s=7,o=cu,u(d))}function u(d){if(d===59&&i){const f=t.exit("characterReferenceValue");return o===Ke&&!Ud(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 qf={partial:!0,tokenize:Gj},Hf={concrete:!0,name:"codeFenced",tokenize:Vj};function Vj(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"),Ut(S)?Gt(t,d,"whitespace")(S):d(S))}function d(S){return S===null||_t(S)?(t.exit("codeFencedFence"),n.interrupt?e(S):t.check(qf,x,w)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(S))}function f(S){return S===null||_t(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(S)):Ut(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Gt(t,p,"whitespace")(S)):S===96&&S===a?r(S):(t.consume(S),f)}function p(S){return S===null||_t(S)?d(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||_t(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&&Ut(S)?Gt(t,C,"linePrefix",s+1)(S):C(S)}function C(S){return S===null||_t(S)?t.check(qf,x,w)(S):(t.enter("codeFlowValue"),b(S))}function b(S){return S===null||_t(S)?(t.exit("codeFlowValue"),C(S)):(t.consume(S),b)}function w(S){return t.exit("codeFenced"),e(S)}function _(S,N,L){let A=0;return j;function j(M){return S.enter("lineEnding"),S.consume(M),S.exit("lineEnding"),I}function I(M){return S.enter("codeFencedFence"),Ut(M)?Gt(S,z,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):z(M)}function z(M){return M===a?(S.enter("codeFencedFenceSequence"),W(M)):L(M)}function W(M){return M===a?(A++,S.consume(M),W):A>=o?(S.exit("codeFencedFenceSequence"),Ut(M)?Gt(S,P,"whitespace")(M):P(M)):L(M)}function P(M){return M===null||_t(M)?(S.exit("codeFencedFence"),N(M)):L(M)}}}function Gj(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 rh={name:"codeIndented",tokenize:Kj},Xj={partial:!0,tokenize:Qj};function Kj(t,e,r){const n=this;return i;function i(h){return t.enter("codeIndented"),Gt(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):_t(h)?t.attempt(Xj,o,l)(h):(t.enter("codeFlowValue"),a(h))}function a(h){return h===null||_t(h)?(t.exit("codeFlowValue"),o(h)):(t.consume(h),a)}function l(h){return t.exit("codeIndented"),e(h)}}function Qj(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):_t(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Gt(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):_t(o)?i(o):r(o)}}const Zj={name:"codeText",previous:tN,resolve:Jj,tokenize:eN};function Jj(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 tN(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function eN(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)):_t(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||_t(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 rN{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&&to(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),to(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),to(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);to(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);to(this.left,r.reverse())}}}function to(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 H0(t){const e={};let r=-1,n,i,s,o,a,l,h;const u=new rN(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,nN(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 wr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!h}function nN(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 iN={resolve:oN,tokenize:aN},sN={partial:!0,tokenize:lN};function oN(t){return H0(t),t}function aN(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):_t(a)?t.check(sN,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 lN(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Gt(t,s,"linePrefix")}function s(o){if(o===null||_t(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 U0(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||kl(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||_t(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||ce(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||kl(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 Y0(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):_t(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||_t(p)||a++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!Ut(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(t.consume(p),a++,d):d(p)}}function V0(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):_t(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Gt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||_t(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 Lo(t,e){let r;return n;function n(i){return _t(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Ut(i)?Gt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const cN={name:"definition",tokenize:uN},hN={partial:!0,tokenize:dN};function uN(t,e,r){const n=this;let i;return s;function s(p){return t.enter("definition"),o(p)}function o(p){return Y0.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 ce(p)?Lo(t,h)(p):h(p)}function h(p){return U0(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(hN,d,d)(p)}function d(p){return Ut(p)?Gt(t,f,"whitespace")(p):f(p)}function f(p){return p===null||_t(p)?(t.exit("definition"),n.parser.defined.push(i),e(p)):r(p)}}function dN(t,e,r){return n;function n(a){return ce(a)?Lo(t,i)(a):r(a)}function i(a){return V0(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ut(a)?Gt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||_t(a)?e(a):r(a)}}const pN={name:"hardBreakEscape",tokenize:fN};function fN(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return _t(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const mN={name:"headingAtx",resolve:gN,tokenize:xN};function gN(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"},wr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function xN(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||ce(u)?(t.exit("atxHeadingSequence"),a(u)):r(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||_t(u)?(t.exit("atxHeading"),e(u)):Ut(u)?Gt(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||ce(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),h)}}const yN=["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"],Uf=["pre","script","style","textarea"],bN={concrete:!0,name:"htmlFlow",resolveTo:vN,tokenize:wN},CN={partial:!0,tokenize:TN},kN={partial:!0,tokenize:SN};function vN(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 wN(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):nr(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):nr(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 G="CDATA[";return D===G.charCodeAt(a++)?(t.consume(D),a===G.length?n.interrupt?e:z:m):r(D)}function x(D){return nr(D)?(t.consume(D),o=String.fromCharCode(D),g):r(D)}function g(D){if(D===null||D===47||D===62||ce(D)){const G=D===47,ht=o.toLowerCase();return!G&&!s&&Uf.includes(ht)?(i=1,n.interrupt?e(D):z(D)):yN.includes(o.toLowerCase())?(i=6,G?(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||Ke(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 Ut(D)?(t.consume(D),C):j(D)}function b(D){return D===47?(t.consume(D),j):D===58||D===95||nr(D)?(t.consume(D),w):Ut(D)?(t.consume(D),b):j(D)}function w(D){return D===45||D===46||D===58||D===95||Ke(D)?(t.consume(D),w):_(D)}function _(D){return D===61?(t.consume(D),S):Ut(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):Ut(D)?(t.consume(D),S):L(D)}function N(D){return D===l?(t.consume(D),l=null,A):D===null||_t(D)?r(D):(t.consume(D),N)}function L(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||ce(D)?_(D):(t.consume(D),L)}function A(D){return D===47||D===62||Ut(D)?b(D):r(D)}function j(D){return D===62?(t.consume(D),I):r(D)}function I(D){return D===null||_t(D)?z(D):Ut(D)?(t.consume(D),I):r(D)}function z(D){return D===45&&i===2?(t.consume(D),F):D===60&&i===1?(t.consume(D),O):D===62&&i===4?(t.consume(D),V):D===63&&i===3?(t.consume(D),T):D===93&&i===5?(t.consume(D),B):_t(D)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(CN,et,W)(D)):D===null||_t(D)?(t.exit("htmlFlowData"),W(D)):(t.consume(D),z)}function W(D){return t.check(kN,P,et)(D)}function P(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),M}function M(D){return D===null||_t(D)?W(D):(t.enter("htmlFlowData"),z(D))}function F(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 G=o.toLowerCase();return Uf.includes(G)?(t.consume(D),V):z(D)}return nr(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),V):D===45&&i===2?(t.consume(D),T):z(D)}function V(D){return D===null||_t(D)?(t.exit("htmlFlowData"),et(D)):(t.consume(D),V)}function et(D){return t.exit("htmlFlow"),e(D)}}function SN(t,e,r){const n=this;return i;function i(o){return _t(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 TN(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(la,e,r)}}const _N={name:"htmlText",tokenize:jN};function jN(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):nr(T)?(t.consume(T),L):r(T)}function h(T){return T===45?(t.consume(T),u):T===91?(t.consume(T),s=0,m):nr(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):_t(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?F(T):T===45?f(T):d(T)}function m(T){const V="CDATA[";return T===V.charCodeAt(s++)?(t.consume(T),s===V.length?x:m):r(T)}function x(T){return T===null?r(T):T===93?(t.consume(T),g):_t(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?F(T):T===93?(t.consume(T),y):x(T)}function C(T){return T===null||T===62?F(T):_t(T)?(o=C,O(T)):(t.consume(T),C)}function b(T){return T===null?r(T):T===63?(t.consume(T),w):_t(T)?(o=b,O(T)):(t.consume(T),b)}function w(T){return T===62?F(T):b(T)}function _(T){return nr(T)?(t.consume(T),S):r(T)}function S(T){return T===45||Ke(T)?(t.consume(T),S):N(T)}function N(T){return _t(T)?(o=N,O(T)):Ut(T)?(t.consume(T),N):F(T)}function L(T){return T===45||Ke(T)?(t.consume(T),L):T===47||T===62||ce(T)?A(T):r(T)}function A(T){return T===47?(t.consume(T),F):T===58||T===95||nr(T)?(t.consume(T),j):_t(T)?(o=A,O(T)):Ut(T)?(t.consume(T),A):F(T)}function j(T){return T===45||T===46||T===58||T===95||Ke(T)?(t.consume(T),j):I(T)}function I(T){return T===61?(t.consume(T),z):_t(T)?(o=I,O(T)):Ut(T)?(t.consume(T),I):A(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):_t(T)?(o=z,O(T)):Ut(T)?(t.consume(T),z):(t.consume(T),P)}function W(T){return T===i?(t.consume(T),i=void 0,M):T===null?r(T):_t(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||ce(T)?A(T):(t.consume(T),P)}function M(T){return T===47||T===62||ce(T)?A(T):r(T)}function F(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 Ut(T)?Gt(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 Yd={name:"labelEnd",resolveAll:LN,resolveTo:AN,tokenize:MN},NN={tokenize:IN},EN={tokenize:FN},BN={tokenize:DN};function LN(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&&wr(t,0,t.length,r),t}function AN(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=Nr(a,t.slice(s+1,s+n+3)),a=Nr(a,[["enter",u,e]]),a=Nr(a,mc(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Nr(a,[["exit",u,e],t[o-2],t[o-1],["exit",h,e]]),a=Nr(a,t.slice(o+1)),a=Nr(a,[["exit",l,e]]),wr(t,s,t.length,a),t}function MN(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(NN,u,o?u:d)(f):f===91?t.attempt(EN,u,o?h:d)(f):o?u(f):d(f)}function h(f){return t.attempt(BN,u,d)(f)}function u(f){return e(f)}function d(f){return s._balanced=!0,r(f)}}function IN(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 ce(d)?Lo(t,s)(d):s(d)}function s(d){return d===41?u(d):U0(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ce(d)?Lo(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?V0(t,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function h(d){return ce(d)?Lo(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 FN(t,e,r){const n=this;return i;function i(a){return Y0.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 DN(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 PN={name:"labelStartImage",resolveAll:Yd.resolveAll,tokenize:ON};function ON(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 $N={name:"labelStartLink",resolveAll:Yd.resolveAll,tokenize:RN};function RN(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 nh={name:"lineEnding",tokenize:zN};function zN(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Gt(t,e,"linePrefix")}}const el={name:"thematicBreak",tokenize:WN};function WN(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||_t(h))?(t.exit("thematicBreak"),e(h)):r(h)}function l(h){return h===i?(t.consume(h),n++,l):(t.exit("thematicBreakSequence"),Ut(h)?Gt(t,a,"whitespace")(h):a(h))}}const ur={continuation:{tokenize:YN},exit:GN,name:"list",tokenize:UN},qN={partial:!0,tokenize:XN},HN={partial:!0,tokenize:VN};function UN(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:cu(p)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(el,r,h)(p):h(p);if(!n.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return r(p)}function l(p){return cu(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(la,n.interrupt?r:u,t.attempt(qN,f,d))}function u(p){return n.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Ut(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 YN(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(la,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Gt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Ut(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(HN,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Gt(t,t.attempt(ur,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function VN(t,e,r){const n=this;return Gt(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 GN(t){t.exit(this.containerState.type)}function XN(t,e,r){const n=this;return Gt(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!Ut(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const Yf={name:"setextUnderline",resolveTo:KN,tokenize:QN};function KN(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 QN(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"),Ut(h)?Gt(t,l,"lineSuffix")(h):l(h))}function l(h){return h===null||_t(h)?(t.exit("setextHeadingLine"),e(h)):r(h)}}const ZN={tokenize:JN};function JN(t){const e=this,r=t.attempt(la,n,t.attempt(this.parser.constructs.flowInitial,i,Gt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(iN,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 t5={resolveAll:X0()},e5=G0("string"),r5=G0("text");function G0(t){return{resolveAll:X0(t==="text"?n5: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 X0(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 n5(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 i5={42:ur,43:ur,45:ur,48:ur,49:ur,50:ur,51:ur,52:ur,53:ur,54:ur,55:ur,56:ur,57:ur,62:z0},s5={91:cN},o5={[-2]:rh,[-1]:rh,32:rh},a5={35:mN,42:el,45:[Yf,el],60:bN,61:Yf,95:el,96:Hf,126:Hf},l5={38:q0,92:W0},c5={[-5]:nh,[-4]:nh,[-3]:nh,33:PN,38:q0,42:hu,60:[$j,_N],91:$N,92:[pN,W0],93:Yd,95:hu,96:Zj},h5={null:[hu,t5]},u5={null:[42,95]},d5={null:[]},p5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:u5,contentInitial:s5,disable:d5,document:i5,flow:a5,flowInitial:o5,insideSpan:h5,string:l5,text:c5},Symbol.toStringTag,{value:"Module"}));function f5(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(I){return o=Nr(o,I),g(),o[o.length-1]!==null?[]:(L(e,0),h.events=mc(s,h.events,h),h.events)}function f(I,z){return g5(p(I),z)}function p(I){return m5(o,I)}function m(){const{_bufferIndex:I,_index:z,line:W,column:P,offset:M}=n;return{_bufferIndex:I,_index:z,line:W,column:P,offset:M}}function x(I){i[I.line]=I.column,j()}function g(){let I;for(;n._index<o.length;){const z=o[n._index];if(typeof z=="string")for(I=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===I&&n._bufferIndex<z.length;)y(z.charCodeAt(n._bufferIndex));else y(z)}}function y(I){u=u(I)}function C(I){_t(I)?(n.line++,n.column=1,n.offset+=I===-3?2:1,j()):I!==-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=I}function b(I,z){const W=z||{};return W.type=I,W.start=m(),h.events.push(["enter",W,h]),a.push(W),W}function w(I){const z=a.pop();return z.end=m(),h.events.push(["exit",z,h]),z}function _(I,z){L(I,z.from)}function S(I,z){z.restore()}function N(I,z){return W;function W(P,M,F){let O,$,B,T;return Array.isArray(P)?et(P):"tokenize"in P?et([P]):V(P);function V(xt){return $t;function $t(Ht){const ct=Ht!==null&&xt[Ht],X=Ht!==null&&xt.null,it=[...Array.isArray(ct)?ct:ct?[ct]:[],...Array.isArray(X)?X:X?[X]:[]];return et(it)(Ht)}}function et(xt){return O=xt,$=0,xt.length===0?F:D(xt[$])}function D(xt){return $t;function $t(Ht){return T=A(),B=xt,xt.partial||(h.currentConstruct=xt),xt.name&&h.parser.constructs.disable.null.includes(xt.name)?ht():xt.tokenize.call(z?Object.assign(Object.create(h),z):h,l,G,ht)(Ht)}}function G(xt){return I(B,T),M}function ht(xt){return T.restore(),++$<O.length?D(O[$]):F}}}function L(I,z){I.resolveAll&&!s.includes(I)&&s.push(I),I.resolve&&wr(h.events,z,h.events.length-z,I.resolve(h.events.slice(z),h)),I.resolveTo&&(h.events=I.resolveTo(h.events,h))}function A(){const I=m(),z=h.previous,W=h.currentConstruct,P=h.events.length,M=Array.from(a);return{from:P,restore:F};function F(){n=I,h.previous=z,h.currentConstruct=W,h.events.length=P,a=M,j()}}function j(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function m5(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 g5(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=`
|
|
287
|
+
`;break}case-3:{o=`\r
|
|
288
|
+
`;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 x5(t){const n={constructs:$0([p5,...(t||{}).extensions||[]]),content:i(Aj),defined:[],document:i(Ij),flow:i(ZN),lazy:{},string:i(e5),text:i(r5)};return n;function i(s){return o;function o(a){return f5(n,s,a)}}}function y5(t){for(;!H0(t););return t}const Vf=/[\0\t\n\r]/g;function b5(){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(Vf.lastIndex=d,h=Vf.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 C5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function k5(t){return t.replace(C5,v5)}function v5(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return R0(r.slice(s?2:1),s?16:10)}return Ud(r)||t}const K0={}.hasOwnProperty;function w5(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),S5(r)(y5(x5(r).document().write(b5()(t,e,!0))))}function S5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(br),autolinkProtocol:A,autolinkEmail:A,atxHeading:s(Pt),blockQuote:s(X),characterEscape:A,characterReference:A,codeFenced:s(it),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(it,o),codeText:s(vt,o),codeTextData:A,data:A,codeFlowValue:A,definition:s(gt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Jt),hardBreakEscape:s(Xt),hardBreakTrailing:s(Xt),htmlFlow:s(je,o),htmlFlowData:A,htmlText:s(je,o),htmlTextData:A,image:s(Kt),label:o,link:s(br),listItem:s(Pe),listItemValue:f,listOrdered:s(ue,d),listUnordered:s(ue),paragraph:s(We),reference:D,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Pt),strong:s(de),thematicBreak:s(Z)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:ct,autolinkProtocol:Ht,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:ht,characterReferenceMarkerNumeric:ht,characterReferenceValue:xt,characterReference:$t,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:j,codeIndented:l(y),codeText:l(M),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:I,link:l(F),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:G,resourceDestinationString:T,resourceTitleString:V,resource:et,setextHeading:l(L),setextHeadingLineSequence:N,setextHeadingText:S,strong:l(),thematicBreak:l()}};Q0(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(H){let rt={type:"root",children:[]};const at={stack:[rt],tokenStack:[],config:e,enter:a,exit:h,buffer:o,resume:u,data:r},pt=[];let Tt=-1;for(;++Tt<H.length;)if(H[Tt][1].type==="listOrdered"||H[Tt][1].type==="listUnordered")if(H[Tt][0]==="enter")pt.push(Tt);else{const te=pt.pop();Tt=i(H,te,Tt)}for(Tt=-1;++Tt<H.length;){const te=e[H[Tt][0]];K0.call(te,H[Tt][1].type)&&te[H[Tt][1].type].call(Object.assign({sliceSerialize:H[Tt][2].sliceSerialize},at),H[Tt][1])}if(at.tokenStack.length>0){const te=at.tokenStack[at.tokenStack.length-1];(te[1]||Gf).call(at,void 0,te[0])}for(rt.position={start:En(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:En(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Tt=-1;++Tt<e.transforms.length;)rt=e.transforms[Tt](rt)||rt;return rt}function i(H,rt,at){let pt=rt-1,Tt=-1,te=!1,ge,Ne,qe,xe;for(;++pt<=at;){const ye=H[pt];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?Tt++:Tt--,xe=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(ge&&!xe&&!Tt&&!qe&&(qe=pt),xe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:xe=void 0}if(!Tt&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||Tt===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(ge){let he=pt;for(Ne=void 0;he--;){const Oe=H[he];if(Oe[1].type==="lineEnding"||Oe[1].type==="lineEndingBlank"){if(Oe[0]==="exit")continue;Ne&&(H[Ne][1].type="lineEndingBlank",te=!0),Oe[1].type="lineEnding",Ne=he}else if(!(Oe[1].type==="linePrefix"||Oe[1].type==="blockQuotePrefix"||Oe[1].type==="blockQuotePrefixWhitespace"||Oe[1].type==="blockQuoteMarker"||Oe[1].type==="listItemIndent"))break}qe&&(!Ne||qe<Ne)&&(ge._spread=!0),ge.end=Object.assign({},Ne?H[Ne][1].start:ye[1].end),H.splice(Ne||pt,0,["exit",ge,ye[2]]),pt++,at++}if(ye[1].type==="listItemPrefix"){const he={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};ge=he,H.splice(pt,0,["enter",he,ye[2]]),pt++,at++,qe=void 0,xe=!0}}}return H[rt][1]._spread=te,at}function s(H,rt){return at;function at(pt){a.call(this,H(pt),pt),rt&&rt.call(this,pt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(H,rt,at){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([rt,at||void 0]),H.position={start:En(rt.start),end:void 0}}function l(H){return rt;function rt(at){H&&H.call(this,at),h.call(this,at)}}function h(H,rt){const at=this.stack.pop(),pt=this.tokenStack.pop();if(pt)pt[0].type!==H.type&&(rt?rt.call(this,H,pt[0]):(pt[1]||Gf).call(this,H,pt[0]));else throw new Error("Cannot close `"+H.type+"` ("+Bo({start:H.start,end:H.end})+"): it’s not open");at.position.end=En(H.end)}function u(){return Hd(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(),at=this.stack[this.stack.length-1];at.label=rt,at.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 at=this.sliceSerialize(H).length;rt.depth=at}}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 L(){this.data.setextHeadingSlurpLineEnding=void 0}function A(H){const at=this.stack[this.stack.length-1].children;let pt=at[at.length-1];(!pt||pt.type!=="text")&&(pt=q(),pt.position={start:En(H.start),end:void 0},at.push(pt)),this.stack.push(pt)}function j(H){const rt=this.stack.pop();rt.value+=this.sliceSerialize(H),rt.position.end=En(H.end)}function I(H){const rt=this.stack[this.stack.length-1];if(this.data.atHardBreak){const at=rt.children[rt.children.length-1];at.position.end=En(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(rt.type)&&(A.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 M(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.value=H}function F(){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),at=this.stack[this.stack.length-2];at.label=k5(rt),at.identifier=Or(rt).toLowerCase()}function B(){const H=this.stack[this.stack.length-1],rt=this.resume(),at=this.stack[this.stack.length-1];if(this.data.inReference=!0,at.type==="link"){const pt=H.children;at.children=pt}else at.alt=rt}function T(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.url=H}function V(){const H=this.resume(),rt=this.stack[this.stack.length-1];rt.title=H}function et(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function G(H){const rt=this.resume(),at=this.stack[this.stack.length-1];at.label=rt,at.identifier=Or(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function ht(H){this.data.characterReferenceType=H.type}function xt(H){const rt=this.sliceSerialize(H),at=this.data.characterReferenceType;let pt;at?(pt=R0(rt,at==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pt=Ud(rt);const Tt=this.stack[this.stack.length-1];Tt.value+=pt}function $t(H){const rt=this.stack.pop();rt.position.end=En(H.end)}function Ht(H){j.call(this,H);const rt=this.stack[this.stack.length-1];rt.url=this.sliceSerialize(H)}function ct(H){j.call(this,H);const rt=this.stack[this.stack.length-1];rt.url="mailto:"+this.sliceSerialize(H)}function X(){return{type:"blockquote",children:[]}}function it(){return{type:"code",lang:null,meta:null,value:""}}function vt(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Jt(){return{type:"emphasis",children:[]}}function Pt(){return{type:"heading",depth:0,children:[]}}function Xt(){return{type:"break"}}function je(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function br(){return{type:"link",title:null,url:"",children:[]}}function ue(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Pe(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function We(){return{type:"paragraph",children:[]}}function de(){return{type:"strong",children:[]}}function q(){return{type:"text",value:""}}function Z(){return{type:"thematicBreak"}}}function En(t){return{line:t.line,column:t.column,offset:t.offset}}function Q0(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?Q0(t,n):T5(t,n)}}function T5(t,e){let r;for(r in e)if(K0.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 Gf(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Bo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Bo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Bo({start:e.start,end:e.end})+") is still open")}function _5(t){const e=this;e.parser=r;function r(n){return w5(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function j5(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 N5(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
|
|
289
|
+
`}]}function E5(t,e){const r=e.value?e.value+`
|
|
290
|
+
`:"",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 B5(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function L5(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function A5(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Is(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 M5(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 I5(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function Z0(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 F5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Z0(t,e);const i={src:Is(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 D5(t,e){const r={src:Is(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 P5(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 O5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return Z0(t,e);const i={href:Is(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 $5(t,e){const r={href:Is(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 R5(t,e,r){const n=t.all(e),i=r?z5(r):J0(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:`
|
|
291
|
+
`}),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:`
|
|
292
|
+
`});const h={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,h),t.applyData(e,h)}function z5(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=J0(r[n])}return e}function J0(t){const e=t.spread;return e??t.children.length>1}function W5(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 q5(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function H5(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function U5(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Y5(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=Rd(e.children[1]),l=A0(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 V5(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 G5(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Xf=9,Kf=32;function X5(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Qf(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Qf(e.slice(i),i>0,!1)),s.join("")}function Qf(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===Xf||s===Kf;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===Xf||s===Kf;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function K5(t,e){const r={type:"text",value:X5(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function Q5(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const Z5={blockquote:j5,break:N5,code:E5,delete:B5,emphasis:L5,footnoteReference:A5,heading:M5,html:I5,imageReference:F5,image:D5,inlineCode:P5,linkReference:O5,link:$5,listItem:R5,list:W5,paragraph:q5,root:H5,strong:U5,table:Y5,tableCell:G5,tableRow:V5,text:K5,thematicBreak:Q5,toml:Ea,yaml:Ea,definition:Ea,footnoteDefinition:Ea};function Ea(){}const ty=-1,gc=0,Ao=1,vl=2,Vd=3,Gd=4,Xd=5,Kd=6,ey=7,ry=8,J5=typeof self=="object"?self:globalThis,Zf=(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 J5[t](e)},tE=(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 gc:case ty:return r(o,i);case Ao:{const a=r([],i);for(const l of o)a.push(n(l));return a}case vl:{const a=r({},i);for(const[l,h]of o)a[n(l)]=n(h);return a}case Vd:return r(new Date(o),i);case Gd:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case Xd:{const a=r(new Map,i);for(const[l,h]of o)a.set(n(l),n(h));return a}case Kd:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case ey:{const{name:a,message:l}=o;return r(Zf(a,l),i)}case ry: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(Zf(s,o),i)};return n},Jf=t=>tE(new Map,t)(0),Fi="",{toString:eE}={},{keys:rE}=Object,eo=t=>{const e=typeof t;if(e!=="object"||!t)return[gc,e];const r=eE.call(t).slice(8,-1);switch(r){case"Array":return[Ao,Fi];case"Object":return[vl,Fi];case"Date":return[Vd,Fi];case"RegExp":return[Gd,Fi];case"Map":return[Xd,Fi];case"Set":return[Kd,Fi];case"DataView":return[Ao,r]}return r.includes("Array")?[Ao,r]:r.includes("Error")?[ey,r]:[vl,r]},Ba=([t,e])=>t===gc&&(e==="function"||e==="symbol"),nE=(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]=eo(o);switch(a){case gc:{let u=o;switch(l){case"bigint":a=ry,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([ty],o)}return i([a,u],o)}case Ao:{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 vl:{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 rE(o))(t||!Ba(eo(o[f])))&&u.push([s(f),s(o[f])]);return d}case Vd:return i([a,o.toISOString()],o);case Gd:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case Xd:{const u=[],d=i([a,u],o);for(const[f,p]of o)(t||!(Ba(eo(f))||Ba(eo(p))))&&u.push([s(f),s(p)]);return d}case Kd:{const u=[],d=i([a,u],o);for(const f of o)(t||!Ba(eo(f)))&&u.push(s(f));return d}}const{message:h}=o;return i([a,{name:l,message:h}],o)};return s},tm=(t,{json:e,lossy:r}={})=>{const n=[];return nE(!(e||r),!!e,new Map,n)(t),n},wl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Jf(tm(t,e)):structuredClone(t):(t,e)=>Jf(tm(t,e));function iE(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 sE(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function oE(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||iE,n=t.options.footnoteBackLabel||sE,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=Is(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:{...wl(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
293
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
|
|
294
|
+
`}]}}const xc=(function(t){if(t==null)return hE;if(typeof t=="function")return yc(t);if(typeof t=="object")return Array.isArray(t)?aE(t):lE(t);if(typeof t=="string")return cE(t);throw new Error("Expected function, string, or object as test")});function aE(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=xc(t[r]);return yc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function lE(t){const e=t;return yc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function cE(t){return yc(e);function e(r){return r&&r.type===t}}function yc(t){return e;function e(r,n,i){return!!(uE(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function hE(){return!0}function uE(t){return t!==null&&typeof t=="object"&&"type"in t}const ny=[],dE=!0,uu=!1,pE="skip";function iy(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=xc(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=ny,m,x,g;if((!e||s(l,h,u[u.length-1]||void 0))&&(p=fE(r(l,u)),p[0]===uu))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==pE)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]===uu)return m;x=typeof m[1]=="number"?m[1]:x+o}}return p}}}function fE(t){return Array.isArray(t)?t:typeof t=="number"?[dE,t]:t==null?ny:[t]}function Qd(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),iy(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 du={}.hasOwnProperty,mE={};function gE(t,e){const r=e||mE,n=new Map,i=new Map,s=new Map,o={...Z5,...r.handlers},a={all:h,applyData:yE,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:xE,wrap:CE};return Qd(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(du.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=wl(g);return y.children=a.all(u),y}return wl(u)}return(a.options.unknownHandler||bE)(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=em(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=em(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function xE(t,e){t.position&&(e.position=ij(t))}function yE(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,wl(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function bE(t,e){const r=e.data||{},n="value"in e&&!(du.call(r,"hProperties")||du.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 CE(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
|
|
295
|
+
`});++n<t.length;)n&&r.push({type:"text",value:`
|
|
296
|
+
`}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
|
|
297
|
+
`}),r}function em(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function rm(t,e){const r=gE(t,e),n=r.one(t,void 0),i=oE(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
298
|
+
`},i),s}function kE(t,e){return t&&"run"in t?async function(r,n){const i=rm(r,{file:n,...e});await t.run(i,n)}:function(r,n){return rm(r,{file:n,...t||e})}}function nm(t){if(t)throw t}var ih,im;function vE(){if(im)return ih;im=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 ih=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},ih}var wE=vE();const sh=_d(wE);function pu(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 SE(){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?TE(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 TE(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:_E,dirname:jE,extname:NE,join:EE,sep:"/"};function _E(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ca(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 jE(t){if(ca(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 NE(t){ca(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 EE(...t){let e=-1,r;for(;++e<t.length;)ca(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":BE(r)}function BE(t){ca(t);const e=t.codePointAt(0)===47;let r=LE(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function LE(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 ca(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const AE={cwd:ME};function ME(){return"/"}function fu(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function IE(t){if(typeof t=="string")t=new URL(t);else if(!fu(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 FE(t)}function FE(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 oh=["history","path","basename","stem","extname","dirname"];class sy{constructor(e){let r;e?fu(e)?r={path:e}:typeof e=="string"||DE(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":AE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<oh.length;){const s=oh[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)oh.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Xr.basename(this.path):void 0}set basename(e){lh(e,"basename"),ah(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){sm(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(ah(e,"extname"),sm(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){fu(e)&&(e=IE(e)),lh(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){lh(e,"stem"),ah(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 Ze(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 ah(t,e){if(t&&t.includes(Xr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Xr.sep+"`")}function lh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function sm(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function DE(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const PE=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),OE={}.hasOwnProperty;class Zd extends PE{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=SE()}copy(){const e=new Zd;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(sh(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(uh("data",this.frozen),this.namespace[e]=r,this):OE.call(this.namespace,e)&&this.namespace[e]||void 0:e?(uh("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const i=r.call(e,...n);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const r=La(e),n=this.parser||this.Parser;return ch("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),ch("process",this.parser||this.Parser),hh("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=La(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);zE(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(),ch("processSync",this.parser||this.Parser),hh("processSync",this.compiler||this.Compiler),this.process(e,i),am("processSync","process",r),n;function i(s,o){r=!0,nm(s),n=o}}run(e,r,n){om(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=La(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),am("runSync","run",n),i;function s(o,a){nm(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=La(r),i=this.compiler||this.Compiler;return hh("stringify",i),om(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(uh("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=sh(!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];pu(x)&&pu(p)&&(p=sh(!0,x,p)),n[f]=[h,p,...m]}}}}const $E=new Zd().freeze();function ch(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function hh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function uh(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 om(t){if(!pu(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function am(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function La(t){return RE(t)?t:new sy(t)}function RE(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function zE(t){return typeof t=="string"||WE(t)}function WE(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const qE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",lm=[],cm={allowDangerousHtml:!0},HE=/^(https?|ircs?|mailto|xmpp)$/i,UE=[{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 Jd(t){const e=YE(t),r=VE(t);return GE(e.runSync(e.parse(r),r),t)}function YE(t){const e=t.rehypePlugins||lm,r=t.remarkPlugins||lm,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...cm}:cm;return $E().use(_5).use(r).use(kE,n).use(e)}function VE(t){const e=t.children||"",r=new sy;return typeof e=="string"&&(r.value=e),r}function GE(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||XE;for(const u of UE)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+qE+u.id,void 0);return Qd(t,h),cj(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 eh)if(Object.hasOwn(eh,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],x=eh[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 XE(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||HE.test(t.slice(0,e))?t:""}function hm(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 KE(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function QE(t,e,r){const i=xc((r||{}).ignore||[]),s=ZE(e);let o=-1;for(;++o<s.length;)iy(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 ZE(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([JE(i[0]),tB(i[1])])}return e}function JE(t){return typeof t=="string"?new RegExp(KE(t),"g"):t}function tB(t){return typeof t=="function"?t:function(){return t}}const dh="phrasing",ph=["autolink","link","image","label"];function eB(){return{transforms:[lB],enter:{literalAutolink:nB,literalAutolinkEmail:fh,literalAutolinkHttp:fh,literalAutolinkWww:fh},exit:{literalAutolink:aB,literalAutolinkEmail:oB,literalAutolinkHttp:iB,literalAutolinkWww:sB}}}function rB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:dh,notInConstruct:ph},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:dh,notInConstruct:ph},{character:":",before:"[ps]",after:"\\/",inConstruct:dh,notInConstruct:ph}]}}function nB(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function fh(t){this.config.enter.autolinkProtocol.call(this,t)}function iB(t){this.config.exit.autolinkProtocol.call(this,t)}function sB(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 oB(t){this.config.exit.autolinkEmail.call(this,t)}function aB(t){this.exit(t)}function lB(t){QE(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,cB],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),hB]],{ignore:["link","linkReference"]})}function cB(t,e,r,n,i){let s="";if(!oy(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!uB(r)))return!1;const o=dB(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 hB(t,e,r,n){return!oy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function uB(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 dB(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=hm(t,"(");let s=hm(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 oy(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||gi(r)||fc(r))&&(!e||r!==47)}ay.peek=kB;function pB(){this.buffer()}function fB(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function mB(){this.buffer()}function gB(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function xB(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 yB(t){this.exit(t)}function bB(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 CB(t){this.exit(t)}function kB(){return"["}function ay(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 vB(){return{enter:{gfmFootnoteCallString:pB,gfmFootnoteCall:fB,gfmFootnoteDefinitionLabelString:mB,gfmFootnoteDefinition:gB},exit:{gfmFootnoteCallString:xB,gfmFootnoteCall:yB,gfmFootnoteDefinitionLabelString:bB,gfmFootnoteDefinition:CB}}}function wB(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:ay},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?`
|
|
299
|
+
`:" ")+s.indentLines(s.containerFlow(n,a.current()),e?ly:SB))),h(),l}}function SB(t,e,r){return e===0?t:ly(t,e,r)}function ly(t,e,r){return(r?"":" ")+t}const TB=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];cy.peek=BB;function _B(){return{canContainEols:["delete"],enter:{strikethrough:NB},exit:{strikethrough:EB}}}function jB(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:TB}],handlers:{delete:cy}}}function NB(t){this.enter({type:"delete",children:[]},t)}function EB(t){this.exit(t)}function cy(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 BB(){return"~"}function LB(t){return t.length}function AB(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||LB,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=MB(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]=um(n[d]);else{const x=um(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(`
|
|
300
|
+
`)}function MB(t){return t==null?"":String(t)}function um(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 IB(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()),FB);return i(),o}function FB(t,e,r){return">"+(r?"":" ")+t}function DB(t,e){return dm(t,e.inConstruct,!0)&&!dm(t,e.notInConstruct,!1)}function dm(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 pm(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
301
|
+
`&&DB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
|
|
302
|
+
`}function PB(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 OB(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 $B(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 RB(t,e,r,n){const i=$B(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(OB(t,r)){const d=r.enter("codeIndented"),f=r.indentLines(s,zB);return d(),f}const a=r.createTracker(n),l=i.repeat(Math.max(PB(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:`
|
|
303
|
+
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
|
|
304
|
+
`),s&&(u+=a.move(s+`
|
|
305
|
+
`)),u+=a.move(l),h(),u}function zB(t,e,r){return(r?"":" ")+t}function tp(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 WB(t,e,r,n){const i=tp(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?" ":`
|
|
306
|
+
`,...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 qB(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 Uo(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Sl(t,e,r){const n=ys(t),i=ys(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}}hy.peek=HB;function hy(t,e,r,n){const i=qB(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=Sl(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(l=Uo(h)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Sl(n.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Uo(d));const p=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function HB(t,e,r){return r.options.emphasis||"*"}function UB(t,e){let r=!1;return Qd(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,uu}),!!((!t.depth||t.depth<3)&&Hd(t)&&(e.options.setext||r))}function YB(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(UB(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),f=r.containerPhrasing(t,{...s.current(),before:`
|
|
307
|
+
`,after:`
|
|
308
|
+
`});return d(),u(),f+`
|
|
309
|
+
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
310
|
+
`))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let h=r.containerPhrasing(t,{before:"# ",after:`
|
|
311
|
+
`,...s.current()});return/^[\t ]/.test(h)&&(h=Uo(h.charCodeAt(0))+h.slice(1)),h=h?o+" "+h:o,r.options.closeAtx&&(h+=" "+o),l(),a(),h}uy.peek=VB;function uy(t){return t.value||""}function VB(){return"<"}dy.peek=GB;function dy(t,e,r,n){const i=tp(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 GB(){return"!"}py.peek=XB;function py(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 XB(){return"!"}fy.peek=KB;function fy(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 KB(){return"`"}function my(t,e){const r=Hd(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))}gy.peek=QB;function gy(t,e,r,n){const i=tp(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(my(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 QB(t,e,r){return my(t,r)?"<":"["}xy.peek=ZB;function xy(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 ZB(){return"["}function ep(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 JB(t){const e=ep(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 tL(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 yy(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 eL(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?tL(r):ep(r);const a=t.ordered?o==="."?")":".":JB(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),yy(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 rL(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 nL(t,e,r,n){const i=rL(r);let s=r.bulletCurrent||ep(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 iL(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const sL=xc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function oL(t,e,r,n){return(t.children.some(function(o){return sL(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function aL(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}by.peek=lL;function by(t,e,r,n){const i=aL(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=Sl(n.before.charCodeAt(n.before.length-1),h,i);u.inside&&(l=Uo(h)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Sl(n.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Uo(d));const p=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function lL(t,e,r){return r.options.strong||"*"}function cL(t,e,r,n){return r.safe(t.value,n)}function hL(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 uL(t,e,r){const n=(yy(r)+(r.options.ruleSpaces?" ":"")).repeat(hL(r));return r.options.ruleSpaces?n.slice(0,-1):n}const Cy={blockquote:IB,break:pm,code:RB,definition:WB,emphasis:hy,hardBreak:pm,heading:YB,html:uy,image:dy,imageReference:py,inlineCode:fy,link:gy,linkReference:xy,list:eL,listItem:nL,paragraph:iL,root:oL,strong:by,text:cL,thematicBreak:uL};function dL(){return{enter:{table:pL,tableData:fm,tableHeader:fm,tableRow:mL},exit:{codeText:gL,table:fL,tableData:mh,tableHeader:mh,tableRow:mh}}}function pL(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 fL(t){this.exit(t),this.data.inTable=void 0}function mL(t){this.enter({type:"tableRow",children:[]},t)}function mh(t){this.exit(t)}function fm(t){this.enter({type:"tableCell",children:[]},t)}function gL(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,xL));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function xL(t,e){return e==="|"?e:t}function yL(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
312
|
+
`,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(`
|
|
313
|
+
`))}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 AB(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=Cy.inlineCode(p,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function bL(){return{exit:{taskListCheckValueChecked:mm,taskListCheckValueUnchecked:mm,paragraph:kL}}}function CL(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:vL}}}function mm(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function kL(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 vL(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=Cy.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 wL(){return[eB(),vB(),_B(),dL(),bL()]}function SL(t){return{extensions:[rB(),wB(t),jB(),yL(t),CL()]}}const TL={tokenize:LL,partial:!0},ky={tokenize:AL,partial:!0},vy={tokenize:ML,partial:!0},wy={tokenize:IL,partial:!0},_L={tokenize:FL,partial:!0},Sy={name:"wwwAutolink",tokenize:EL,previous:_y},Ty={name:"protocolAutolink",tokenize:BL,previous:jy},wn={name:"emailAutolink",tokenize:NL,previous:Ny},tn={};function jL(){return{text:tn}}let Zn=48;for(;Zn<123;)tn[Zn]=wn,Zn++,Zn===58?Zn=65:Zn===91&&(Zn=97);tn[43]=wn;tn[45]=wn;tn[46]=wn;tn[95]=wn;tn[72]=[wn,Ty];tn[104]=[wn,Ty];tn[87]=[wn,Sy];tn[119]=[wn,Sy];function NL(t,e,r){const n=this;let i,s;return o;function o(d){return!mu(d)||!Ny.call(n,n.previous)||rp(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return mu(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(_L,u,h)(d):d===45||d===95||Ke(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&&nr(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function EL(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!_y.call(n,n.previous)||rp(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(TL,t.attempt(ky,t.attempt(vy,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function BL(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&jy.call(n,n.previous)&&!rp(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(nr(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||kl(d)||ce(d)||gi(d)||fc(d)?r(d):t.attempt(ky,t.attempt(vy,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function LL(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 AL(t,e,r){let n,i,s;return o;function o(h){return h===46||h===95?t.check(wy,l,a)(h):h===null||ce(h)||gi(h)||h!==45&&fc(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 ML(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(wy,e,s)(o):o===null||ce(o)||gi(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function IL(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||ce(a)||gi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||ce(a)||gi(a)?e(a):n(a)}function s(a){return nr(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):nr(a)?(t.consume(a),o):r(a)}}function FL(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ke(s)?r(s):e(s)}}function _y(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ce(t)}function jy(t){return!nr(t)}function Ny(t){return!(t===47||mu(t))}function mu(t){return t===43||t===45||t===46||t===95||Ke(t)}function rp(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 DL={tokenize:HL,partial:!0};function PL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:zL,continuation:{tokenize:WL},exit:qL}},text:{91:{name:"gfmFootnoteCall",tokenize:RL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:OL,resolveTo:$L}}}}function OL(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 $L(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 RL(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||ce(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 ce(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 zL(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||ce(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 ce(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),Gt(t,p,"gfmFootnoteDefinitionWhitespace")):r(m)}function p(m){return e(m)}}function WL(t,e,r){return t.check(la,e,t.attempt(DL,e,r))}function qL(t){t.exit("gfmFootnoteDefinition")}function HL(t,e,r){const n=this;return Gt(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 UL(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&&wr(f,f.length,0,mc(p,o.slice(h+1,l),a)),wr(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),wr(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=ys(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=ys(m);return g._open=!y||y===2&&!!x,g._close=!x||x===2&&!!y,a(m)}}}class YL{constructor(){this.map=[]}add(e,r,n){VL(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 VL(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 GL(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 XL(){return{flow:{null:{name:"table",tokenize:KL,resolveAll:QL}}}}function KL(t,e,r){const n=this;let i=0,s=0,o;return a;function a(j){let I=n.events.length-1;for(;I>-1;){const P=n.events[I][1].type;if(P==="lineEnding"||P==="linePrefix")I--;else break}const z=I>-1?n.events[I][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):_t(j)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),p):r(j):Ut(j)?Gt(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||ce(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,Ut(j)?Gt(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 Ut(j)?Gt(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||_t(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 Ut(j)?Gt(t,w,"whitespace")(j):w(j)}function w(j){return j===124?m(j):j===null||_t(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||_t(j)?(t.exit("tableRow"),e(j)):Ut(j)?Gt(t,N,"whitespace")(j):(t.enter("data"),L(j))}function L(j){return j===null||j===124||ce(j)?(t.exit("data"),N(j)):(t.consume(j),j===92?A:L)}function A(j){return j===92||j===124?(t.consume(j),L):L(j)}}function QL(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 YL;for(;++r<t.length;){const p=t[r],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(gm(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=Aa(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=Aa(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=Aa(f,e,s,i,r,d)):o[1]!==0&&(d=Aa(f,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&gm(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=GL(e.events,r))}return t}function Aa(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Ui(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=Ui(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=Ui(e.events,r[2]),u=Ui(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({},Ui(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function gm(t,e,r,n,i){const s=[],o=Ui(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 Ui(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const ZL={name:"tasklistCheck",tokenize:tA};function JL(){return{text:{91:ZL}}}function tA(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 ce(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 _t(l)?e(l):Ut(l)?t.check({tokenize:eA},e,r)(l):r(l)}}function eA(t,e,r){return Gt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function rA(t){return $0([jL(),PL(),UL(t),XL(),JL()])}const nA={};function np(t){const e=this,r=t||nA,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(rA(r)),s.push(wL()),o.push(SL(r))}const bc=k.createContext({newIds:new Set,changedIds:new Set}),xm=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},iA=(t=>t?xm(t):xm),sA=t=>t;function oA(t,e=sA){const r=Wt.useSyncExternalStore(t.subscribe,Wt.useCallback(()=>e(t.getState()),[t,e]),Wt.useCallback(()=>e(t.getInitialState()),[t,e]));return Wt.useDebugValue(r),r}const ym=t=>{const e=iA(t),r=n=>oA(e,n);return Object.assign(r,e),r},ip=(t=>t?ym(t):ym),ro=new Map;function aA(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:L,setIterationStates:A,setFeatureTimeline:j,EMPTY_CHANGES:I,appendDecisionEvent:z,setDecisionEventsSnapshot:W,setStatusSnapshot:P,clearStatusSnapshots:M}=r,F=j?B=>{j(T=>T.some(V=>V.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,V=new Set,et=new Set;for(const D of B){const G=T.get(D.id);G?(G.status!==D.status||G.confidence!==D.confidence||G.title!==D.title)&&et.add(D.id):V.add(D.id)}(V.size>0||et.size>0)&&(m({newIds:V,changedIds:et}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(I),800))}n.current=new Map(B.map(T=>[T.id,T])),u(B),d(t.connections||[]),f(t.gates||[]),L&&L(t.sessions||[]),W&&Array.isArray(t.decisionEventsSnapshot)&&W(t.decisionEventsSnapshot),M&&M()}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}),F&&F({id:`session-start-${t.sessionId}`,timestamp:t.timestamp,category:"session",title:"Session started",detail:t.source?`Source: ${t.source}`:null,severity:"info",sessionId:t.sessionId,meta:{source:t.source}});else if(t.type==="sessionEnd")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),F&&F({id:`session-end-${t.sessionId||Date.now()}`,timestamp:t.timestamp,category:"session",title:`Session ended (${t.toolCount??0} tools)`,detail:null,severity:"info",sessionId:t.sessionId||null,meta:{toolCount:t.toolCount,duration:t.duration}});else if(t.type==="sessionSummary")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),F&&F({id:`error-${t.timestamp}-${Math.random().toString(36).slice(2,6)}`,timestamp:t.timestamp||new Date().toISOString(),category:"error",title:t.message||`${t.errorType} error`,detail:t.tool?`Tool: ${t.tool}`:null,severity:t.severity==="error"?"error":"warning",sessionId:null,meta:{type:t.errorType,tool:t.tool}});else if(t.type==="gateCreated"||t.type==="gatePending")p({type:"pending",gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}),F&&F({id:`gate-created-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:t.fromPhase&&t.toPhase?`Gate: ${t.fromPhase} → ${t.toPhase}`:"Gate created",detail:null,severity:"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}});else if(t.type==="gateResolved"){if(f(V=>V.map(et=>et.id===t.gateId?{...et,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:et)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const V=t.itemId??(($=s.current.find(et=>et.id===t.gateId))==null?void 0:$.itemId)??t.gateId;p({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:V})}const B=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,T={approve:"success",revise:"warning",kill:"error"};F&&F({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 V=[...B,{tool:"iteration",category:t.loopType||"iteration",detail:T,items:[],timestamp:t.timestamp}];return V.length>20?V.slice(-20):V}),t.type==="iterationStarted")ro.has(t.loopId)&&(clearTimeout(ro.get(t.loopId)),ro.delete(t.loopId)),A(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")A(B=>{const T=B.get(t.loopId);if(!T)return B;const V=new Map(B);return V.set(t.loopId,{...T,count:t.count,maxIterations:t.maxIterations}),V});else if(t.type==="iterationComplete"){A(T=>{const V=T.get(t.loopId);if(!V)return T;const et=new Map(T);return et.set(t.loopId,{...V,status:"complete",outcome:t.outcome,count:t.finalCount??V.count}),et});const B=setTimeout(()=>{A(T=>{const V=new Map(T);return V.delete(t.loopId),V}),ro.delete(t.loopId)},5e3);ro.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 V=[...T,{errorType:"iteration_limit",severity:"warning",message:B[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return V.length>10?V.slice(-10):V}),C(T=>T!=null&&T.active?{...T,errorCount:(T.errorCount||0)+1}:T)}if(F&&(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)`;F({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")F&&F({id:`lifecycle-started-${t.itemId}`,timestamp:t.timestamp,category:"phase",title:`Lifecycle started: ${t.phase}`,detail:t.featureCode?`Feature: ${t.featureCode}`:null,severity:"success",sessionId:null,meta:{itemId:t.itemId,phase:t.phase,featureCode:t.featureCode}});else if(t.type==="lifecycleTransition"){const B=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",T=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";F&&F({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${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 V=T.lifecycle?{...T.lifecycle}:{};return V.lifecycle_ext={...V.lifecycle_ext||{},open_loops:t.loops},{...T,lifecycle:V}}));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 V=T.lifecycle?{...T.lifecycle}:{};return V.lifecycle_ext={...V.lifecycle_ext||{},drift_axes:t.drift_axes},{...T,lifecycle:V}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:B,itemId:T,...V}=t;u(et=>et.map(D=>{if(D.id!==T)return D;const G=D.lifecycle?{...D.lifecycle}:{};return G.lifecycle_ext={...G.lifecycle_ext||{},branch_lineage:V},{...D,lifecycle:G}}))}}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():{},V=B?B():{},et=h.current;et&&et.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...T,dom:V,timestamp:new Date().toISOString()}}))}}function lA(){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 be={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},bm={newIds:new Set,changedIds:new Set},mr=ip((t,e)=>{async function r(o,a){const l=await Nt(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}),Nt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),Nt("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),Nt("/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);aA(a,{prevItemMapRef:{get current(){return be.prevItemMap},set current(l){be.prevItemMap=l}},snapshotProviderRef:{get current(){return be.snapshotProvider},set current(l){be.snapshotProvider=l}},gatesRef:{get current(){return be.gates},set current(l){be.gates=l}},pendingResolveIdsRef:{get current(){return be.pendingResolveIds},set current(l){be.pendingResolveIds=l}},changeTimerRef:{get current(){return be.changeTimer},set current(l){be.changeTimer=l}},sessionEndTimerRef:{get current(){return be.sessionEndTimer},set current(l){be.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=be.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:lA},{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 be.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:bm})}catch{}}function s(){if(be.disposed||be.ws)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/vision`;be.ws=xS({url:a,onOpen:n,onMessage:i,onClose:()=>t({connected:!1})})}return Nt("/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")),be.buildPollInterval=setInterval(()=>{Nt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),be.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:bm,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=>{be.snapshotProvider=o},setActiveBuild:o=>t({activeBuild:o}),setBuildHistory:o=>t({buildHistory:Array.isArray(o)?o:[]}),fetchBuildHistory:async()=>{try{const a=await(await Nt("/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)=>{be.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&&be.pendingResolveIds.delete(o),h}catch{return be.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}:{})})}}),cA=kS("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 gr({className:t,variant:e,...r}){return c.jsx("div",{className:st(cA({variant:e}),t),...r})}var hA=k.createContext(void 0);function uA(t){const e=k.useContext(hA);return t||e||"ltr"}function dA(t,[e,r]){return Math.min(r,Math.max(e,t))}function pA(t,e){return k.useReducer((r,n)=>e[r][n]??r,t)}var sp="ScrollArea",[Ey]=vS(sp),[fA,Lr]=Ey(sp),By=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,L]=k.useState(!1),A=Es(e,I=>l(I)),j=uA(i);return c.jsx(fA,{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:L,onCornerWidthChange:C,onCornerHeightChange:w,children:c.jsx(Bs.div,{dir:j,...o,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":b+"px",...t.style}})})});By.displayName=sp;var Ly="ScrollAreaViewport",Ay=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Lr(Ly,r),a=k.useRef(null),l=Es(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(Bs.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})})]})});Ay.displayName=Ly;var en="ScrollAreaScrollbar",op=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Lr(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(mA,{...n,ref:e,forceMount:r}):i.type==="scroll"?c.jsx(gA,{...n,ref:e,forceMount:r}):i.type==="auto"?c.jsx(My,{...n,ref:e,forceMount:r}):i.type==="always"?c.jsx(ap,{...n,ref:e,"data-state":"visible"}):null});op.displayName=en;var mA=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Lr(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(uc,{present:r||s,children:c.jsx(My,{"data-state":s?"visible":"hidden",...n,ref:e})})}),gA=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Lr(en,t.__scopeScrollArea),s=t.orientation==="horizontal",o=kc(()=>l("SCROLL_END"),100),[a,l]=pA("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(uc,{present:r||a!=="hidden",children:c.jsx(ap,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:hi(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:hi(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),My=k.forwardRef((t,e)=>{const r=Lr(en,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=k.useState(!1),a=t.orientation==="horizontal",l=kc(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?h:u)}},10);return bs(r.viewport,l),bs(r.content,l),c.jsx(uc,{present:n||s,children:c.jsx(ap,{"data-state":s?"visible":"hidden",...i,ref:e})})}),ap=k.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Lr(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=Oy(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 vA(f,o.current,a,p)}return r==="horizontal"?c.jsx(xA,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollLeft,p=Cm(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(yA,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const f=i.viewport.scrollTop,p=Cm(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}),xA=k.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Lr(en,t.__scopeScrollArea),[o,a]=k.useState(),l=k.useRef(null),h=Es(e,l,s.onScrollbarXChange);return k.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Fy,{"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":Cc(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),Ry(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:_l(o.paddingLeft),paddingEnd:_l(o.paddingRight)}})}})}),yA=k.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Lr(en,t.__scopeScrollArea),[o,a]=k.useState(),l=k.useRef(null),h=Es(e,l,s.onScrollbarYChange);return k.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(Fy,{"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":Cc(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),Ry(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:_l(o.paddingTop),paddingEnd:_l(o.paddingBottom)}})}})}),[bA,Iy]=Ey(en),Fy=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=Lr(en,r),[m,x]=k.useState(null),g=Es(e,A=>x(A)),y=k.useRef(null),C=k.useRef(""),b=p.viewport,w=n.content-n.viewport,_=si(u),S=si(l),N=kc(d,10);function L(A){if(y.current){const j=A.clientX-y.current.left,I=A.clientY-y.current.top;h({x:j,y:I})}}return k.useEffect(()=>{const A=j=>{const I=j.target;(m==null?void 0:m.contains(I))&&_(j,w)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[b,m,w,_]),k.useEffect(S,[n,S]),bs(m,N),bs(p.content,N),c.jsx(bA,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:si(s),onThumbPointerUp:si(o),onThumbPositionChange:S,onThumbPointerDown:si(a),children:c.jsx(Bs.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:hi(t.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),y.current=m.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),L(A))}),onPointerMove:hi(t.onPointerMove,L),onPointerUp:hi(t.onPointerUp,A=>{const j=A.target;j.hasPointerCapture(A.pointerId)&&j.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=C.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Tl="ScrollAreaThumb",Dy=k.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Iy(Tl,t.__scopeScrollArea);return c.jsx(uc,{present:r||i.hasThumb,children:c.jsx(CA,{ref:e,...n})})}),CA=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Lr(Tl,r),o=Iy(Tl,r),{onThumbPositionChange:a}=o,l=Es(e,d=>o.onThumbChange(d)),h=k.useRef(void 0),u=kc(()=>{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=wA(d,a);h.current=p,a()}};return a(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[s.viewport,u,a]),c.jsx(Bs.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:hi(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:hi(t.onPointerUp,o.onThumbPointerUp)})});Dy.displayName=Tl;var lp="ScrollAreaCorner",Py=k.forwardRef((t,e)=>{const r=Lr(lp,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?c.jsx(kA,{...t,ref:e}):null});Py.displayName=lp;var kA=k.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Lr(lp,r),[s,o]=k.useState(0),[a,l]=k.useState(0),h=!!(s&&a);return bs(i.scrollbarX,()=>{var d;const u=((d=i.scrollbarX)==null?void 0:d.offsetHeight)||0;i.onCornerHeightChange(u),l(u)}),bs(i.scrollbarY,()=>{var d;const u=((d=i.scrollbarY)==null?void 0:d.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),h?c.jsx(Bs.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 _l(t){return t?parseInt(t,10):0}function Oy(t,e){const r=t/e;return isNaN(r)?0:r}function Cc(t){const e=Oy(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function vA(t,e,r,n="ltr"){const i=Cc(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 $y([l,h],d)(t)}function Cm(t,e,r="ltr"){const n=Cc(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=dA(t,l);return $y([0,o],[0,a])(h)}function $y(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 Ry(t,e){return t>0&&t<e}var wA=(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 kc(t,e){const r=si(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 bs(t,e){const r=si(e);wS(()=>{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 zy=By,SA=Ay,TA=Py;const Wn=k.forwardRef(({className:t,children:e,...r},n)=>c.jsxs(zy,{ref:n,className:st("relative overflow-hidden",t),...r,children:[c.jsx(SA,{className:"h-full w-full rounded-[inherit]",children:e}),c.jsx(Wy,{}),c.jsx(TA,{})]}));Wn.displayName=zy.displayName;const Wy=k.forwardRef(({className:t,orientation:e="vertical",...r},n)=>c.jsx(op,{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(Dy,{className:"relative flex-1 rounded-full bg-border"})}));Wy.displayName=op.displayName;var _A="Separator",km="horizontal",jA=["horizontal","vertical"],qy=k.forwardRef((t,e)=>{const{decorative:r,orientation:n=km,...i}=t,s=NA(n)?n:km,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return c.jsx(Bs.div,{"data-orientation":s,...a,...i,ref:e})});qy.displayName=_A;function NA(t){return jA.includes(t)}var Hy=qy;const jl=k.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>c.jsx(Hy,{ref:i,decorative:r,orientation:e,className:st("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));jl.displayName=Hy.displayName;function EA({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 Nt(`/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 BA=Wt.memo(EA);function LA(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 AA({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:LA(n.timestamp)})]},n.id||i)})})]})}const MA=Wt.memo(AA),IA={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},vm={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function gh(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 FA=Wt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Wt.useState(0);Wt.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 DA({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,C;const[a,l]=Wt.useState(null),[h,u]=Wt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Wt.useState(0),[f,p]=Wt.useState([]),m=Wt.useRef(null);return Wt.useEffect(()=>{const b=w=>u(w.detail);return window.addEventListener("compose:agent-status",b),()=>window.removeEventListener("compose:agent-status",b)},[]),Wt.useEffect(()=>{if(h.status!=="working")return;const b=setInterval(()=>d(w=>w+1),1e3);return()=>clearInterval(b)},[h.status]),Wt.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]),Wt.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(BA,{agentId:a,status:(x=i.find(b=>b.agentId===a))==null?void 0:x.status}),c.jsx(MA,{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(FA,{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"?IA[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:gh(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"} — ${gh(b.duration)}`,style:{width:Math.max(4,Math.min(16,(b.duration||0)/1e3*2)),background:vf[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:vf[b.category]},children:b.category}),b.error?c.jsx("span",{className:"truncate",title:b.error.type,children:vm[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:vm[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:gh(Date.now()-new Date(b.startedAt).getTime())})]},b.agentId))]})]})})]})]})}const PA=Wt.memo(DA),Mo={DECISION:1,PENDING_GATE:2,BLOCKED:3};function Uy(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,Mo.BLOCKED,"Blocked"),r.has(s.id)&&i(s,Mo.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,Mo.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function OA(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 Yy(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=Uy(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function $A(t,e){return t&&t===e?null:e}const RA={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"}},zA={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function cp({status:t,className:e}){const r=RA[t]||zA,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 WA={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"},qA="text-slate-400 bg-slate-500/10 border-slate-500/20";function HA({phase:t,className:e}){const r=WA[t]||qA;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 Bn(t,e={}){const r=await Nt(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let xh=null;function Vy(t){if(xh)return;const e=window.location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${e}//${window.location.host}/ws/vision`);xh=r,r.onmessage=n=>{try{const i=JSON.parse(n.data);i.type==="ideaboxUpdated"&&t(i)}catch{}},r.onclose=()=>{xh=null,setTimeout(()=>{Vy(t)},3e3)},r.onerror=()=>{}}const Cs=ip((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{Vy(()=>{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 Bn("/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 Bn("/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 Bn(`/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 Bn(`/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 Bn(`/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 Bn(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await Bn(`/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 Bn(`/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 UA({activeBuild:t}){const e=OA(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(yl,{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 YA({items:t,gates:e,onSelectItem:r}){const n=Wt.useMemo(()=>Uy(t,e),[t,e]),[i,s]=Wt.useState(!1);if(n.length===0)return null;const o=i?n:n.slice(0,5),a=n.length-5,l=h=>h===Mo.BLOCKED?c.jsx(pc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):h===Mo.PENDING_GATE?c.jsx($T,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):c.jsx(FS,{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"}),o.map(({item:h,priority:u,reason:d})=>c.jsxs("button",{onClick:()=>r==null?void 0:r(h.id),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:d,children:[l(u),c.jsx("span",{className:"truncate flex-1 text-left",children:h.title}),h.phase&&c.jsx(HA,{phase:h.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),c.jsx(cp,{status:h.status,className:"shrink-0"})]},h.id)),a>0&&c.jsx("button",{onClick:()=>s(h=>!h),className:"flex w-full items-center px-2 py-0.5 text-[10px] rounded-md hover:bg-sidebar-accent/50 transition-colors",style:{color:"hsl(var(--muted-foreground))"},children:i?"Show less":`+${a} more`})]})}function VA({items:t,gates:e}){const r=Wt.useMemo(()=>Yy(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 GA=new Set(["planned","ready","in_progress","review","blocked","parked"]);function XA({items:t,hiddenGroups:e,onToggleGroup:r}){const n=Wt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!GA.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 KA({onViewChange:t}){const e=Cs(n=>n.ideas),r=Wt.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(mi,{className:"h-3 w-3 shrink-0 text-amber-400"}),c.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function Gy({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:L,widthPx:A}){const j=t||[],I=e||[],z=Wt.useMemo(()=>Yy(j,I),[j,I]),[W,P]=Wt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Wt.useEffect(()=>{if(typeof document>"u")return;const F=new MutationObserver(()=>{P(document.documentElement.classList.contains("dark"))});return F.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>F.disconnect()},[]);const M=Wt.useCallback(()=>{const F=!W,O=F?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",F);try{localStorage.setItem("compose:theme",O)}catch{}N&&N({ui:{theme:O}})},[W,N]);return Wt.useCallback(F=>{s&&s($A(i,F))},[s,i]),c.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:A??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"}),L&&c.jsxs("button",{onClick:L,className:"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-xs text-muted-foreground hover:text-foreground bg-sidebar-accent/50 hover:bg-sidebar-accent transition-colors",title:"New item (⌘N)",children:[c.jsx(xl,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"New"})]}),c.jsx("button",{onClick:M,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(UT,{className:"h-3.5 w-3.5"}):c.jsx(wT,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(VA,{items:j,gates:I})]}),c.jsx(UA,{activeBuild:r}),c.jsx(PA,{agentActivity:g,agentErrors:y,sessionState:w,onSelectItem:_,onStopAgent:S,spawnedAgents:C,agentRelays:b}),z.attentionCount>0&&c.jsxs(c.Fragment,{children:[c.jsx(jl,{className:"bg-sidebar-border"}),c.jsx(YA,{items:j,gates:I,onSelectItem:_,onViewChange:n})]}),c.jsx(KA,{onViewChange:n}),c.jsx("div",{className:"px-3 pb-2",children:c.jsxs("div",{className:"relative",children:[c.jsx(vn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(jd,{placeholder:"Search...",value:p,onChange:F=>m(F.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),c.jsx(jl,{className:"bg-sidebar-border"}),c.jsx(Wn,{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(XA,{items:j,hiddenGroups:d,onToggleGroup:f})]})})]})}function QA({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 ha({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 vc({icon:t=hT,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(Dt,{variant:"outline",size:"sm",onClick:i,children:n})]})}const wm=[{key:"all",label:"All",statuses:null},{key:"active",label:"Active",statuses:["planned","ready","in_progress","review"]},{key:"done",label:"Done",statuses:["complete"]},{key:"blocked",label:"Blocked",statuses:["blocked","parked"]}],ZA=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function Sm({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 Xy({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=xr[t.type]||xr.task,d=zn[t.status]||zn.planned,{newIds:f,changedIds:p}=k.useContext(bc),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(Ls,{className:"h-3.5 w-3.5"}):c.jsx(fi,{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(QA,{level:t.confidence||0}),t.phase&&c.jsx(gr,{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(Xy,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function Ky({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(L=>{const A=new Set(L);return A.has(N)?A.delete(N):A.add(N),A})},[]),b=k.useMemo(()=>{let N=t;const L=wm.find(A=>A.key===m);if(L!=null&&L.statuses&&(N=N.filter(A=>L.statuses.includes(A.status||"planned"))),g!=="all"&&(N=N.filter(A=>A.type===g)),f){const A=f.toLowerCase();N=N.filter(j=>(j.title||"").toLowerCase().includes(A)||(j.description||"").toLowerCase().includes(A)||(j.type||"").toLowerCase().includes(A)||(j.phase||"").toLowerCase().includes(A))}return l&&a&&(N=N.filter(A=>{var j;return A.featureCode===a||((j=A.lifecycle)==null?void 0:j.featureCode)===a||(A.title||"").includes(a)})),N},[t,f,m,g,l,a]),w=k.useMemo(()=>{const N=new Set(b.map(z=>z.id)),L=new Map;for(const z of b)L.set(z.id,{...z,_children:[]});const A=new Map;for(const z of e)!N.has(z.fromId)||!N.has(z.toId)||(z.type==="informs"?A.has(z.toId)||A.set(z.toId,z.fromId):(z.type==="supports"||z.type==="blocks")&&(A.has(z.fromId)||A.set(z.fromId,z.toId)));for(const z of t)z.parentId&&L.has(z.parentId)&&A.set(z.id,z.parentId);for(const[z]of A){const W=new Set;let P=z;for(;P&&A.has(P);){if(W.has(P)){A.delete(P);break}W.add(P),P=A.get(P)}}const j=[];for(const z of L.values()){const W=A.get(z.id);W&&L.has(W)?L.get(W)._children.push(z):j.push(z)}const I=z=>{z.sort((W,P)=>(W.confidence||0)-(P.confidence||0));for(const W of z)W._children.length>0&&I(W._children)};return I(j),j},[b,e]);Wt.useEffect(()=>{if(f){const N=new Set,L=A=>{for(const j of A)j._children.length>0&&(N.add(j.id),L(j._children))};L(w),d(N)}else u.size===0&&w.length>0&&d(new Set(w.map(N=>N.id)))},[w,f]),Wt.useEffect(()=>{if(!r||w.length===0)return;const N=[],L=(A,j)=>{for(const I of A){if(I.id===j)return!0;if(I._children.length>0&&L(I._children,j))return N.push(I.id),!0}return!1};L(w,r),N.length>0&&d(A=>{const j=new Set(A);for(const I of N)j.add(I);return j}),requestAnimationFrame(()=>{const A=document.querySelector(`[data-item-id="${r}"]`);A&&A.scrollIntoView({block:"center",behavior:"smooth"})})},[r,w]);const _=k.useCallback(()=>{const N=new Set,L=A=>{for(const j of A)j._children.length>0&&(N.add(j.id),L(j._children))};L(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(ha,{featureCode:a,active:l,onToggle:h}),c.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[c.jsx(vn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(jd,{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(kn,{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:"}),wm.map(N=>c.jsx(Sm,{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:"}),ZA.map(N=>c.jsx(Sm,{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(xl,{className:"h-3.5 w-3.5"})})]}),c.jsx(Wn,{className:"flex-1",children:c.jsx("div",{className:"py-1",children:w.length===0?o?c.jsx(vc,{icon:xl,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(Xy,{item:N,children:N._children,depth:0,selectedItemId:r,onSelect:n,onToggle:C,expandedIds:u},N.id))})})]})}try{sa.use(i0)}catch{}try{sa.use(jS)}catch{}const Nl={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},JA=Object.fromEntries(Object.entries(xr).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("")}`]})),t3=[1,1.5,2,2.5,3],gu={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"}},Tm=[{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 Co(t){return t.group||"other"}const _m=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,yh=24;function e3(t){if(!t||t.length<=yh)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>yh-1)break;r=i}return(r||t.slice(0,yh-1))+"…"}function r3(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&_m.test(e))return e;if(t.id&&_m.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?e3(t.slug):t.id?t.id.slice(0,12):"item"}function jm(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(`
|
|
314
|
+
`)}function n3(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=>Co(f)).filter(Boolean))].map(f=>{const p=t.filter(y=>Co(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=>Co(g)===f&&a.has(g.id));s.push({data:{id:`group-${f}`,label:`${jm(f)}
|
|
315
|
+
(${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=jm(r3(u),14),p=Co(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=gu[u.type]||gu.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 i3(){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(Nl).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(JA).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...t3.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 s3({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=Nl[n.status]||Nl.planned,s=xr[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(bh,{color:i,children:(n.status||"planned").replace("_"," ")}),c.jsx(bh,{color:s,children:n.itemType}),n.phase&&c.jsx(bh,{color:"#94a3b8",children:bl[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:[Pd[n.confidence||0]," confidence"]})]})}function o3({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 bh({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 Qy={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function no({active:t,onClick:e,children:r}){return c.jsx("button",{onClick:e,style:{...Qy,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function io({onClick:t,children:e,title:r}){return c.jsx("button",{onClick:t,title:r,style:{...Qy,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function so(){return c.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const a3=["build-building","build-gate-pending","build-blocked-downstream","build-error"],l3={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 c3({badge:t,onClick:e}){const r=l3[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 h3({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 Zy({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,L]=k.useState(null),[A,j]=k.useState("active"),[I,z]=k.useState(!0),[W,P]=k.useState(!1),[M,F]=k.useState(null),[O,$]=k.useState(null),[B,T]=k.useState([]),[V,et]=k.useState(!1),[D,G]=k.useState(!1),ht=Cs(q=>q.ideas);k.useEffect(()=>{let q=!1;return Nt("/api/graph/layout").then(Z=>Z.ok?Z.json():{positions:{}}).then(Z=>{if(q)return;b.current=Z.positions||{},w.current=!0;const H=C.current;H&&Ht(H)}).catch(()=>{w.current=!0}),()=>{q=!0}},[]);const xt=k.useCallback(()=>{const q=_.current;_.current={},S.current=null,Object.keys(q).length&&Nt("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:q})}).catch(Z=>console.warn("[graph-layout] save failed:",Z))},[]),$t=k.useCallback(q=>{Object.assign(_.current,q),Object.assign(b.current,q),S.current&&clearTimeout(S.current),S.current=setTimeout(xt,500)},[xt]),Ht=k.useCallback(q=>{const Z=b.current,H={};q.nodes("node[status]").forEach(rt=>{const at=rt.data();if(at.isAgentNode||at.isIdeaNode)return;const pt=rt.id(),Tt=Z[pt];if(Tt&&Number.isFinite(Tt.x)&&Number.isFinite(Tt.y))rt.position({x:Tt.x,y:Tt.y});else{const te=rt.position();Number.isFinite(te.x)&&Number.isFinite(te.y)&&(H[pt]={x:te.x,y:te.y})}}),Object.keys(H).length&&$t(H)},[$t]),ct=k.useRef(!1);k.useEffect(()=>{const q=d==null?void 0:d.some(Z=>Z.status==="running");q&&!ct.current?et(!0):!q&&ct.current&&(d==null?void 0:d.length)>0&&et(!1),ct.current=!!q},[d]);const X=k.useMemo(()=>t.filter(q=>{const Z=q.title||"";return!Z.startsWith("`docs/")&&!Z.startsWith("docs/")}),[t]),it=k.useMemo(()=>{let q=X;const Z=Tm.find(H=>H.key===A);if(Z!=null&&Z.statuses&&(q=q.filter(H=>Z.statuses.includes(H.status||"planned"))),o){const H=rt=>{const at=(rt.description||"").match(/Track:\s*(\w+)/i);return at?at[1].toLowerCase():rt.type||"other"};q=q.filter(rt=>o.has(H(rt)))}return(a==null?void 0:a.size)>0&&(q=q.filter(H=>!a.has(Co(H)))),q},[X,A,o,a]),vt=k.useMemo(()=>{const q=new Set(it.map(Z=>Z.id));return e.filter(Z=>q.has(Z.fromId)&&q.has(Z.toId))},[e,it]),gt=k.useMemo(()=>!p||!p.nodes.length?[]:[...p.nodes,...p.edges],[d]),Jt=k.useMemo(()=>{if(!D)return[];new Set(it.map(Z=>Z.id));const q=[];for(const Z of ht){if(!Z.mapsTo)continue;const H=`idea-${Z.id}`;q.push({data:{id:H,label:`${Z.id}
|
|
316
|
+
${Z.title.slice(0,20)}${Z.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:Z.id},classes:"idea-node"});const rt=Z.mapsTo.split(",").map(at=>at.trim()).filter(Boolean);for(const at of rt){const pt=it.find(Tt=>{var te;return((te=Tt.lifecycle)==null?void 0:te.featureCode)===at||Tt.featureCode===at||(Tt.title||"").startsWith(at)});pt&&q.push({data:{id:`idea-edge-${Z.id}-${pt.id}`,source:H,target:pt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return q},[D,ht,it]),Pt=k.useMemo(()=>{let Z=n3(it,vt,I,x,m);return V&>.length>0&&(Z=[...Z,...gt]),D&&Jt.length>0&&(Z=[...Z,...Jt]),Z},[it,vt,I,V,gt,D,Jt,x,m]),Xt=k.useMemo(()=>i3(),[]);k.useEffect(()=>{if(!y.current)return;C.current&&(C.current.destroy(),C.current=null);const q=sa({container:y.current,elements:Pt,style:Xt,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=q,q.one("layoutstop",()=>{w.current&&Ht(q),q.fit(void 0,30)}),q.fit(void 0,30),q.on("dragfree","node[status]",Z=>{const H=Z.target,rt=H.data();if(rt.isAgentNode||rt.isIdeaNode)return;const at=H.position();!Number.isFinite(at.x)||!Number.isFinite(at.y)||$t({[H.id()]:{x:at.x,y:at.y}})}),r){const Z=q.$id(r);Z.length&&Ch(q,Z)}return q.on("mouseover","node[status]",Z=>{const H=Z.renderedPosition||Z.position,rt=q.container().getBoundingClientRect();L({x:rt.left+H.x,y:rt.top+H.y,item:Z.target.data()})}),q.on("mousemove","node[status]",Z=>{const H=Z.renderedPosition||Z.position,rt=q.container().getBoundingClientRect();L(at=>at?{x:rt.left+H.x,y:rt.top+H.y,item:at.item}:null)}),q.on("mouseout","node[status]",()=>L(null)),q.on("tap","node[status]",Z=>{je.current=!0,Ch(q,Z.target),n(Z.target.id())}),q.on("tap",Z=>{Z.target===q&&q.elements().removeClass("dimmed highlighted")}),q.on("cxttap","node[status]",Z=>{var pt;const H=Z.target.data();if(H.isAgentNode||H.isIdeaNode||H.isGroup)return;try{(pt=Z.originalEvent)==null||pt.preventDefault()}catch{}const rt=Z.renderedPosition||Z.position,at=q.container().getBoundingClientRect();$({x:at.left+rt.x,y:at.top+rt.y,itemId:Z.target.id(),currentGroup:H.group||""}),L(null)}),q.container().addEventListener("contextmenu",Z=>Z.preventDefault()),()=>{S.current&&(clearTimeout(S.current),xt()),q.destroy(),C.current=null}},[Pt,Xt]);const je=k.useRef(!1);k.useEffect(()=>{const q=C.current;if(!q||!r)return;const Z=q.$id(r);Z.length&&(q.elements().removeClass("dimmed highlighted"),Ch(q,Z),je.current||q.animate({center:{eles:Z},duration:200}),je.current=!1)},[r]),k.useEffect(()=>{const q=C.current;if(q&&(q.nodes().removeClass(a3.join(" ")),!(!l||Object.keys(l).length===0)))for(const[Z,H]of Object.entries(l)){const rt=`build-${H.replace(/_/g,"-")}`,at=q.nodes().filter(pt=>{const Tt=pt.data();return Tt.slug===Z||Tt.title===Z||Tt.featureCode===Z});at.length&&at.addClass(rt)}},[l]),k.useEffect(()=>{const q=C.current;if(!q||!l||!Object.values(l).includes("building"))return;let H=!0;const rt=setInterval(()=>{const at=q.nodes(".build-building");at.length&&(H=!H,at.style("shadow-blur",H?12:4),at.style("shadow-opacity",H?.6:.2))},800);return()=>clearInterval(rt)},[l]),k.useEffect(()=>{var at;const q=C.current;if(!q||(q.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!V||!((at=p==null?void 0:p.activeEdgeIds)!=null&&at.size)))return;const Z=new Set((d||[]).map(pt=>pt.agentId)),H=pt=>pt==="session"?"agent-session":Z.has(pt)?`agent-${pt}`:"agent-session";for(const pt of p.activeEdgeIds){const Tt=q.getElementById(pt);if(Tt.length){const te=f==null?void 0:f.findLast(ge=>{const Ne=H(ge.fromAgentId),qe=H(ge.toAgentId);return(ge.direction==="dispatch"?`relay-${Ne}-${qe}`:`relay-${qe}-${Ne}`)===pt});Tt.addClass((te==null?void 0:te.direction)==="result"?"relay-result":"relay-active")}}const rt=setInterval(()=>{const pt=q.edges(".relay-active, .relay-result");if(!pt.length)return;const Tt=Date.now()/20%100;pt.style("line-dash-offset",-Tt)},50);return()=>clearInterval(rt)},[V,p==null?void 0:p.activeEdgeIds,f]);const Kt=k.useCallback(()=>{const q=C.current;if(!q||!l||Object.keys(l).length===0){T([]);return}const Z=[];for(const[H,rt]of Object.entries(l)){if(rt!=="gate_pending"&&rt!=="error"&&rt!=="building")continue;const at=q.nodes().filter(te=>{const ge=te.data();return ge.slug===H||ge.title===H||ge.featureCode===H});if(!at.length)continue;const pt=at.renderedPosition(),Tt=at.renderedOuterWidth();Z.push({featureCode:H,state:rt,x:pt.x+Tt/2-6,y:pt.y-at.renderedOuterHeight()/2-6,nodeId:at.id()})}T(Z)},[l]);k.useEffect(()=>{const q=C.current;if(q)return q.on("render pan zoom",Kt),Kt(),()=>{q.removeListener("render pan zoom",Kt)}},[Kt]);const br=k.useCallback(()=>{var q;return(q=C.current)==null?void 0:q.fit(void 0,40)},[]),ue=k.useCallback(()=>{const q=C.current;q&&q.zoom({level:q.zoom()*1.3,renderedPosition:{x:q.width()/2,y:q.height()/2}})},[]),Pe=k.useCallback(()=>{const q=C.current;q&&q.zoom({level:q.zoom()/1.3,renderedPosition:{x:q.width()/2,y:q.height()/2}})},[]),We=k.useCallback(()=>{window.open("/api/export/roadmap-graph","_blank","noopener")},[]),de=k.useCallback(async()=>{try{const q=await Nt("/api/export/roadmap-graph/save",{method:"POST",headers:Pn({"Content-Type":"application/json"})}),Z=await q.json().catch(()=>({}));q.ok&&Z.ok?oe(`Saved ${Z.path}`,"info"):oe(Z.error||`Export save failed (HTTP ${q.status})`,"error")}catch(q){oe(`Export save failed: ${q.message}`,"error")}},[]);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(ha,{featureCode:m,active:x,onToggle:g}),m&&c.jsx(so,{}),c.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),Tm.map(q=>c.jsx(no,{active:A===q.key,onClick:()=>j(q.key),children:q.label},q.key)),c.jsx(so,{}),c.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[it.length," items · ",vt.length," edges"]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(no,{active:I,onClick:()=>z(!I),children:"Group"}),c.jsx(no,{active:V,onClick:()=>et(q=>!q),title:"Show/hide agent topology",children:"Agents"}),c.jsx(no,{active:D,onClick:()=>G(q=>!q),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),c.jsx(so,{}),c.jsx(io,{onClick:Pe,title:"Zoom out",children:"−"}),c.jsx(io,{onClick:br,title:"Fit to view",children:"Fit"}),c.jsx(io,{onClick:ue,title:"Zoom in",children:"+"}),c.jsx(so,{}),c.jsx(io,{onClick:We,title:"Open roadmap graph HTML export in a new tab",children:"Export"}),c.jsx(io,{onClick:de,title:"Save roadmap graph export to docs/roadmap-graph.html",children:"Save HTML"}),c.jsx(so,{}),c.jsx(no,{active:W,onClick:()=>P(!W),children:"Legend"})]})]})}),it.length===0&&!V?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(kh,{title:"Types",children:Object.entries(xr).map(([q,Z])=>c.jsxs(wh,{children:[c.jsx(Nm,{color:Z}),q]},q))}),c.jsx(vh,{}),c.jsx(kh,{title:"Status",children:Object.entries(Nl).map(([q,Z])=>c.jsxs(wh,{children:[c.jsx(Nm,{color:Z}),q.replace("_"," ")]},q))}),c.jsx(vh,{}),c.jsx(kh,{title:"Edges",children:Object.entries(gu).map(([q,Z])=>c.jsxs(wh,{children:[c.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:c.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:Z.color,strokeWidth:"1.5",strokeDasharray:Z.style==="dashed"?"6,3":"none"})}),q]},q))}),c.jsx(vh,{}),c.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",c.jsx("br",{}),"Click node to trace deps"]})]}),c.jsx(s3,{data:N}),O&&c.jsx(o3,{data:O,onClose:()=>$(null),onApply:q=>{const Z=O.itemId;$(null),Nt(`/api/vision/items/${Z}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:q||null})}).catch(H=>console.warn("[graph] group update failed:",H))}}),B.map(q=>c.jsx(c3,{badge:q,onClick:q.state==="gate_pending"?()=>F(M===q.featureCode?null:q.featureCode):q.state==="error"?()=>n(q.nodeId):void 0},q.featureCode)),M&&c.jsx(h3,{featureCode:M,gates:u,items:t,badgePositions:B,onResolve:(q,Z)=>{h&&h(q,Z),F(null)},onClose:()=>F(null)})]})]})}function Ch(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 kh({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 vh(){return c.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function wh({children:t}){return c.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function Nm({color:t}){return c.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var rl={exports:{}},u3=rl.exports,Em;function d3(){return Em||(Em=1,(function(t,e){(function(r,n){t.exports=n()})(u3,(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 M=["th","st","nd","rd"],F=P%100;return"["+P+(M[(F-20)%10]||M[F]||M[0])+"]"}},b=function(P,M,F){var O=String(P);return!O||O.length>=M?P:""+Array(M+1-O.length).join(F)+P},w={s:b,z:function(P){var M=-P.utcOffset(),F=Math.abs(M),O=Math.floor(F/60),$=F%60;return(M<=0?"+":"-")+b(O,2,"0")+":"+b($,2,"0")},m:function P(M,F){if(M.date()<F.date())return-P(F,M);var O=12*(F.year()-M.year())+(F.month()-M.month()),$=M.clone().add(O,d),B=F-$<0,T=M.clone().add(O+(B?-1:1),d);return+(-(O+(F-$)/(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",L=function(P){return P instanceof z||!(!P||!P[N])},A=function P(M,F,O){var $;if(!M)return _;if(typeof M=="string"){var B=M.toLowerCase();S[B]&&($=B),F&&(S[B]=F,$=B);var T=M.split("-");if(!$&&T.length>1)return P(T[0])}else{var V=M.name;S[V]=M,$=V}return!O&&$&&(_=$),$||!O&&_},j=function(P,M){if(L(P))return P.clone();var F=typeof M=="object"?M:{};return F.date=P,F.args=arguments,new z(F)},I=w;I.l=A,I.i=L,I.w=function(P,M){return j(P,{locale:M.$L,utc:M.$u,x:M.$x,$offset:M.$offset})};var z=(function(){function P(F){this.$L=A(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[N]=!0}var M=P.prototype;return M.parse=function(F){this.$d=(function(O){var $=O.date,B=O.utc;if($===null)return new Date(NaN);if(I.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var T=$.match(g);if(T){var V=T[2]-1||0,et=(T[7]||"0").substring(0,3);return B?new Date(Date.UTC(T[1],V,T[3]||1,T[4]||0,T[5]||0,T[6]||0,et)):new Date(T[1],V,T[3]||1,T[4]||0,T[5]||0,T[6]||0,et)}}return new Date($)})(F),this.init()},M.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},M.$utils=function(){return I},M.isValid=function(){return this.$d.toString()!==x},M.isSame=function(F,O){var $=j(F);return this.startOf(O)<=$&&$<=this.endOf(O)},M.isAfter=function(F,O){return j(F)<this.startOf(O)},M.isBefore=function(F,O){return this.endOf(O)<j(F)},M.$g=function(F,O,$){return I.u(F)?this[O]:this.set($,F)},M.unix=function(){return Math.floor(this.valueOf()/1e3)},M.valueOf=function(){return this.$d.getTime()},M.startOf=function(F,O){var $=this,B=!!I.u(O)||O,T=I.p(F),V=function(ct,X){var it=I.w($.$u?Date.UTC($.$y,X,ct):new Date($.$y,X,ct),$);return B?it:it.endOf(h)},et=function(ct,X){return I.w($.toDate()[ct].apply($.toDate("s"),(B?[0,0,0,0]:[23,59,59,999]).slice(X)),$)},D=this.$W,G=this.$M,ht=this.$D,xt="set"+(this.$u?"UTC":"");switch(T){case p:return B?V(1,0):V(31,11);case d:return B?V(1,G):V(0,G+1);case u:var $t=this.$locale().weekStart||0,Ht=(D<$t?D+7:D)-$t;return V(B?ht-Ht:ht+(6-Ht),G);case h:case m:return et(xt+"Hours",0);case l:return et(xt+"Minutes",1);case a:return et(xt+"Seconds",2);case o:return et(xt+"Milliseconds",3);default:return this.clone()}},M.endOf=function(F){return this.startOf(F,!1)},M.$set=function(F,O){var $,B=I.p(F),T="set"+(this.$u?"UTC":""),V=($={},$[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],et=B===h?this.$D+(O-this.$W):O;if(B===d||B===p){var D=this.clone().set(m,1);D.$d[V](et),D.init(),this.$d=D.set(m,Math.min(this.$D,D.daysInMonth())).$d}else V&&this.$d[V](et);return this.init(),this},M.set=function(F,O){return this.clone().$set(F,O)},M.get=function(F){return this[I.p(F)]()},M.add=function(F,O){var $,B=this;F=Number(F);var T=I.p(O),V=function(G){var ht=j(B);return I.w(ht.date(ht.date()+Math.round(G*F)),B)};if(T===d)return this.set(d,this.$M+F);if(T===p)return this.set(p,this.$y+F);if(T===h)return V(1);if(T===u)return V(7);var et=($={},$[a]=n,$[l]=i,$[o]=r,$)[T]||1,D=this.$d.getTime()+F*et;return I.w(D,this)},M.subtract=function(F,O){return this.add(-1*F,O)},M.format=function(F){var O=this,$=this.$locale();if(!this.isValid())return $.invalidDate||x;var B=F||"YYYY-MM-DDTHH:mm:ssZ",T=I.z(this),V=this.$H,et=this.$m,D=this.$M,G=$.weekdays,ht=$.months,xt=$.meridiem,$t=function(X,it,vt,gt){return X&&(X[it]||X(O,B))||vt[it].slice(0,gt)},Ht=function(X){return I.s(V%12||12,X,"0")},ct=xt||function(X,it,vt){var gt=X<12?"AM":"PM";return vt?gt.toLowerCase():gt};return B.replace(y,(function(X,it){return it||(function(vt){switch(vt){case"YY":return String(O.$y).slice(-2);case"YYYY":return I.s(O.$y,4,"0");case"M":return D+1;case"MM":return I.s(D+1,2,"0");case"MMM":return $t($.monthsShort,D,ht,3);case"MMMM":return $t(ht,D);case"D":return O.$D;case"DD":return I.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return $t($.weekdaysMin,O.$W,G,2);case"ddd":return $t($.weekdaysShort,O.$W,G,3);case"dddd":return G[O.$W];case"H":return String(V);case"HH":return I.s(V,2,"0");case"h":return Ht(1);case"hh":return Ht(2);case"a":return ct(V,et,!0);case"A":return ct(V,et,!1);case"m":return String(et);case"mm":return I.s(et,2,"0");case"s":return String(O.$s);case"ss":return I.s(O.$s,2,"0");case"SSS":return I.s(O.$ms,3,"0");case"Z":return T}return null})(X)||T.replace(":","")}))},M.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},M.diff=function(F,O,$){var B,T=this,V=I.p(O),et=j(F),D=(et.utcOffset()-this.utcOffset())*n,G=this-et,ht=function(){return I.m(T,et)};switch(V){case p:B=ht()/12;break;case d:B=ht();break;case f:B=ht()/3;break;case u:B=(G-D)/6048e5;break;case h:B=(G-D)/864e5;break;case l:B=G/i;break;case a:B=G/n;break;case o:B=G/r;break;default:B=G}return $?B:I.a(B)},M.daysInMonth=function(){return this.endOf(d).$D},M.$locale=function(){return S[this.$L]},M.locale=function(F,O){if(!F)return this.$L;var $=this.clone(),B=A(F,O,!0);return B&&($.$L=B),$},M.clone=function(){return I.w(this.$d,this)},M.toDate=function(){return new Date(this.valueOf())},M.toJSON=function(){return this.isValid()?this.toISOString():null},M.toISOString=function(){return this.$d.toISOString()},M.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(M){return this.$g(M,P[0],P[1])}})),j.extend=function(P,M){return P.$i||(P(M,z,j),P.$i=!0),j},j.locale=A,j.isDayjs=L,j.unix=function(P){return j(1e3*P)},j.en=S[_],j.Ls=S,j.p={},j}))})(rl)),rl.exports}var p3=d3();const f3=_d(p3);var Jy=Object.defineProperty,v=(t,e)=>Jy(t,"name",{value:e,configurable:!0}),m3=(t,e)=>{for(var r in e)Jy(t,r,{get:e[r],enumerable:!0})},un={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},nt={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},hp=v(function(t="fatal"){let e=un.fatal;typeof t=="string"?t.toLowerCase()in un&&(e=un[t]):typeof t=="number"&&(e=t),nt.trace=()=>{},nt.debug=()=>{},nt.info=()=>{},nt.warn=()=>{},nt.error=()=>{},nt.fatal=()=>{},e<=un.fatal&&(nt.fatal=console.error?console.error.bind(console,jr("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",jr("FATAL"))),e<=un.error&&(nt.error=console.error?console.error.bind(console,jr("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",jr("ERROR"))),e<=un.warn&&(nt.warn=console.warn?console.warn.bind(console,jr("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",jr("WARN"))),e<=un.info&&(nt.info=console.info?console.info.bind(console,jr("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",jr("INFO"))),e<=un.debug&&(nt.debug=console.debug?console.debug.bind(console,jr("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",jr("DEBUG"))),e<=un.trace&&(nt.trace=console.debug?console.debug.bind(console,jr("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",jr("TRACE")))},"setLogLevel"),jr=v(t=>`%c${f3().format("ss.SSS")} : ${t} : `,"format");const nl={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t),hsl2rgb:({h:t,s:e,l:r},n)=>{if(!e)return r*2.55;t/=360,e/=100,r/=100;const i=r<.5?r*(1+e):r+e-r*e,s=2*r-i;switch(n){case"r":return nl.hue2rgb(s,i,t+1/3)*255;case"g":return nl.hue2rgb(s,i,t)*255;case"b":return nl.hue2rgb(s,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:r},n)=>{t/=255,e/=255,r/=255;const i=Math.max(t,e,r),s=Math.min(t,e,r),o=(i+s)/2;if(n==="l")return o*100;if(i===s)return 0;const a=i-s,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}}},g3={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},x3={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Mt={channel:nl,lang:g3,unit:x3},Mn={};for(let t=0;t<=255;t++)Mn[t]=Mt.unit.dec2hex(t);const Ve={ALL:0,RGB:1,HSL:2};class y3{constructor(){this.type=Ve.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=Ve.ALL}is(e){return this.type===e}}class b3{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new y3}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=Ve.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Mt.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Mt.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Mt.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Mt.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Mt.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Mt.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(Ve.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(Ve.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(Ve.HSL)&&r!==void 0?r:(this._ensureHSL(),Mt.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(Ve.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(Ve.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(Ve.RGB)&&r!==void 0?r:(this._ensureRGB(),Mt.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(Ve.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(Ve.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(Ve.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(Ve.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(Ve.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(Ve.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const wc=new b3({r:0,g:0,b:0,a:0},"transparent"),ts={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(ts.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 wc.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?`#${Mn[Math.round(e)]}${Mn[Math.round(r)]}${Mn[Math.round(n)]}${Mn[Math.round(i*255)]}`:`#${Mn[Math.round(e)]}${Mn[Math.round(r)]}${Mn[Math.round(n)]}`}},oi={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(oi.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Mt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Mt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Mt.channel.clamp.h(parseFloat(r)*360)}}return Mt.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(oi.re);if(!r)return;const[,n,i,s,o,a]=r;return wc.set({h:oi._hue2deg(n),s:Mt.channel.clamp.s(parseFloat(i)),l:Mt.channel.clamp.l(parseFloat(s)),a:o?Mt.channel.clamp.a(a?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:r,l:n,a:i}=t;return i<1?`hsla(${Mt.lang.round(e)}, ${Mt.lang.round(r)}%, ${Mt.lang.round(n)}%, ${i})`:`hsl(${Mt.lang.round(e)}, ${Mt.lang.round(r)}%, ${Mt.lang.round(n)}%)`}},Io={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=Io.colors[t];if(e)return ts.parse(e)},stringify:t=>{const e=ts.stringify(t);for(const r in Io.colors)if(Io.colors[r]===e)return r}},ko={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(ko.re);if(!r)return;const[,n,i,s,o,a,l,h,u]=r;return wc.set({r:Mt.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Mt.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:Mt.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:h?Mt.channel.clamp.a(u?parseFloat(h)/100:parseFloat(h)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${Mt.lang.round(e)}, ${Mt.lang.round(r)}, ${Mt.lang.round(n)}, ${Mt.lang.round(i)})`:`rgb(${Mt.lang.round(e)}, ${Mt.lang.round(r)}, ${Mt.lang.round(n)})`}},Zr={format:{keyword:Io,hex:ts,rgb:ko,rgba:ko,hsl:oi,hsla:oi},parse:t=>{if(typeof t!="string")return t;const e=ts.parse(t)||ko.parse(t)||oi.parse(t)||Io.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(Ve.HSL)||t.data.r===void 0?oi.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?ko.stringify(t):ts.stringify(t)},tb=(t,e)=>{const r=Zr.parse(t);for(const n in e)r[n]=Mt.channel.clamp[n](e[n]);return Zr.stringify(r)},On=(t,e,r=0,n=1)=>{if(typeof t!="number")return tb(t,{a:e});const i=wc.set({r:Mt.channel.clamp.r(t),g:Mt.channel.clamp.g(e),b:Mt.channel.clamp.b(r),a:Mt.channel.clamp.a(n)});return Zr.stringify(i)},C3=t=>{const{r:e,g:r,b:n}=Zr.parse(t),i=.2126*Mt.channel.toLinear(e)+.7152*Mt.channel.toLinear(r)+.0722*Mt.channel.toLinear(n);return Mt.lang.round(i)},k3=t=>C3(t)>=.5,Wr=t=>!k3(t),eb=(t,e,r)=>{const n=Zr.parse(t),i=n[e],s=Mt.channel.clamp[e](i+r);return i!==s&&(n[e]=s),Zr.stringify(n)},K=(t,e)=>eb(t,"l",e),Q=(t,e)=>eb(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 tb(t,n)},v3=(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 On(y,C,b,w)},Y=(t,e=100)=>{const r=Zr.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,v3(r,t,e)};/*! @license DOMPurify 3.4.9 | (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.9/LICENSE */function Bm(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 w3(t){if(Array.isArray(t))return t}function S3(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 T3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
317
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _3(t,e){return w3(t)||S3(t,e)||j3(t,e)||T3()}function j3(t,e){if(t){if(typeof t=="string")return Bm(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)?Bm(t,e):void 0}}const rb=Object.entries,Lm=Object.setPrototypeOf,N3=Object.isFrozen,E3=Object.getPrototypeOf,B3=Object.getOwnPropertyDescriptor;let or=Object.freeze,Er=Object.seal,Yi=Object.create,nb=typeof Reflect<"u"&&Reflect,xu=nb.apply,yu=nb.construct;or||(or=function(e){return e});Er||(Er=function(e){return e});xu||(xu=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)});yu||(yu=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 dn=Le(Array.prototype.forEach),L3=Le(Array.prototype.lastIndexOf),Am=Le(Array.prototype.pop),Di=Le(Array.prototype.push),A3=Le(Array.prototype.splice),rr=Array.isArray,vo=Le(String.prototype.toLowerCase),Sh=Le(String.prototype.toString),Mm=Le(String.prototype.match),Pi=Le(String.prototype.replace),Im=Le(String.prototype.indexOf),M3=Le(String.prototype.trim),I3=Le(Number.prototype.toString),F3=Le(Boolean.prototype.toString),Fm=typeof BigInt>"u"?null:Le(BigInt.prototype.toString),Dm=typeof Symbol>"u"?null:Le(Symbol.prototype.toString),ve=Le(Object.prototype.hasOwnProperty),oo=Le(Object.prototype.toString),$e=Le(RegExp.prototype.test),Jn=D3(TypeError);function Le(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 xu(t,e,n)}}function D3(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return yu(t,r)}}function zt(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vo;if(Lm&&Lm(t,null),!rr(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(N3(e)||(e[n]=s),i=s)}t[i]=!0}return t}function P3(t){for(let e=0;e<t.length;e++)ve(t,e)||(t[e]=null);return t}function Ye(t){const e=Yi(null);for(const n of rb(t)){var r=_3(n,2);const i=r[0],s=r[1];ve(t,i)&&(rr(s)?e[i]=P3(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Ye(s):e[i]=s)}return e}function O3(t){switch(typeof t){case"string":return t;case"number":return I3(t);case"boolean":return F3(t);case"bigint":return Fm?Fm(t):"0";case"symbol":return Dm?Dm(t):"Symbol()";case"undefined":return oo(t);case"function":case"object":{if(t===null)return oo(t);const e=t,r=Yr(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:oo(n)}return oo(t)}default:return oo(t)}}function Yr(t,e){for(;t!==null;){const n=B3(t,e);if(n){if(n.get)return Le(n.get);if(typeof n.value=="function")return Le(n.value)}t=E3(t)}function r(){return null}return r}function $3(t){try{return $e(t,""),!0}catch{return!1}}const Pm=or(["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"]),Th=or(["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"]),_h=or(["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"]),R3=or(["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"]),jh=or(["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"]),z3=or(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Om=or(["#text"]),$m=or(["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"]),Nh=or(["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"]),Rm=or(["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"]),Ma=or(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),W3=Er(/{{[\w\W]*|^[\w\W]*}}/g),q3=Er(/<%[\w\W]*|^[\w\W]*%>/g),H3=Er(/\${[\w\W]*/g),U3=Er(/^data-[\-\w.\u00B7-\uFFFF]+$/),Y3=Er(/^aria-[\-\w]+$/),zm=Er(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V3=Er(/^(?:\w+script|data):/i),G3=Er(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),X3=Er(/^html$/i),K3=Er(/^[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},Q3=function(){return typeof window>"u"?null:window},Z3=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}},Wm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ib(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Q3();const e=ft=>ib(ft);if(e.version="3.4.9",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 ft=r.createElement("template");ft.content&&ft.content.ownerDocument&&(r=ft.content.ownerDocument)}let S,N="",L,A=!1,j=0;const I=function(){if(j>0)throw Jn('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},z=function(R){I(),j++;try{return S.createHTML(R)}finally{j--}},W=function(R){I(),j++;try{return S.createScriptURL(R)}finally{j--}},P=function(){return A||(L=Z3(d,i),A=!0),L},M=r,F=M.implementation,O=M.createNodeIterator,$=M.createDocumentFragment,B=M.getElementsByTagName,T=n.importNode;let V=Wm();e.isSupported=typeof rb=="function"&&typeof y=="function"&&F&&F.createHTMLDocument!==void 0;const et=W3,D=q3,G=H3,ht=U3,xt=Y3,$t=V3,Ht=G3,ct=K3;let X=zm,it=null;const vt=zt({},[...Pm,...Th,..._h,...jh,...Om]);let gt=null;const Jt=zt({},[...$m,...Nh,...Rm,...Ma]);let Pt=Object.seal(Yi(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}})),Xt=null,je=null;const Kt=Object.seal(Yi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let br=!0,ue=!0,Pe=!1,We=!0,de=!1,q=!0,Z=!1,H=!1,rt=!1,at=!1,pt=!1,Tt=!1,te=!0,ge=!1;const Ne="user-content-";let qe=!0,xe=!1,ye={},he=null;const Oe=zt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Rs=null;const ka=zt({},["audio","video","img","source","image","track"]);let zs=null;const Ni=zt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ei="http://www.w3.org/1998/Math/MathML",Kn="http://www.w3.org/2000/svg",_r="http://www.w3.org/1999/xhtml";let jn=_r,on=!1,Ws=null;const Bi=zt({},[Ei,Kn,_r],Sh);let qs=zt({},["mi","mo","mn","ms","mtext"]),Li=zt({},["annotation-xml"]);const Hc=zt({},["title","style","font","a","script"]);let Nn=null;const Uc=["application/xhtml+xml","text/html"],va="text/html";let pe=null,an=null;const Yc=r.createElement("form"),Hs=function(R){return R instanceof RegExp||R instanceof Function},Us=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(an&&an===R)return;(!R||typeof R!="object")&&(R={}),R=Ye(R),Nn=Uc.indexOf(R.PARSER_MEDIA_TYPE)===-1?va:R.PARSER_MEDIA_TYPE,pe=Nn==="application/xhtml+xml"?Sh:vo,it=ve(R,"ALLOWED_TAGS")&&rr(R.ALLOWED_TAGS)?zt({},R.ALLOWED_TAGS,pe):vt,gt=ve(R,"ALLOWED_ATTR")&&rr(R.ALLOWED_ATTR)?zt({},R.ALLOWED_ATTR,pe):Jt,Ws=ve(R,"ALLOWED_NAMESPACES")&&rr(R.ALLOWED_NAMESPACES)?zt({},R.ALLOWED_NAMESPACES,Sh):Bi,zs=ve(R,"ADD_URI_SAFE_ATTR")&&rr(R.ADD_URI_SAFE_ATTR)?zt(Ye(Ni),R.ADD_URI_SAFE_ATTR,pe):Ni,Rs=ve(R,"ADD_DATA_URI_TAGS")&&rr(R.ADD_DATA_URI_TAGS)?zt(Ye(ka),R.ADD_DATA_URI_TAGS,pe):ka,he=ve(R,"FORBID_CONTENTS")&&rr(R.FORBID_CONTENTS)?zt({},R.FORBID_CONTENTS,pe):Oe,Xt=ve(R,"FORBID_TAGS")&&rr(R.FORBID_TAGS)?zt({},R.FORBID_TAGS,pe):Ye({}),je=ve(R,"FORBID_ATTR")&&rr(R.FORBID_ATTR)?zt({},R.FORBID_ATTR,pe):Ye({}),ye=ve(R,"USE_PROFILES")?R.USE_PROFILES&&typeof R.USE_PROFILES=="object"?Ye(R.USE_PROFILES):R.USE_PROFILES:!1,br=R.ALLOW_ARIA_ATTR!==!1,ue=R.ALLOW_DATA_ATTR!==!1,Pe=R.ALLOW_UNKNOWN_PROTOCOLS||!1,We=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=R.SAFE_FOR_TEMPLATES||!1,q=R.SAFE_FOR_XML!==!1,Z=R.WHOLE_DOCUMENT||!1,at=R.RETURN_DOM||!1,pt=R.RETURN_DOM_FRAGMENT||!1,Tt=R.RETURN_TRUSTED_TYPE||!1,rt=R.FORCE_BODY||!1,te=R.SANITIZE_DOM!==!1,ge=R.SANITIZE_NAMED_PROPS||!1,qe=R.KEEP_CONTENT!==!1,xe=R.IN_PLACE||!1,X=$3(R.ALLOWED_URI_REGEXP)?R.ALLOWED_URI_REGEXP:zm,jn=typeof R.NAMESPACE=="string"?R.NAMESPACE:_r,qs=ve(R,"MATHML_TEXT_INTEGRATION_POINTS")&&R.MATHML_TEXT_INTEGRATION_POINTS&&typeof R.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ye(R.MATHML_TEXT_INTEGRATION_POINTS):zt({},["mi","mo","mn","ms","mtext"]),Li=ve(R,"HTML_INTEGRATION_POINTS")&&R.HTML_INTEGRATION_POINTS&&typeof R.HTML_INTEGRATION_POINTS=="object"?Ye(R.HTML_INTEGRATION_POINTS):zt({},["annotation-xml"]);const J=ve(R,"CUSTOM_ELEMENT_HANDLING")&&R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING=="object"?Ye(R.CUSTOM_ELEMENT_HANDLING):Yi(null);if(Pt=Yi(null),ve(J,"tagNameCheck")&&Hs(J.tagNameCheck)&&(Pt.tagNameCheck=J.tagNameCheck),ve(J,"attributeNameCheck")&&Hs(J.attributeNameCheck)&&(Pt.attributeNameCheck=J.attributeNameCheck),ve(J,"allowCustomizedBuiltInElements")&&typeof J.allowCustomizedBuiltInElements=="boolean"&&(Pt.allowCustomizedBuiltInElements=J.allowCustomizedBuiltInElements),de&&(ue=!1),pt&&(at=!0),ye&&(it=zt({},Om),gt=Yi(null),ye.html===!0&&(zt(it,Pm),zt(gt,$m)),ye.svg===!0&&(zt(it,Th),zt(gt,Nh),zt(gt,Ma)),ye.svgFilters===!0&&(zt(it,_h),zt(gt,Nh),zt(gt,Ma)),ye.mathMl===!0&&(zt(it,jh),zt(gt,Rm),zt(gt,Ma))),Kt.tagCheck=null,Kt.attributeCheck=null,ve(R,"ADD_TAGS")&&(typeof R.ADD_TAGS=="function"?Kt.tagCheck=R.ADD_TAGS:rr(R.ADD_TAGS)&&(it===vt&&(it=Ye(it)),zt(it,R.ADD_TAGS,pe))),ve(R,"ADD_ATTR")&&(typeof R.ADD_ATTR=="function"?Kt.attributeCheck=R.ADD_ATTR:rr(R.ADD_ATTR)&&(gt===Jt&&(gt=Ye(gt)),zt(gt,R.ADD_ATTR,pe))),ve(R,"ADD_URI_SAFE_ATTR")&&rr(R.ADD_URI_SAFE_ATTR)&&zt(zs,R.ADD_URI_SAFE_ATTR,pe),ve(R,"FORBID_CONTENTS")&&rr(R.FORBID_CONTENTS)&&(he===Oe&&(he=Ye(he)),zt(he,R.FORBID_CONTENTS,pe)),ve(R,"ADD_FORBID_CONTENTS")&&rr(R.ADD_FORBID_CONTENTS)&&(he===Oe&&(he=Ye(he)),zt(he,R.ADD_FORBID_CONTENTS,pe)),qe&&(it["#text"]=!0),Z&&zt(it,["html","head","body"]),it.table&&(zt(it,["tbody"]),delete Xt.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw Jn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Jn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const lt=S;S=R.TRUSTED_TYPES_POLICY;try{N=z("")}catch(Et){throw S=lt,Et}}else R.TRUSTED_TYPES_POLICY===null?(S=void 0,N=""):(S===void 0&&(S=P()),S&&typeof N=="string"&&(N=z("")));(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&it===vt&&(it=Ye(it)),V.uponSanitizeAttribute.length>0&>===Jt&&(gt=Ye(gt)),or&&or(R),an=R},Ae=zt({},[...Th,..._h,...R3]),Ys=zt({},[...jh,...z3]),Qn=function(R){let J=y(R);(!J||!J.tagName)&&(J={namespaceURI:jn,tagName:"template"});const lt=vo(R.tagName),Et=vo(J.tagName);return Ws[R.namespaceURI]?R.namespaceURI===Kn?J.namespaceURI===_r?lt==="svg":J.namespaceURI===Ei?lt==="svg"&&(Et==="annotation-xml"||qs[Et]):!!Ae[lt]:R.namespaceURI===Ei?J.namespaceURI===_r?lt==="math":J.namespaceURI===Kn?lt==="math"&&Li[Et]:!!Ys[lt]:R.namespaceURI===_r?J.namespaceURI===Kn&&!Li[Et]||J.namespaceURI===Ei&&!qs[Et]?!1:!Ys[lt]&&(Hc[lt]||!Ae[lt]):!!(Nn==="application/xhtml+xml"&&Ws[R.namespaceURI]):!1},tr=function(R){Di(e.removed,{element:R});try{y(R).removeChild(R)}catch{if(m(R),!y(R))throw Jn("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Vs=function(R){const J=g?g(R):R.childNodes;if(J){const Et=[];dn(J,It=>{Di(Et,It)}),dn(Et,It=>{try{m(It)}catch{}})}const lt=b?b(R):null;if(lt)for(let Et=lt.length-1;Et>=0;--Et){const It=lt[Et],Ot=It&&It.name;if(typeof Ot=="string")try{R.removeAttribute(Ot)}catch{}}},ln=function(R,J){try{Di(e.removed,{attribute:J.getAttributeNode(R),from:J})}catch{Di(e.removed,{attribute:null,from:J})}if(J.removeAttribute(R),R==="is")if(at||pt)try{tr(J)}catch{}else try{J.setAttribute(R,"")}catch{}},Vc=function(R){const J=b?b(R):R.attributes;if(J)for(let lt=J.length-1;lt>=0;--lt){const Et=J[lt],It=Et&&Et.name;if(!(typeof It!="string"||gt[pe(It)]))try{R.removeAttribute(It)}catch{}}},Gc=function(R){const J=[R];for(;J.length>0;){const lt=J.pop();(w?w(lt):lt.nodeType)===Ur.element&&Vc(lt);const It=g?g(lt):lt.childNodes;if(It)for(let Ot=It.length-1;Ot>=0;--Ot)J.push(It[Ot])}},wa=function(R){let J=null,lt=null;if(rt)R="<remove></remove>"+R;else{const Ot=Mm(R,/^[\r\n\t ]+/);lt=Ot&&Ot[0]}Nn==="application/xhtml+xml"&&jn===_r&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Et=S?z(R):R;if(jn===_r)try{J=new u().parseFromString(Et,Nn)}catch{}if(!J||!J.documentElement){J=F.createDocument(jn,"template",null);try{J.documentElement.innerHTML=on?N:Et}catch{}}const It=J.body||J.documentElement;return R&<&&It.insertBefore(r.createTextNode(lt),It.childNodes[0]||null),jn===_r?B.call(J,Z?"html":"body")[0]:Z?J.documentElement:It},He=function(R){return O.call(R.ownerDocument||R,R,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Ue=function(R){var J,lt;R.normalize();const Et=O.call(R.ownerDocument||R,R,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let It=Et.nextNode();for(;It;){let we=It.data;dn([et,D,G],ie=>{we=Pi(we,ie," ")}),It.data=we,It=Et.nextNode()}const Ot=(J=(lt=R.querySelectorAll)===null||lt===void 0?void 0:lt.call(R,"template"))!==null&&J!==void 0?J:[];dn(Array.from(Ot),we=>{cn(we.content)&&Ue(we.content)})},Ai=function(R){const J=_?_(R):null;return typeof J!="string"||pe(J)!=="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)},cn=function(R){if(!w||typeof R!="object"||R===null)return!1;try{return w(R)===Ur.documentFragment}catch{return!1}},hn=function(R){if(!w||typeof R!="object"||R===null)return!1;try{return typeof w(R)=="number"}catch{return!1}};function lr(ft,R,J){dn(ft,lt=>{lt.call(e,R,J,an)})}const Sa=function(R){let J=null;if(lr(V.beforeSanitizeElements,R,null),Ai(R))return tr(R),!0;const lt=pe(_?_(R):R.nodeName);if(lr(V.uponSanitizeElement,R,{tagName:lt,allowedTags:it}),q&&R.hasChildNodes()&&!hn(R.firstElementChild)&&$e(/<[/\w!]/g,R.innerHTML)&&$e(/<[/\w!]/g,R.textContent)||q&&R.namespaceURI===_r&<==="style"&&hn(R.firstElementChild)||R.nodeType===Ur.progressingInstruction||q&&R.nodeType===Ur.comment&&$e(/<[/\w]/g,R.data))return tr(R),!0;if(Xt[lt]||!(Kt.tagCheck instanceof Function&&Kt.tagCheck(lt))&&!it[lt]){if(!Xt[lt]&&Gs(lt)&&(Pt.tagNameCheck instanceof RegExp&&$e(Pt.tagNameCheck,lt)||Pt.tagNameCheck instanceof Function&&Pt.tagNameCheck(lt)))return!1;if(qe&&!he[lt]){const It=y(R),Ot=g(R);if(Ot&&It){const we=Ot.length;for(let ie=we-1;ie>=0;--ie){const fe=xe?Ot[ie]:p(Ot[ie],!0);It.insertBefore(fe,x(R))}}}return tr(R),!0}return(w?w(R):R.nodeType)===Ur.element&&!Qn(R)||(lt==="noscript"||lt==="noembed"||lt==="noframes")&&$e(/<\/no(script|embed|frames)/i,R.innerHTML)?(tr(R),!0):(de&&R.nodeType===Ur.text&&(J=R.textContent,dn([et,D,G],It=>{J=Pi(J,It," ")}),R.textContent!==J&&(Di(e.removed,{element:R.cloneNode()}),R.textContent=J)),lr(V.afterSanitizeElements,R,null),!1)},Ta=function(R,J,lt){if(je[J]||te&&(J==="id"||J==="name")&&(lt in r||lt in Yc))return!1;const Et=gt[J]||Kt.attributeCheck instanceof Function&&Kt.attributeCheck(J,R);if(!(ue&&!je[J]&&$e(ht,J))){if(!(br&&$e(xt,J))){if(!Et||je[J]){if(!(Gs(R)&&(Pt.tagNameCheck instanceof RegExp&&$e(Pt.tagNameCheck,R)||Pt.tagNameCheck instanceof Function&&Pt.tagNameCheck(R))&&(Pt.attributeNameCheck instanceof RegExp&&$e(Pt.attributeNameCheck,J)||Pt.attributeNameCheck instanceof Function&&Pt.attributeNameCheck(J,R))||J==="is"&&Pt.allowCustomizedBuiltInElements&&(Pt.tagNameCheck instanceof RegExp&&$e(Pt.tagNameCheck,lt)||Pt.tagNameCheck instanceof Function&&Pt.tagNameCheck(lt))))return!1}else if(!zs[J]){if(!$e(X,Pi(lt,Ht,""))){if(!((J==="src"||J==="xlink:href"||J==="href")&&R!=="script"&&Im(lt,"data:")===0&&Rs[R])){if(!(Pe&&!$e($t,Pi(lt,Ht,"")))){if(lt)return!1}}}}}}return!0},Xc=zt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Gs=function(R){return!Xc[vo(R)]&&$e(ct,R)},_a=function(R){lr(V.beforeSanitizeAttributes,R,null);const J=R.attributes;if(!J||Ai(R))return;const lt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:gt,forceKeepAttr:void 0};let Et=J.length;for(;Et--;){const It=J[Et],Ot=It.name,we=It.namespaceURI,ie=It.value,fe=pe(Ot),Hr=ie;let Se=Ot==="value"?Hr:M3(Hr);if(lt.attrName=fe,lt.attrValue=Se,lt.keepAttr=!0,lt.forceKeepAttr=void 0,lr(V.uponSanitizeAttribute,R,lt),Se=lt.attrValue,ge&&(fe==="id"||fe==="name")&&Im(Se,Ne)!==0&&(ln(Ot,R),Se=Ne+Se),q&&$e(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Se)){ln(Ot,R);continue}if(fe==="attributename"&&Mm(Se,"href")){ln(Ot,R);continue}if(lt.forceKeepAttr)continue;if(!lt.keepAttr){ln(Ot,R);continue}if(!We&&$e(/\/>/i,Se)){ln(Ot,R);continue}de&&dn([et,D,G],ja=>{Se=Pi(Se,ja," ")});const Ks=pe(R.nodeName);if(!Ta(Ks,fe,Se)){ln(Ot,R);continue}if(S&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!we)switch(d.getAttributeType(Ks,fe)){case"TrustedHTML":{Se=z(Se);break}case"TrustedScriptURL":{Se=W(Se);break}}if(Se!==Hr)try{we?R.setAttributeNS(we,Ot,Se):R.setAttribute(Ot,Se),Ai(R)?tr(R):Am(e.removed)}catch{ln(Ot,R)}}lr(V.afterSanitizeAttributes,R,null)},Mi=function(R){let J=null;const lt=He(R);for(lr(V.beforeSanitizeShadowDOM,R,null);J=lt.nextNode();)if(lr(V.uponSanitizeShadowNode,J,null),Sa(J),_a(J),cn(J.content)&&Mi(J.content),(w?w(J):J.nodeType)===Ur.element){const It=C?C(J):J.shadowRoot;cn(It)&&(Xs(It),Mi(It))}lr(V.afterSanitizeShadowDOM,R,null)},Xs=function(R){const J=[{node:R,shadow:null}];for(;J.length>0;){const lt=J.pop();if(lt.shadow){Mi(lt.shadow);continue}const Et=lt.node,Ot=(w?w(Et):Et.nodeType)===Ur.element,we=g?g(Et):Et.childNodes;if(we)for(let ie=we.length-1;ie>=0;--ie)J.push({node:we[ie],shadow:null});if(Ot){const ie=_?_(Et):null;if(typeof ie=="string"&&pe(ie)==="template"){const fe=Et.content;cn(fe)&&J.push({node:fe,shadow:null})}}if(Ot){const ie=C?C(Et):Et.shadowRoot;cn(ie)&&J.push({node:null,shadow:ie},{node:ie,shadow:null})}}};return e.sanitize=function(ft){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=null,lt=null,Et=null,It=null;if(on=!ft,on&&(ft="<!-->"),typeof ft!="string"&&!hn(ft)&&(ft=O3(ft),typeof ft!="string"))throw Jn("dirty is not a string, aborting");if(!e.isSupported)return ft;H||Us(R),e.removed=[];const Ot=xe&&typeof ft!="string"&&hn(ft);if(Ot){const fe=_?_(ft):ft.nodeName;if(typeof fe=="string"){const Hr=pe(fe);if(!it[Hr]||Xt[Hr])throw Jn("root node is forbidden and cannot be sanitized in-place")}if(Ai(ft))throw Jn("root node is clobbered and cannot be sanitized in-place");try{Xs(ft)}catch(Hr){throw Vs(ft),Hr}}else if(hn(ft))J=wa("<!---->"),lt=J.ownerDocument.importNode(ft,!0),lt.nodeType===Ur.element&<.nodeName==="BODY"||lt.nodeName==="HTML"?J=lt:J.appendChild(lt),Xs(lt);else{if(!at&&!de&&!Z&&ft.indexOf("<")===-1)return S&&Tt?z(ft):ft;if(J=wa(ft),!J)return at?null:Tt?N:""}J&&rt&&tr(J.firstChild);const we=He(Ot?ft:J);try{for(;Et=we.nextNode();)Sa(Et),_a(Et),cn(Et.content)&&Mi(Et.content)}catch(fe){throw Ot&&Vs(ft),fe}if(Ot)return dn(e.removed,fe=>{fe.element&&Gc(fe.element)}),de&&Ue(ft),ft;if(at){if(de&&Ue(J),pt)for(It=$.call(J.ownerDocument);J.firstChild;)It.appendChild(J.firstChild);else It=J;return(gt.shadowroot||gt.shadowrootmode)&&(It=T.call(n,It,!0)),It}let ie=Z?J.outerHTML:J.innerHTML;return Z&&it["!doctype"]&&J.ownerDocument&&J.ownerDocument.doctype&&J.ownerDocument.doctype.name&&$e(X3,J.ownerDocument.doctype.name)&&(ie="<!DOCTYPE "+J.ownerDocument.doctype.name+`>
|
|
318
|
+
`+ie),de&&dn([et,D,G],fe=>{ie=Pi(ie,fe," ")}),S&&Tt?z(ie):ie},e.setConfig=function(){let ft=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Us(ft),H=!0},e.clearConfig=function(){an=null,H=!1,S=L,N=""},e.isValidAttribute=function(ft,R,J){an||Us({});const lt=pe(ft),Et=pe(R);return Ta(lt,Et,J)},e.addHook=function(ft,R){typeof R=="function"&&Di(V[ft],R)},e.removeHook=function(ft,R){if(R!==void 0){const J=L3(V[ft],R);return J===-1?void 0:A3(V[ft],J,1)[0]}return Am(V[ft])},e.removeHooks=function(ft){V[ft]=[]},e.removeAllHooks=function(){V=Wm()},e}var ks=ib(),sb=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Fo=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,J3=/\s*%%.*\n/gm,is,ob=(is=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(is,"UnknownDiagramError"),is),xi={},up=v(function(t,e){t=t.replace(sb,"").replace(Fo,"").replace(J3,`
|
|
319
|
+
`);for(const[r,{detector:n}]of Object.entries(xi))if(n(t,e))return r;throw new ob(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),bu=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)ab(e,r,n)},"registerLazyLoadedDiagrams"),ab=v((t,e,r)=>{xi[t]&&nt.warn(`Detector with key ${t} already exists. Overwriting.`),xi[t]={detector:e,loader:r},nt.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),tM=v(t=>xi[t].loader,"getDiagramLoader"),Cu=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=>Cu(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]=Cu(t[s],e[s],{depth:r-1,clobber:n})):(n||typeof t[s]!="object"&&typeof e[s]!="object")&&(t[s]=e[s])}),t)},"assignWithDepth"),Ie=Cu,rn="#ffffff",nn="#f2f2f2",At=v((t,e)=>e?E(t,{s:-40,l:10}):E(t,{s:-40,l:-10}),"mkBorder"),ss,eM=(ss=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,L,A,j,I,z,W,P,M,F,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||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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||Y(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]||Y(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:((L=this.xyChart)==null?void 0:L.backgroundColor)||this.background,titleColor:((A=this.xyChart)==null?void 0:A.titleColor)||this.primaryTextColor,dataLabelColor:((j=this.xyChart)==null?void 0:j.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((I=this.xyChart)==null?void 0:I.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:((M=this.xyChart)==null?void 0:M.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((F=this.xyChart)==null?void 0:F.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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(ss,"Theme"),ss),rM=v(t=>{const e=new eM;return e.calculate(t),e},"getThemeVariables"),os,nM=(os=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.lineColor=Y(this.background),this.textColor=Y(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(Y("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=On(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=On(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=On(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,L,A,j,I,z,W,P,M,F,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=Y(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]||Y(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:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((A=this.wardley)==null?void 0:A.axisTextColor)||this.primaryTextColor,gridColor:((j=this.wardley)==null?void 0:j.gridColor)||this.gridColor,componentFill:((I=this.wardley)==null?void 0:I.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:((M=this.wardley)==null?void 0:M.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((F=this.wardley)==null?void 0:F.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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Y(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Y(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(os,"Theme"),os),iM=v(t=>{const e=new nM;return e.calculate(t),e},"getThemeVariables"),as,sM=(as=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=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.lineColor=Y(this.background),this.textColor=Y(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=On(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,L,A,j,I,z,W,P,M,F,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||Y(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||Y(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:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((A=this.xyChart)==null?void 0:A.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((j=this.xyChart)==null?void 0:j.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((I=this.xyChart)==null?void 0:I.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:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((F=this.xyChart)==null?void 0:F.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(Y(this.git0),25),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Y(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Y(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(as,"Theme"),as),oM=v(t=>{const e=new sM;return e.calculate(t),e},"getThemeVariables"),ls,aM=(ls=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=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.primaryColor),this.lineColor=Y(this.background),this.textColor=Y(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,L,A,j,I,z,W,P,M,F,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:((L=this.xyChart)==null?void 0:L.titleColor)||this.primaryTextColor,dataLabelColor:((A=this.xyChart)==null?void 0:A.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((j=this.xyChart)==null?void 0:j.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((I=this.xyChart)==null?void 0:I.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:((M=this.xyChart)==null?void 0:M.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((F=this.xyChart)==null?void 0:F.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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||Y(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||Y(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(ls,"Theme"),ls),lM=v(t=>{const e=new aM;return e.calculate(t),e},"getThemeVariables"),cs,cM=(cs=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=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.lineColor=Y(this.background),this.textColor=Y(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,L,A,j,I,z,W,P,M,F,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]||Y(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:((L=this.wardley)==null?void 0:L.axisColor)||this.lineColor,axisTextColor:((A=this.wardley)==null?void 0:A.axisTextColor)||this.primaryTextColor,gridColor:((j=this.wardley)==null?void 0:j.gridColor)||this.gridColor,componentFill:((I=this.wardley)==null?void 0:I.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:((M=this.wardley)==null?void 0:M.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((F=this.wardley)==null?void 0:F.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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(cs,"Theme"),cs),hM=v(t=>{const e=new cM;return e.calculate(t),e},"getThemeVariables"),hs,uM=(hs=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||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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||Y(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]||Y(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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(hs,"Theme"),hs),dM=v(t=>{const e=new uM;return e.calculate(t),e},"getThemeVariables"),us,pM=(us=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(Y("#323D47"),10),this.border1="#ccc",this.border2=On(255,255,255,.25),this.arrowheadColor=Y(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||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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||Y(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]||Y(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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(us,"Theme"),us),fM=v(t=>{const e=new pM;return e.calculate(t),e},"getThemeVariables"),ds,mM=(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("#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||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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||Y(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]||Y(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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(ds,"Theme"),ds),gM=v(t=>{const e=new mM;return e.calculate(t),e},"getThemeVariables"),ps,xM=(ps=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(Y("#323D47"),10),this.border1="#ccc",this.border2=On(255,255,255,.25),this.arrowheadColor=Y(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||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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||Y(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]||Y(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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(ps,"Theme"),ps),yM=v(t=>{const e=new xM;return e.calculate(t),e},"getThemeVariables"),fs,bM=(fs=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||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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||Y(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]||Y(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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(fs,"Theme"),fs),CM=v(t=>{const e=new bM;return e.calculate(t),e},"getThemeVariables"),ms,kM=(ms=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=E(this.primaryColor,{h:-160}),this.primaryBorderColor=Y(this.background),this.secondaryBorderColor=At(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=At(this.tertiaryColor,this.darkMode),this.primaryTextColor=Y(this.primaryColor),this.secondaryTextColor=Y(this.secondaryColor),this.tertiaryTextColor=Y(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(Y("#323D47"),10),this.border1="#ccc",this.border2=On(255,255,255,.25),this.arrowheadColor=Y(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||Y(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Y(this.tertiaryColor),this.lineColor=this.lineColor||Y(this.background),this.arrowheadColor=this.arrowheadColor||Y(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||Y(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]||Y(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||Y(this.git0),this.gitInv1=this.gitInv1||Y(this.git1),this.gitInv2=this.gitInv2||Y(this.git2),this.gitInv3=this.gitInv3||Y(this.git3),this.gitInv4=this.gitInv4||Y(this.git4),this.gitInv5=this.gitInv5||Y(this.git5),this.gitInv6=this.gitInv6||Y(this.git6),this.gitInv7=this.gitInv7||Y(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(ms,"Theme"),ms),vM=v(t=>{const e=new kM;return e.calculate(t),e},"getThemeVariables"),gn={base:{getThemeVariables:rM},dark:{getThemeVariables:iM},default:{getThemeVariables:oM},forest:{getThemeVariables:lM},neutral:{getThemeVariables:hM},neo:{getThemeVariables:dM},"neo-dark":{getThemeVariables:fM},redux:{getThemeVariables:gM},"redux-dark":{getThemeVariables:yM},"redux-color":{getThemeVariables:CM},"redux-dark-color":{getThemeVariables:vM}},er={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},lb={...er,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:gn.default.getThemeVariables(),sequence:{...er.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:{...er.gantt,tickInterval:void 0,useWidth:void 0},c4:{...er.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...er.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:{...er.pie,useWidth:984},xyChart:{...er.xyChart,useWidth:void 0},requirement:{...er.requirement,useWidth:void 0},packet:{...er.packet},eventmodeling:{...er.eventmodeling},treeView:{...er.treeView,useWidth:void 0},radar:{...er.radar},ishikawa:{...er.ishikawa},sankey:{...er.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:{...er.venn}},cb=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...cb(t[n],"")]:[...r,e+n],[]),"keyify"),wM=new Set(cb(lb,"")),hb=lb,El=v(t=>{if(nt.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>El(e));return}for(const e of Object.keys(t)){if(nt.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!wM.has(e)||t[e]==null){nt.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]))&&(nt.debug("sanitize deleting invalid color:",i,t[e][i]),delete t[e][i])}else nt.debug("sanitizing object",e),El(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(nt.debug("sanitizing css option",e),t[e]=ub(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]="")}nt.debug("After sanitization",t)}},"sanitizeDirective"),ub=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"),vs=Object.freeze(hb),Sn=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),dr=Ie({},vs),Bl,yi=[],Do=Ie({},vs),Sc=v((t,e)=>{let r=Ie({},t),n={};for(const i of e)fb(i),n=Ie(n,i);if(r=Ie(r,n),n.theme&&n.theme in gn){const i=Ie({},Bl),s=Ie(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in gn&&(r.themeVariables=gn[r.theme].getThemeVariables(s))}return Do=r,gb(Do),Do},"updateCurrentConfig"),SM=v(t=>(dr=Ie({},vs),dr=Ie(dr,t),t.theme&&gn[t.theme]&&(dr.themeVariables=gn[t.theme].getThemeVariables(t.themeVariables)),Sc(dr,yi),dr),"setSiteConfig"),TM=v(t=>{Bl=Ie({},t)},"saveConfigFromInitialize"),_M=v(t=>(dr=Ie(dr,t),Sc(dr,yi),dr),"updateSiteConfig"),db=v(()=>Ie({},dr),"getSiteConfig"),pb=v(t=>(gb(t),Ie(Do,t),Ce()),"setConfig"),Ce=v(()=>Ie({},Do),"getConfig"),fb=v(t=>{t&&(["secure",...dr.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(nt.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"&&fb(t[e])}))},"sanitize"),jM=v(t=>{var e;El(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),yi.push(t),Sc(dr,yi)},"addDirective"),Ll=v((t=dr)=>{yi=[],Sc(t,yi)},"reset"),NM={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."},qm={},mb=v(t=>{qm[t]||(nt.warn(NM[t]),qm[t]=!0)},"issueWarning"),gb=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&mb("LAZY_LOAD_DEPRECATED")},"checkConfig"),OY=v(()=>{let t={};Bl&&(t=Ie(t,Bl));for(const e of yi)t=Ie(t,e);return t},"getUserDefinedConfig"),ar=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&mb("FLOWCHART_HTML_LABELS_DEPRECATED"),Sn(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),ua=/<br\s*\/?>/gi,EM=v(t=>t?bb(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),BM=(()=>{let t=!1;return()=>{t||(xb(),t=!0)}})();function xb(){const t="data-temp-href-target";ks.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),ks.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(xb,"setupDompurifyHooks");var yb=v(t=>(BM(),ks.sanitize(t)),"removeScript"),Hm=v((t,e)=>{if(ar(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=yb(t):r!=="loose"&&(t=bb(t),t=t.replace(/</g,"<").replace(/>/g,">"),t=t.replace(/=/g,"="),t=IM(t))}return t},"sanitizeMore"),zr=v((t,e)=>t&&(e.dompurifyConfig?t=ks.sanitize(Hm(t,e),e.dompurifyConfig).toString():t=ks.sanitize(Hm(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),LM=v((t,e)=>typeof t=="string"?zr(t,e):t.flat().map(r=>zr(r,e)),"sanitizeTextOrArray"),AM=v(t=>ua.test(t),"hasBreaks"),MM=v(t=>t.split(ua),"splitBreaks"),IM=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),bb=v(t=>t.replace(ua,"#br#"),"breakToPlaceholder"),FM=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"),DM=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),PM=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),Um=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];OM(s,o)&&(i=s+","+o,n++,r.pop())}r.push($M(i))}return r.join("")},"parseGenericTypes"),ku=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),OM=v((t,e)=>{const r=ku(t,"~"),n=ku(e,"~");return r===1&&n===1},"shouldCombineSets"),$M=v(t=>{const e=ku(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"),Ym=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),vu=/\$\$(.*)\$\$/g,Yo=v(t=>{var e;return(((e=t.match(vu))==null?void 0:e.length)??0)>0},"hasKatex"),$Y=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await Cb(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"),RM=v(async(t,e)=>{if(!Yo(t))return t;if(!(Ym()||e.legacyMathML||e.forceLegacyMathML))return t.replace(vu,"MathML is unsupported in this environment.");{const{default:r}=await Vt(async()=>{const{default:i}=await import("./katex-C5jXJg4s.js");return{default:i}},[]),n=e.forceLegacyMathML||!Ym()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(ua).map(i=>Yo(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(vu,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),Cb=v(async(t,e)=>zr(await RM(t,e),e),"renderKatexSanitized"),da={getRows:EM,sanitizeText:zr,sanitizeTextOrArray:LM,hasBreaks:AM,splitBreaks:MM,lineBreakRegex:ua,removeScript:yb,getUrl:FM,evaluate:Sn,getMax:DM,getMin:PM},zM=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),WM=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"),kb=v(function(t,e,r,n){const i=WM(e,r,n);zM(t,i)},"configureSvgSize"),qM=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;nt.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;nt.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,nt.info(`Calculated bounds: ${a}x${l}`),kb(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"),il={};function wu(t){return[...t.cssRules].map(e=>e.cssText).join(`
|
|
320
|
+
`)}v(wu,"cssStyleSheetToString");var HM=v((t,e,r,n)=>{let i="";return t in il&&il[t]?i=il[t]({...r,svgId:n}):nt.warn(`No theme found for ${t}`),` & {
|
|
321
|
+
font-family: ${r.fontFamily};
|
|
322
|
+
font-size: ${r.fontSize};
|
|
323
|
+
fill: ${r.textColor}
|
|
324
|
+
}
|
|
325
|
+
@keyframes edge-animation-frame {
|
|
326
|
+
from {
|
|
327
|
+
stroke-dashoffset: 0;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
@keyframes dash {
|
|
331
|
+
to {
|
|
332
|
+
stroke-dashoffset: 0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
& .edge-animation-slow {
|
|
336
|
+
stroke-dasharray: 9,5 !important;
|
|
337
|
+
stroke-dashoffset: 900;
|
|
338
|
+
animation: dash 50s linear infinite;
|
|
339
|
+
stroke-linecap: round;
|
|
340
|
+
}
|
|
341
|
+
& .edge-animation-fast {
|
|
342
|
+
stroke-dasharray: 9,5 !important;
|
|
343
|
+
stroke-dashoffset: 900;
|
|
344
|
+
animation: dash 20s linear infinite;
|
|
345
|
+
stroke-linecap: round;
|
|
346
|
+
}
|
|
347
|
+
/* Classes common for multiple diagrams */
|
|
348
|
+
|
|
349
|
+
& .error-icon {
|
|
350
|
+
fill: ${r.errorBkgColor};
|
|
351
|
+
}
|
|
352
|
+
& .error-text {
|
|
353
|
+
fill: ${r.errorTextColor};
|
|
354
|
+
stroke: ${r.errorTextColor};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
& .edge-thickness-normal {
|
|
358
|
+
stroke-width: ${r.strokeWidth??1}px;
|
|
359
|
+
}
|
|
360
|
+
& .edge-thickness-thick {
|
|
361
|
+
stroke-width: 3.5px
|
|
362
|
+
}
|
|
363
|
+
& .edge-pattern-solid {
|
|
364
|
+
stroke-dasharray: 0;
|
|
365
|
+
}
|
|
366
|
+
& .edge-thickness-invisible {
|
|
367
|
+
stroke-width: 0;
|
|
368
|
+
fill: none;
|
|
369
|
+
}
|
|
370
|
+
& .edge-pattern-dashed{
|
|
371
|
+
stroke-dasharray: 3;
|
|
372
|
+
}
|
|
373
|
+
.edge-pattern-dotted {
|
|
374
|
+
stroke-dasharray: 2;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
& .marker {
|
|
378
|
+
fill: ${r.lineColor};
|
|
379
|
+
stroke: ${r.lineColor};
|
|
380
|
+
}
|
|
381
|
+
& .marker.cross {
|
|
382
|
+
stroke: ${r.lineColor};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
& svg {
|
|
386
|
+
font-family: ${r.fontFamily};
|
|
387
|
+
font-size: ${r.fontSize};
|
|
388
|
+
}
|
|
389
|
+
& p {
|
|
390
|
+
margin: 0
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
${i}
|
|
394
|
+
.node .neo-node {
|
|
395
|
+
stroke: ${r.nodeBorder};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
[data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
|
|
399
|
+
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
400
|
+
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
[data-look="neo"].node path {
|
|
405
|
+
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
406
|
+
stroke-width: ${r.strokeWidth??1}px;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
[data-look="neo"].node .outer-path {
|
|
410
|
+
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
[data-look="neo"].node .neo-line path {
|
|
414
|
+
stroke: ${r.nodeBorder};
|
|
415
|
+
filter: none;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
[data-look="neo"].node circle{
|
|
419
|
+
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
420
|
+
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
[data-look="neo"].node circle .state-start{
|
|
424
|
+
fill: #000000;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
[data-look="neo"].icon-shape .icon {
|
|
428
|
+
fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
429
|
+
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
[data-look="neo"].icon-shape .icon-neo path {
|
|
433
|
+
stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
|
|
434
|
+
filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
${e}
|
|
438
|
+
`},"getStyles"),UM=v((t,e)=>{e!==void 0&&(il[t]=e)},"addStylesForDiagram"),YM=HM,vb={};m3(vb,{clear:()=>VM,getAccDescription:()=>QM,getAccTitle:()=>XM,getDiagramTitle:()=>JM,setAccDescription:()=>KM,setAccTitle:()=>GM,setDiagramTitle:()=>ZM});var dp="",pp="",fp="",mp=v(t=>zr(t,Ce()),"sanitizeText"),VM=v(()=>{dp="",fp="",pp=""},"clear"),GM=v(t=>{dp=mp(t).replace(/^\s+/g,"")},"setAccTitle"),XM=v(()=>dp,"getAccTitle"),KM=v(t=>{fp=mp(t).replace(/\n\s+/g,`
|
|
439
|
+
`)},"setAccDescription"),QM=v(()=>fp,"getAccDescription"),ZM=v(t=>{pp=mp(t)},"setDiagramTitle"),JM=v(()=>pp,"getDiagramTitle"),Vm=nt,tI=hp,Qt=Ce,RY=pb,zY=vs,gp=v(t=>zr(t,Qt()),"sanitizeText"),eI=qM,rI=v(()=>vb,"getCommonDb"),Al={},Ml=v((t,e,r)=>{var n;Al[t]&&Vm.warn(`Diagram with id ${t} already registered. Overwriting.`),Al[t]=e,r&&ab(t,r),UM(t,e.styles),(n=e.injectUtils)==null||n.call(e,Vm,tI,Qt,gp,eI,rI(),()=>{})},"registerDiagram"),Su=v(t=>{if(t in Al)return Al[t];throw new nI(t)},"getDiagram"),gs,nI=(gs=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(gs,"DiagramNotFoundError"),gs),iI={value:()=>{}};function wb(){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 sl(r)}function sl(t){this._=t}function sI(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}})}sl.prototype=wb.prototype={constructor:sl,on:function(t,e){var r=this._,n=sI(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=oI(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]=Gm(r[i],t.name,e);else if(e==null)for(i in r)r[i]=Gm(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 sl(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 oI(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function Gm(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=iI,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var Tu="http://www.w3.org/1999/xhtml";const Xm={svg:"http://www.w3.org/2000/svg",xhtml:Tu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Tc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),Xm.hasOwnProperty(e)?{space:Xm[e],local:t}:t}function aI(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Tu&&e.documentElement.namespaceURI===Tu?e.createElement(t):e.createElementNS(r,t)}}function lI(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Sb(t){var e=Tc(t);return(e.local?lI:aI)(e)}function cI(){}function xp(t){return t==null?cI:function(){return this.querySelector(t)}}function hI(t){typeof t!="function"&&(t=xp(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 Tr(n,this._parents)}function uI(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function dI(){return[]}function Tb(t){return t==null?dI:function(){return this.querySelectorAll(t)}}function pI(t){return function(){return uI(t.apply(this,arguments))}}function fI(t){typeof t=="function"?t=pI(t):t=Tb(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 Tr(n,i)}function _b(t){return function(){return this.matches(t)}}function jb(t){return function(e){return e.matches(t)}}var mI=Array.prototype.find;function gI(t){return function(){return mI.call(this.children,t)}}function xI(){return this.firstElementChild}function yI(t){return this.select(t==null?xI:gI(typeof t=="function"?t:jb(t)))}var bI=Array.prototype.filter;function CI(){return Array.from(this.children)}function kI(t){return function(){return bI.call(this.children,t)}}function vI(t){return this.selectAll(t==null?CI:kI(typeof t=="function"?t:jb(t)))}function wI(t){typeof t!="function"&&(t=_b(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 Tr(n,this._parents)}function Nb(t){return new Array(t.length)}function SI(){return new Tr(this._enter||this._groups.map(Nb),this._parents)}function Il(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Il.prototype={constructor:Il,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 TI(t){return function(){return t}}function _I(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 Il(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function jI(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 Il(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&h.get(f[a])===l&&(i[a]=l)}function NI(t){return t.__data__}function EI(t,e){if(!arguments.length)return Array.from(this,NI);var r=e?jI:_I,n=this._parents,i=this._groups;typeof t!="function"&&(t=TI(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=BI(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 Tr(o,n),o._enter=a,o._exit=l,o}function BI(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function LI(){return new Tr(this._exit||this._groups.map(Nb),this._parents)}function AI(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 MI(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 Tr(a,this._parents)}function II(){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 FI(t){t||(t=DI);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 Tr(i,this._parents).order()}function DI(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function PI(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function OI(){return Array.from(this)}function $I(){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 RI(){let t=0;for(const e of this)++t;return t}function zI(){return!this.node()}function WI(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 qI(t){return function(){this.removeAttribute(t)}}function HI(t){return function(){this.removeAttributeNS(t.space,t.local)}}function UI(t,e){return function(){this.setAttribute(t,e)}}function YI(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function VI(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function GI(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 XI(t,e){var r=Tc(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?HI:qI:typeof e=="function"?r.local?GI:VI:r.local?YI:UI)(r,e))}function Eb(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function KI(t){return function(){this.style.removeProperty(t)}}function QI(t,e,r){return function(){this.style.setProperty(t,e,r)}}function ZI(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function JI(t,e,r){return arguments.length>1?this.each((e==null?KI:typeof e=="function"?ZI:QI)(t,e,r??"")):ws(this.node(),t)}function ws(t,e){return t.style.getPropertyValue(e)||Eb(t).getComputedStyle(t,null).getPropertyValue(e)}function tF(t){return function(){delete this[t]}}function eF(t,e){return function(){this[t]=e}}function rF(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function nF(t,e){return arguments.length>1?this.each((e==null?tF:typeof e=="function"?rF:eF)(t,e)):this.node()[t]}function Bb(t){return t.trim().split(/^|\s+/)}function yp(t){return t.classList||new Lb(t)}function Lb(t){this._node=t,this._names=Bb(t.getAttribute("class")||"")}Lb.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 Ab(t,e){for(var r=yp(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function Mb(t,e){for(var r=yp(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function iF(t){return function(){Ab(this,t)}}function sF(t){return function(){Mb(this,t)}}function oF(t,e){return function(){(e.apply(this,arguments)?Ab:Mb)(this,t)}}function aF(t,e){var r=Bb(t+"");if(arguments.length<2){for(var n=yp(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?oF:e?iF:sF)(r,e))}function lF(){this.textContent=""}function cF(t){return function(){this.textContent=t}}function hF(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function uF(t){return arguments.length?this.each(t==null?lF:(typeof t=="function"?hF:cF)(t)):this.node().textContent}function dF(){this.innerHTML=""}function pF(t){return function(){this.innerHTML=t}}function fF(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function mF(t){return arguments.length?this.each(t==null?dF:(typeof t=="function"?fF:pF)(t)):this.node().innerHTML}function gF(){this.nextSibling&&this.parentNode.appendChild(this)}function xF(){return this.each(gF)}function yF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function bF(){return this.each(yF)}function CF(t){var e=typeof t=="function"?t:Sb(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function kF(){return null}function vF(t,e){var r=typeof t=="function"?t:Sb(t),n=e==null?kF:typeof e=="function"?e:xp(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function wF(){var t=this.parentNode;t&&t.removeChild(this)}function SF(){return this.each(wF)}function TF(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function _F(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function jF(t){return this.select(t?_F:TF)}function NF(t){return arguments.length?this.property("__data__",t):this.node().__data__}function EF(t){return function(e){t.call(this,e,this.__data__)}}function BF(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 LF(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 AF(t,e,r){return function(){var n=this.__on,i,s=EF(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 MF(t,e,r){var n=BF(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?AF:LF,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function Ib(t,e,r){var n=Eb(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 IF(t,e){return function(){return Ib(this,t,e)}}function FF(t,e){return function(){return Ib(this,t,e.apply(this,arguments))}}function DF(t,e){return this.each((typeof e=="function"?FF:IF)(t,e))}function*PF(){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 Fb=[null];function Tr(t,e){this._groups=t,this._parents=e}function pa(){return new Tr([[document.documentElement]],Fb)}function OF(){return this}Tr.prototype=pa.prototype={constructor:Tr,select:hI,selectAll:fI,selectChild:yI,selectChildren:vI,filter:wI,data:EI,enter:SI,exit:LI,join:AI,merge:MI,selection:OF,order:II,sort:FI,call:PI,nodes:OI,node:$I,size:RI,empty:zI,each:WI,attr:XI,style:JI,property:nF,classed:aF,text:uF,html:mF,raise:xF,lower:bF,append:CF,insert:vF,remove:SF,clone:jF,datum:NF,on:MF,dispatch:DF,[Symbol.iterator]:PF};function qt(t){return typeof t=="string"?new Tr([[document.querySelector(t)]],[document.documentElement]):new Tr([[t]],Fb)}function bp(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function Db(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function fa(){}var Vo=.7,Fl=1/Vo,es="\\s*([+-]?\\d+)\\s*",Go="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$F=/^#([0-9a-f]{3,8})$/,RF=new RegExp(`^rgb\\(${es},${es},${es}\\)$`),zF=new RegExp(`^rgb\\(${Qr},${Qr},${Qr}\\)$`),WF=new RegExp(`^rgba\\(${es},${es},${es},${Go}\\)$`),qF=new RegExp(`^rgba\\(${Qr},${Qr},${Qr},${Go}\\)$`),HF=new RegExp(`^hsl\\(${Go},${Qr},${Qr}\\)$`),UF=new RegExp(`^hsla\\(${Go},${Qr},${Qr},${Go}\\)$`),Km={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};bp(fa,Xo,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Qm,formatHex:Qm,formatHex8:YF,formatHsl:VF,formatRgb:Zm,toString:Zm});function Qm(){return this.rgb().formatHex()}function YF(){return this.rgb().formatHex8()}function VF(){return Pb(this).formatHsl()}function Zm(){return this.rgb().formatRgb()}function Xo(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=$F.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?Jm(e):r===3?new fr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Ia(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Ia(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=RF.exec(t))?new fr(e[1],e[2],e[3],1):(e=zF.exec(t))?new fr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=WF.exec(t))?Ia(e[1],e[2],e[3],e[4]):(e=qF.exec(t))?Ia(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=HF.exec(t))?rg(e[1],e[2]/100,e[3]/100,1):(e=UF.exec(t))?rg(e[1],e[2]/100,e[3]/100,e[4]):Km.hasOwnProperty(t)?Jm(Km[t]):t==="transparent"?new fr(NaN,NaN,NaN,0):null}function Jm(t){return new fr(t>>16&255,t>>8&255,t&255,1)}function Ia(t,e,r,n){return n<=0&&(t=e=r=NaN),new fr(t,e,r,n)}function GF(t){return t instanceof fa||(t=Xo(t)),t?(t=t.rgb(),new fr(t.r,t.g,t.b,t.opacity)):new fr}function _u(t,e,r,n){return arguments.length===1?GF(t):new fr(t,e,r,n??1)}function fr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}bp(fr,_u,Db(fa,{brighter(t){return t=t==null?Fl:Math.pow(Fl,t),new fr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Vo:Math.pow(Vo,t),new fr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new fr(di(this.r),di(this.g),di(this.b),Dl(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tg,formatHex:tg,formatHex8:XF,formatRgb:eg,toString:eg}));function tg(){return`#${ai(this.r)}${ai(this.g)}${ai(this.b)}`}function XF(){return`#${ai(this.r)}${ai(this.g)}${ai(this.b)}${ai((isNaN(this.opacity)?1:this.opacity)*255)}`}function eg(){const t=Dl(this.opacity);return`${t===1?"rgb(":"rgba("}${di(this.r)}, ${di(this.g)}, ${di(this.b)}${t===1?")":`, ${t})`}`}function Dl(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function di(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ai(t){return t=di(t),(t<16?"0":"")+t.toString(16)}function rg(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 Pb(t){if(t instanceof Dr)return new Dr(t.h,t.s,t.l,t.opacity);if(t instanceof fa||(t=Xo(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 KF(t,e,r,n){return arguments.length===1?Pb(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}bp(Dr,KF,Db(fa,{brighter(t){return t=t==null?Fl:Math.pow(Fl,t),new Dr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Vo:Math.pow(Vo,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 fr(Eh(t>=240?t-240:t+120,i,n),Eh(t,i,n),Eh(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Dr(ng(this.h),Fa(this.s),Fa(this.l),Dl(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Dl(this.opacity);return`${t===1?"hsl(":"hsla("}${ng(this.h)}, ${Fa(this.s)*100}%, ${Fa(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ng(t){return t=(t||0)%360,t<0?t+360:t}function Fa(t){return Math.max(0,Math.min(1,t||0))}function Eh(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 Cp=t=>()=>t;function Ob(t,e){return function(r){return t+r*e}}function QF(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 WY(t,e){var r=e-t;return r?Ob(t,r>180||r<-180?r-360*Math.round(r/360):r):Cp(isNaN(t)?e:t)}function ZF(t){return(t=+t)==1?$b:function(e,r){return r-e?QF(e,r,t):Cp(isNaN(e)?r:e)}}function $b(t,e){var r=e-t;return r?Ob(t,r):Cp(isNaN(t)?e:t)}const ig=(function t(e){var r=ZF(e);function n(i,s){var o=r((i=_u(i)).r,(s=_u(s)).r),a=r(i.g,s.g),l=r(i.b,s.b),h=$b(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 In(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var ju=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bh=new RegExp(ju.source,"g");function JF(t){return function(){return t}}function t4(t){return function(e){return t(e)+""}}function e4(t,e){var r=ju.lastIndex=Bh.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=ju.exec(t))&&(i=Bh.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:In(n,i)})),r=Bh.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?t4(l[0].x):JF(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 sg=180/Math.PI,Nu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Rb(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)*sg,skewX:Math.atan(l)*sg,scaleX:o,scaleY:a}}var Da;function r4(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Nu:Rb(e.a,e.b,e.c,e.d,e.e,e.f)}function n4(t){return t==null||(Da||(Da=document.createElementNS("http://www.w3.org/2000/svg","g")),Da.setAttribute("transform",t),!(t=Da.transform.baseVal.consolidate()))?Nu:(t=t.matrix,Rb(t.a,t.b,t.c,t.d,t.e,t.f))}function zb(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:In(h,d)},{i:x-2,x:In(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:In(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:In(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:In(h,d)},{i:x-2,x:In(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 i4=zb(r4,"px, ","px)","deg)"),s4=zb(n4,", ",")",")"),Ss=0,wo=0,ao=0,Wb=1e3,Pl,So,Ol=0,bi=0,_c=0,Ko=typeof performance=="object"&&performance.now?performance:Date,qb=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function kp(){return bi||(qb(o4),bi=Ko.now()+_c)}function o4(){bi=0}function $l(){this._call=this._time=this._next=null}$l.prototype=Hb.prototype={constructor:$l,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?kp():+r)+(e==null?0:+e),!this._next&&So!==this&&(So?So._next=this:Pl=this,So=this),this._call=t,this._time=r,Eu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Eu())}};function Hb(t,e,r){var n=new $l;return n.restart(t,e,r),n}function a4(){kp(),++Ss;for(var t=Pl,e;t;)(e=bi-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ss}function og(){bi=(Ol=Ko.now())+_c,Ss=wo=0;try{a4()}finally{Ss=0,c4(),bi=0}}function l4(){var t=Ko.now(),e=t-Ol;e>Wb&&(_c-=e,Ol=t)}function c4(){for(var t,e=Pl,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:Pl=r);So=t,Eu(n)}function Eu(t){if(!Ss){wo&&(wo=clearTimeout(wo));var e=t-bi;e>24?(t<1/0&&(wo=setTimeout(og,t-Ko.now()-_c)),ao&&(ao=clearInterval(ao))):(ao||(Ol=Ko.now(),ao=setInterval(l4,Wb)),Ss=1,qb(og))}}function ag(t,e,r){var n=new $l;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var h4=wb("start","end","cancel","interrupt"),u4=[],Ub=0,lg=1,Bu=2,ol=3,cg=4,Lu=5,al=6;function jc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;d4(t,r,{name:e,index:n,group:i,on:h4,tween:u4,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ub})}function vp(t,e){var r=qr(t,e);if(r.state>Ub)throw new Error("too late; already scheduled");return r}function sn(t,e){var r=qr(t,e);if(r.state>ol)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 d4(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=Hb(s,0,r.time);function s(h){r.state=lg,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!==lg)return l();for(u in n)if(p=n[u],p.name===r.name){if(p.state===ol)return ag(o);p.state===cg?(p.state=al,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete n[u]):+u<e&&(p.state=al,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete n[u])}if(ag(function(){r.state===ol&&(r.state=cg,r.timer.restart(a,r.delay,r.time),a(h))}),r.state=Bu,r.on.call("start",t,t.__data__,r.index,r.group),r.state===Bu){for(r.state=ol,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=Lu,1),d=-1,f=i.length;++d<f;)i[d].call(t,u);r.state===Lu&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=al,r.timer.stop(),delete n[e];for(var h in n)return;delete t.__transition}}function p4(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>Bu&&n.state<Lu,n.state=al,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function f4(t){return this.each(function(){p4(this,t)})}function m4(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 g4(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 x4(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?m4:g4)(r,t,e))}function wp(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 Yb(t,e){var r;return(typeof e=="number"?In:e instanceof Xo?ig:(r=Xo(e))?(e=r,ig):e4)(t,e)}function y4(t){return function(){this.removeAttribute(t)}}function b4(t){return function(){this.removeAttributeNS(t.space,t.local)}}function C4(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 k4(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 v4(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 w4(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 S4(t,e){var r=Tc(t),n=r==="transform"?s4:Yb;return this.attrTween(t,typeof e=="function"?(r.local?w4:v4)(r,n,wp(this,"attr."+t,e)):e==null?(r.local?b4:y4)(r):(r.local?k4:C4)(r,n,e))}function T4(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function _4(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function j4(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&_4(t,s)),r}return i._value=e,i}function N4(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&T4(t,s)),r}return i._value=e,i}function E4(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=Tc(t);return this.tween(r,(n.local?j4:N4)(n,e))}function B4(t,e){return function(){vp(this,t).delay=+e.apply(this,arguments)}}function L4(t,e){return e=+e,function(){vp(this,t).delay=e}}function A4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?B4:L4)(e,t)):qr(this.node(),e).delay}function M4(t,e){return function(){sn(this,t).duration=+e.apply(this,arguments)}}function I4(t,e){return e=+e,function(){sn(this,t).duration=e}}function F4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?M4:I4)(e,t)):qr(this.node(),e).duration}function D4(t,e){if(typeof e!="function")throw new Error;return function(){sn(this,t).ease=e}}function P4(t){var e=this._id;return arguments.length?this.each(D4(e,t)):qr(this.node(),e).ease}function O4(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;sn(this,t).ease=r}}function $4(t){if(typeof t!="function")throw new Error;return this.each(O4(this._id,t))}function R4(t){typeof t!="function"&&(t=_b(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 bn(n,this._parents,this._name,this._id)}function z4(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 bn(o,this._parents,this._name,this._id)}function W4(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 q4(t,e,r){var n,i,s=W4(e)?vp:sn;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function H4(t,e){var r=this._id;return arguments.length<2?qr(this.node(),r).on.on(t):this.each(q4(r,t,e))}function U4(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function Y4(){return this.on("end.remove",U4(this._id))}function V4(t){var e=this._name,r=this._id;typeof t!="function"&&(t=xp(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,jc(h[f],e,r,f,h,qr(u,r)));return new bn(s,this._parents,e,r)}function G4(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Tb(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])&&jc(p,e,r,x,f,m);s.push(f),o.push(u)}return new bn(s,o,e,r)}var X4=pa.prototype.constructor;function K4(){return new X4(this._groups,this._parents)}function Q4(t,e){var r,n,i;return function(){var s=ws(this,t),o=(this.style.removeProperty(t),ws(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function Vb(t){return function(){this.style.removeProperty(t)}}function Z4(t,e,r){var n,i=r+"",s;return function(){var o=ws(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function J4(t,e,r){var n,i,s;return function(){var o=ws(this,t),a=r(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),ws(this,t))),o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a))}}function tD(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=Vb(e)):void 0;(h!==r||i!==u)&&(n=(r=h).copy()).on(o,i=u),l.on=n}}function eD(t,e,r){var n=(t+="")=="transform"?i4:Yb;return e==null?this.styleTween(t,Q4(t,n)).on("end.style."+t,Vb(t)):typeof e=="function"?this.styleTween(t,J4(t,n,wp(this,"style."+t,e))).each(tD(this._id,t)):this.styleTween(t,Z4(t,n,e),r).on("end.style."+t,null)}function rD(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function nD(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&rD(t,o,r)),n}return s._value=e,s}function iD(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,nD(t,e,r??""))}function sD(t){return function(){this.textContent=t}}function oD(t){return function(){var e=t(this);this.textContent=e??""}}function aD(t){return this.tween("text",typeof t=="function"?oD(wp(this,"text",t)):sD(t==null?"":t+""))}function lD(t){return function(e){this.textContent=t.call(this,e)}}function cD(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&lD(i)),e}return n._value=t,n}function hD(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,cD(t))}function uD(){for(var t=this._name,e=this._id,r=Gb(),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);jc(l,t,r,h,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new bn(n,this._parents,t,r)}function dD(){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 pD=0;function bn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function Gb(){return++pD}var pn=pa.prototype;bn.prototype={constructor:bn,select:V4,selectAll:G4,selectChild:pn.selectChild,selectChildren:pn.selectChildren,filter:R4,merge:z4,selection:K4,transition:uD,call:pn.call,nodes:pn.nodes,node:pn.node,size:pn.size,empty:pn.empty,each:pn.each,on:H4,attr:S4,attrTween:E4,style:eD,styleTween:iD,text:aD,textTween:hD,remove:Y4,tween:x4,delay:A4,duration:F4,ease:P4,easeVarying:$4,end:dD,[Symbol.iterator]:pn[Symbol.iterator]};function fD(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var mD={time:null,delay:0,duration:250,ease:fD};function gD(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 xD(t){var e,r;t instanceof bn?(e=t._id,t=t._name):(e=Gb(),(r=mD).time=kp(),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])&&jc(l,t,e,h,o,r||gD(l,e));return new bn(n,this._parents,t,e)}pa.prototype.interrupt=f4;pa.prototype.transition=xD;const Au=Math.PI,Mu=2*Au,ri=1e-6,yD=Mu-ri;function Xb(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function bD(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Xb;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 CD{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Xb:bD(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>ri)if(!(Math.abs(d*l-h*u)>ri)||!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((Au-Math.acos((x+f-g)/(2*y*C)))/2),w=b/C,_=b/y;Math.abs(w-1)>ri&&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)>ri||Math.abs(this._y1-u)>ri)&&this._append`L${h},${u}`,n&&(f<0&&(f=f%Mu+Mu),f>yD?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>ri&&this._append`A${n},${n},0,${+(f>=Au)},${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 Oi(t){return function(){return t}}const qY=Math.abs,HY=Math.atan2,UY=Math.cos,YY=Math.max,VY=Math.min,GY=Math.sin,XY=Math.sqrt,hg=1e-12,Sp=Math.PI,ug=Sp/2,KY=2*Sp;function QY(t){return t>1?0:t<-1?Sp:Math.acos(t)}function ZY(t){return t>=1?ug:t<=-1?-ug:Math.asin(t)}function kD(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 CD(e)}function vD(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Kb(t){this._context=t}Kb.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 Po(t){return new Kb(t)}function wD(t){return t[0]}function SD(t){return t[1]}function TD(t,e){var r=Oi(!0),n=null,i=Po,s=null,o=kD(a);t=typeof t=="function"?t:t===void 0?wD:Oi(t),e=typeof e=="function"?e:e===void 0?SD:Oi(e);function a(l){var h,u=(l=vD(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:Oi(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:Oi(+l),a):e},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:Oi(!!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 Qb{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 Zb(t){return new Qb(t,!0)}function Jb(t){return new Qb(t,!1)}function qn(){}function Rl(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 Nc(t){this._context=t}Nc.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:Rl(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:Rl(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Iu(t){return new Nc(t)}function t1(t){this._context=t}t1.prototype={areaStart:qn,areaEnd:qn,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:Rl(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function _D(t){return new t1(t)}function e1(t){this._context=t}e1.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:Rl(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function jD(t){return new e1(t)}function r1(t,e){this._basis=new Nc(t),this._beta=e}r1.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 ND=(function t(e){function r(n){return e===1?new Nc(n):new r1(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function zl(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 Tp(t,e){this._context=t,this._k=(1-e)/6}Tp.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:zl(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:zl(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 n1=(function t(e){function r(n){return new Tp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function _p(t,e){this._context=t,this._k=(1-e)/6}_p.prototype={areaStart:qn,areaEnd:qn,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:zl(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 ED=(function t(e){function r(n){return new _p(n,e)}return r.tension=function(n){return t(+n)},r})(0);function jp(t,e){this._context=t,this._k=(1-e)/6}jp.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:zl(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 BD=(function t(e){function r(n){return new jp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function Np(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>hg){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>hg){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 i1(t,e){this._context=t,this._alpha=e}i1.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:Np(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 s1=(function t(e){function r(n){return e?new i1(n,e):new Tp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function o1(t,e){this._context=t,this._alpha=e}o1.prototype={areaStart:qn,areaEnd:qn,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:Np(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 LD=(function t(e){function r(n){return e?new o1(n,e):new _p(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function a1(t,e){this._context=t,this._alpha=e}a1.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:Np(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 AD=(function t(e){function r(n){return e?new a1(n,e):new jp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function l1(t){this._context=t}l1.prototype={areaStart:qn,areaEnd:qn,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 MD(t){return new l1(t)}function dg(t){return t<0?-1:1}function pg(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(dg(s)+dg(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function fg(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Lh(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 Wl(t){this._context=t}Wl.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:Lh(this,this._t0,fg(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,Lh(this,fg(this,r=pg(this,t,e)),r);break;default:Lh(this,this._t0,r=pg(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function c1(t){this._context=new h1(t)}(c1.prototype=Object.create(Wl.prototype)).point=function(t,e){Wl.prototype.point.call(this,e,t)};function h1(t){this._context=t}h1.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 u1(t){return new Wl(t)}function d1(t){return new c1(t)}function p1(t){this._context=t}p1.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=mg(t),i=mg(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 mg(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 f1(t){return new p1(t)}function Ec(t,e){this._context=t,this._t=e}Ec.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 m1(t){return new Ec(t,.5)}function g1(t){return new Ec(t,0)}function x1(t){return new Ec(t,1)}function To(t,e,r){this.k=t,this.x=e,this.y=r}To.prototype={constructor:To,scale:function(t){return t===1?this:new To(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new To(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+")"}};To.prototype;var ID=v(t=>{var i;const{securityLevel:e}=Qt();let r=qt("body");if(e==="sandbox"){const o=((i=qt(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=qt(o.body)}return r.select(`#${t}`)},"selectSvgElement");function Ep(t){return typeof t>"u"||t===null}v(Ep,"isNothing");function y1(t){return typeof t=="object"&&t!==null}v(y1,"isObject");function b1(t){return Array.isArray(t)?t:Ep(t)?[]:[t]}v(b1,"toArray");function C1(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(C1,"extend");function k1(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(k1,"repeat");function v1(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(v1,"isNegativeZero");var FD=Ep,DD=y1,PD=b1,OD=k1,$D=v1,RD=C1,Fe={isNothing:FD,isObject:DD,toArray:PD,repeat:OD,isNegativeZero:$D,extend:RD};function Bp(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+=`
|
|
440
|
+
|
|
441
|
+
`+t.mark.snippet),n+" "+r):n}v(Bp,"formatError");function Ts(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=Bp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}v(Ts,"YAMLException$1");Ts.prototype=Object.create(Error.prototype);Ts.prototype.constructor=Ts;Ts.prototype.toString=v(function(e){return this.name+": "+Bp(this,e)},"toString");var pr=Ts;function ll(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(ll,"getLine");function cl(t,e){return Fe.repeat(" ",e-t.length)+t}v(cl,"padStart");function w1(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=ll(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Fe.repeat(" ",e.indent)+cl((t.line-l+1).toString(),u)+" | "+h.str+`
|
|
442
|
+
`+a;for(h=ll(t.buffer,n[o],i[o],t.position,d),a+=Fe.repeat(" ",e.indent)+cl((t.line+1).toString(),u)+" | "+h.str+`
|
|
443
|
+
`,a+=Fe.repeat("-",e.indent+u+3+h.pos)+`^
|
|
444
|
+
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)h=ll(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Fe.repeat(" ",e.indent)+cl((t.line+l+1).toString(),u)+" | "+h.str+`
|
|
445
|
+
`;return a.replace(/\n$/,"")}v(w1,"makeSnippet");var zD=w1,WD=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],qD=["scalar","sequence","mapping"];function S1(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v(S1,"compileStyleAliases");function T1(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(WD.indexOf(r)===-1)throw new pr('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=S1(e.styleAliases||null),qD.indexOf(this.kind)===-1)throw new pr('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(T1,"Type$1");var Qe=T1;function Fu(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(Fu,"compileList");function _1(){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(_1,"compileMap");function ql(t){return this.extend(t)}v(ql,"Schema$1");ql.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Qe)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 pr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Qe))throw new pr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new pr("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 pr("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 Qe))throw new pr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(ql.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=Fu(i,"implicit"),i.compiledExplicit=Fu(i,"explicit"),i.compiledTypeMap=_1(i.compiledImplicit,i.compiledExplicit),i},"extend");var HD=ql,UD=new Qe("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),YD=new Qe("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),VD=new Qe("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),GD=new HD({explicit:[UD,YD,VD]});function j1(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(j1,"resolveYamlNull");function N1(){return null}v(N1,"constructYamlNull");function E1(t){return t===null}v(E1,"isNull");var XD=new Qe("tag:yaml.org,2002:null",{kind:"scalar",resolve:j1,construct:N1,predicate:E1,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 B1(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(B1,"resolveYamlBoolean");function L1(t){return t==="true"||t==="True"||t==="TRUE"}v(L1,"constructYamlBoolean");function A1(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(A1,"isBoolean");var KD=new Qe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:B1,construct:L1,predicate:A1,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 M1(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(M1,"isHexCode");function I1(t){return 48<=t&&t<=55}v(I1,"isOctCode");function F1(t){return 48<=t&&t<=57}v(F1,"isDecCode");function D1(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(!M1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!I1(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!F1(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(D1,"resolveYamlInteger");function P1(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(P1,"constructYamlInteger");function O1(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Fe.isNegativeZero(t)}v(O1,"isInteger");var QD=new Qe("tag:yaml.org,2002:int",{kind:"scalar",resolve:D1,construct:P1,predicate:O1,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"]}}),ZD=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function $1(t){return!(t===null||!ZD.test(t)||t[t.length-1]==="_")}v($1,"resolveYamlFloat");function R1(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(R1,"constructYamlFloat");var JD=/^[-+]?[0-9]+e/;function z1(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(Fe.isNegativeZero(t))return"-0.0";return r=t.toString(10),JD.test(r)?r.replace("e",".e"):r}v(z1,"representYamlFloat");function W1(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Fe.isNegativeZero(t))}v(W1,"isFloat");var tP=new Qe("tag:yaml.org,2002:float",{kind:"scalar",resolve:$1,construct:R1,predicate:W1,represent:z1,defaultStyle:"lowercase"}),q1=GD.extend({implicit:[XD,KD,QD,tP]}),eP=q1,H1=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),U1=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 Y1(t){return t===null?!1:H1.exec(t)!==null||U1.exec(t)!==null}v(Y1,"resolveYamlTimestamp");function V1(t){var e,r,n,i,s,o,a,l=0,h=null,u,d,f;if(e=H1.exec(t),e===null&&(e=U1.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(V1,"constructYamlTimestamp");function G1(t){return t.toISOString()}v(G1,"representYamlTimestamp");var rP=new Qe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Y1,construct:V1,instanceOf:Date,represent:G1});function X1(t){return t==="<<"||t===null}v(X1,"resolveYamlMerge");var nP=new Qe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:X1}),Lp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
446
|
+
\r`;function K1(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=Lp;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(K1,"resolveYamlBinary");function Q1(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=Lp,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(Q1,"constructYamlBinary");function Z1(t){var e="",r=0,n,i,s=t.length,o=Lp;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(Z1,"representYamlBinary");function J1(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(J1,"isBinary");var iP=new Qe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:K1,construct:Q1,predicate:J1,represent:Z1}),sP=Object.prototype.hasOwnProperty,oP=Object.prototype.toString;function tC(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,oP.call(i)!=="[object Object]")return!1;for(s in i)if(sP.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(tC,"resolveYamlOmap");function eC(t){return t!==null?t:[]}v(eC,"constructYamlOmap");var aP=new Qe("tag:yaml.org,2002:omap",{kind:"sequence",resolve:tC,construct:eC}),lP=Object.prototype.toString;function rC(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],lP.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}v(rC,"resolveYamlPairs");function nC(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(nC,"constructYamlPairs");var cP=new Qe("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:rC,construct:nC}),hP=Object.prototype.hasOwnProperty;function iC(t){if(t===null)return!0;var e,r=t;for(e in r)if(hP.call(r,e)&&r[e]!==null)return!1;return!0}v(iC,"resolveYamlSet");function sC(t){return t!==null?t:{}}v(sC,"constructYamlSet");var uP=new Qe("tag:yaml.org,2002:set",{kind:"mapping",resolve:iC,construct:sC}),oC=eP.extend({implicit:[rP,nP],explicit:[iP,aP,cP,uP]}),Hn=Object.prototype.hasOwnProperty,Hl=1,aC=2,lC=3,Ul=4,Ah=1,dP=2,gg=3,pP=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,fP=/[\x85\u2028\u2029]/,mP=/[,\[\]\{\}]/,cC=/^(?:!|!!|![a-z\-]+!)$/i,hC=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Du(t){return Object.prototype.toString.call(t)}v(Du,"_class");function $r(t){return t===10||t===13}v($r,"is_EOL");function $n(t){return t===9||t===32}v($n,"is_WHITE_SPACE");function ir(t){return t===9||t===32||t===10||t===13}v(ir,"is_WS_OR_EOL");function li(t){return t===44||t===91||t===93||t===123||t===125}v(li,"is_FLOW_INDICATOR");function uC(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(uC,"fromHexCode");function dC(t){return t===120?2:t===117?4:t===85?8:0}v(dC,"escapedHexLen");function pC(t){return 48<=t&&t<=57?t-48:-1}v(pC,"fromDecimalCode");function Pu(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
|
|
447
|
+
`: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(Pu,"simpleEscapeSequence");function fC(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v(fC,"charFromCodepoint");function Ap(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(Ap,"setProperty");var mC=new Array(256),gC=new Array(256);for(ti=0;ti<256;ti++)mC[ti]=Pu(ti)?1:0,gC[ti]=Pu(ti);var ti;function xC(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||oC,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(xC,"State$1");function Mp(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=zD(r),new pr(e,r)}v(Mp,"generateError");function wt(t,e){throw Mp(t,e)}v(wt,"throwError");function Qo(t,e){t.onWarning&&t.onWarning.call(null,Mp(t,e))}v(Qo,"throwWarning");var xg={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&wt(e,"duplication of %YAML directive"),n.length!==1&&wt(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&wt(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&wt(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Qo(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&wt(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],cC.test(i)||wt(e,"ill-formed tag handle (first argument) of the TAG directive"),Hn.call(e.tagMap,i)&&wt(e,'there is a previously declared suffix for "'+i+'" tag handle'),hC.test(s)||wt(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{wt(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function xn(t,e,r,n){var i,s,o,a;if(e<r){if(a=t.input.slice(e,r),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||wt(t,"expected valid JSON character");else pP.test(a)&&wt(t,"the stream contains non-printable characters");t.result+=a}}v(xn,"captureSegment");function Ou(t,e,r,n){var i,s,o,a;for(Fe.isObject(r)||wt(t,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),o=0,a=i.length;o<a;o+=1)s=i[o],Hn.call(e,s)||(Ap(e,s,r[s]),n[s]=!0)}v(Ou,"mergeMappings");function ci(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])&&wt(t,"nested arrays are not supported inside keys"),typeof i=="object"&&Du(i[h])==="[object Object]"&&(i[h]="[object Object]");if(typeof i=="object"&&Du(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)Ou(t,e,s[h],r);else Ou(t,e,s,r);else!t.json&&!Hn.call(r,i)&&Hn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,wt(t,"duplicated mapping key")),Ap(e,i,s),delete r[i];return e}v(ci,"storeMappingPair");function Bc(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):wt(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v(Bc,"readLineBreak");function _e(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;$n(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(Bc(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&&Qo(t,"deficient indentation"),n}v(_e,"skipSeparationSpace");function ma(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||ir(r)))}v(ma,"testDocumentSeparator");function Lc(t,e){e===1?t.result+=" ":e>1&&(t.result+=Fe.repeat(`
|
|
448
|
+
`,e-1))}v(Lc,"writeFoldedLines");function yC(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),ir(p)||li(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),ir(i)||r&&li(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),ir(i)||r&&li(i))break}else if(p===35){if(n=t.input.charCodeAt(t.position-1),ir(n))break}else{if(t.position===t.lineStart&&ma(t)||r&&li(p))break;if($r(p))if(l=t.line,h=t.lineStart,u=t.lineIndent,_e(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&&(xn(t,s,o,!1),Lc(t,t.line-l),s=o=t.position,a=!1),$n(p)||(o=t.position+1),p=t.input.charCodeAt(++t.position)}return xn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=f,!1)}v(yC,"readPlainScalar");function bC(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(xn(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)?(xn(t,n,i,!0),Lc(t,_e(t,!1,e)),n=i=t.position):t.position===t.lineStart&&ma(t)?wt(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);wt(t,"unexpected end of the stream within a single quoted scalar")}v(bC,"readSingleQuotedScalar");function CC(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 xn(t,r,t.position,!0),t.position++,!0;if(a===92){if(xn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),$r(a))_e(t,!1,e);else if(a<256&&mC[a])t.result+=gC[a],t.position++;else if((o=dC(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=uC(a))>=0?s=(s<<4)+o:wt(t,"expected hexadecimal character");t.result+=fC(s),t.position++}else wt(t,"unknown escape sequence");r=n=t.position}else $r(a)?(xn(t,r,n,!0),Lc(t,_e(t,!1,e)),r=n=t.position):t.position===t.lineStart&&ma(t)?wt(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}wt(t,"unexpected end of the stream within a double quoted scalar")}v(CC,"readDoubleQuotedScalar");function kC(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(_e(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&&wt(t,"expected the node content, but found ','"):wt(t,"missed comma between flow collection entries"),g=x=y=null,d=f=!1,C===63&&(h=t.input.charCodeAt(t.position+1),ir(h)&&(d=f=!0,t.position++,_e(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,Ci(t,e,Hl,!1,!0),g=t.tag,x=t.result,_e(t,!0,e),C=t.input.charCodeAt(t.position),(f||t.line===n)&&C===58&&(d=!0,C=t.input.charCodeAt(++t.position),_e(t,!0,e),Ci(t,e,Hl,!1,!0),y=t.result),p?ci(t,a,m,g,x,y,n,i,s):d?a.push(ci(t,null,m,g,x,y,n,i,s)):a.push(x),_e(t,!0,e),C=t.input.charCodeAt(t.position),C===44?(r=!0,C=t.input.charCodeAt(++t.position)):r=!1}wt(t,"unexpected end of the stream within a flow collection")}v(kC,"readFlowCollection");function vC(t,e){var r,n,i=Ah,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)Ah===i?i=d===43?gg:dP:wt(t,"repeat of a chomping mode identifier");else if((u=pC(d))>=0)u===0?wt(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?wt(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if($n(d)){do d=t.input.charCodeAt(++t.position);while($n(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!$r(d)&&d!==0)}for(;d!==0;){for(Bc(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===gg?t.result+=Fe.repeat(`
|
|
449
|
+
`,s?1+l:l):i===Ah&&s&&(t.result+=`
|
|
450
|
+
`);break}for(n?$n(d)?(h=!0,t.result+=Fe.repeat(`
|
|
451
|
+
`,s?1+l:l)):h?(h=!1,t.result+=Fe.repeat(`
|
|
452
|
+
`,l+1)):l===0?s&&(t.result+=" "):t.result+=Fe.repeat(`
|
|
453
|
+
`,l):t.result+=Fe.repeat(`
|
|
454
|
+
`,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!$r(d)&&d!==0;)d=t.input.charCodeAt(++t.position);xn(t,r,t.position,!1)}return!0}v(vC,"readBlockScalar");function $u(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,wt(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!ir(o))));){if(a=!0,t.position++,_e(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,Ci(t,e,lC,!1,!0),s.push(t.result),_e(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)wt(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return a?(t.tag=n,t.anchor=i,t.kind="sequence",t.result=s,!0):!1}v($u,"readBlockSequence");function wC(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,wt(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(C===63||C===58)&&ir(n))C===63?(g&&(ci(t,d,f,p,m,null,o,a,l),p=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):wt(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,C=n;else{if(o=t.line,a=t.lineStart,l=t.position,!Ci(t,r,aC,!1,!0))break;if(t.line===s){for(C=t.input.charCodeAt(t.position);$n(C);)C=t.input.charCodeAt(++t.position);if(C===58)C=t.input.charCodeAt(++t.position),ir(C)||wt(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(ci(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)wt(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=h,t.anchor=u,!0}else if(y)wt(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=h,t.anchor=u,!0}if((t.line===s||t.lineIndent>e)&&(g&&(o=t.line,a=t.lineStart,l=t.position),Ci(t,e,Ul,!0,i)&&(g?m=t.result:x=t.result),g||(ci(t,d,f,p,m,x,o,a,l),p=m=x=null),_e(t,!0,-1),C=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&C!==0)wt(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&ci(t,d,f,p,m,null,o,a,l),y&&(t.tag=h,t.anchor=u,t.kind="mapping",t.result=d),y}v(wC,"readBlockMapping");function SC(t){var e,r=!1,n=!1,i,s,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&wt(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(r=!0,o=t.input.charCodeAt(++t.position)):o===33?(n=!0,i="!!",o=t.input.charCodeAt(++t.position)):i="!",e=t.position,r){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(s=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):wt(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!ir(o);)o===33&&(n?wt(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),cC.test(i)||wt(t,"named tag handle cannot contain such characters"),n=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);s=t.input.slice(e,t.position),mP.test(s)&&wt(t,"tag suffix cannot contain flow indicator characters")}s&&!hC.test(s)&&wt(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{wt(t,"tag name is malformed: "+s)}return r?t.tag=s:Hn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:wt(t,'undeclared tag handle "'+i+'"'),!0}v(SC,"readTagProperty");function TC(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&wt(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!ir(r)&&!li(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&wt(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(TC,"readAnchorProperty");function _C(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&&!ir(n)&&!li(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&wt(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Hn.call(t.anchorMap,r)||wt(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],_e(t,!0,-1),!0}v(_C,"readAlias");function Ci(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=Ul===r||lC===r,n&&_e(t,!0,-1)&&(h=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;SC(t)||TC(t);)_e(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||Ul===r)&&(Hl===r||aC===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&($u(t,g)||wC(t,g,x))||kC(t,x)?u=!0:(o&&vC(t,x)||bC(t,x)||CC(t,x)?u=!0:_C(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&wt(t,"alias node should not have any properties")):yC(t,x,Hl===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&$u(t,g))),t.tag===null)t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);else if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&wt(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,f=t.implicitTypes.length;d<f;d+=1)if(m=t.implicitTypes[d],m.resolve(t.result)){t.result=m.construct(t.result),t.tag=m.tag,t.anchor!==null&&(t.anchorMap[t.anchor]=t.result);break}}else if(t.tag!=="!"){if(Hn.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,p=t.typeMap.multi[t.kind||"fallback"],d=0,f=p.length;d<f;d+=1)if(t.tag.slice(0,p[d].tag.length)===p[d].tag){m=p[d];break}m||wt(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&wt(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+m.kind+'", not "'+t.kind+'"'),m.resolve(t.result,t.tag)?(t.result=m.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):wt(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||u}v(Ci,"composeNode");function jC(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&&(_e(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&&!ir(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&wt(t,"directive name must not be less than one character in length");o!==0;){for(;$n(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&&!ir(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&Bc(t),Hn.call(xg,n)?xg[n](t,n,i):Qo(t,'unknown document directive "'+n+'"')}if(_e(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,_e(t,!0,-1)):s&&wt(t,"directives end mark is expected"),Ci(t,t.lineIndent-1,Ul,!1,!0),_e(t,!0,-1),t.checkLineBreaks&&fP.test(t.input.slice(e,t.position))&&Qo(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&ma(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,_e(t,!0,-1));return}if(t.position<t.length-1)wt(t,"end of the stream or a document separator is expected");else return}v(jC,"readDocument");function Ip(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
|
|
455
|
+
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new xC(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,wt(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)jC(r);return r.documents}v(Ip,"loadDocuments");function gP(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=Ip(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(gP,"loadAll$1");function NC(t,e){var r=Ip(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new pr("expected a single document in the stream, but found more")}}v(NC,"load$1");var xP=NC,yP={load:xP},EC=Object.prototype.toString,BC=Object.prototype.hasOwnProperty,Fp=65279,bP=9,Zo=10,CP=13,kP=32,vP=33,wP=34,Ru=35,SP=37,TP=38,_P=39,jP=42,LC=44,NP=45,Yl=58,EP=61,BP=62,LP=63,AP=64,AC=91,MC=93,MP=96,IC=123,IP=124,FC=125,Je={};Je[0]="\\0";Je[7]="\\a";Je[8]="\\b";Je[9]="\\t";Je[10]="\\n";Je[11]="\\v";Je[12]="\\f";Je[13]="\\r";Je[27]="\\e";Je[34]='\\"';Je[92]="\\\\";Je[133]="\\N";Je[160]="\\_";Je[8232]="\\L";Je[8233]="\\P";var FP=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],DP=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function DC(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&&BC.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}v(DC,"compileStyleMap");function PC(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 pr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Fe.repeat("0",n-e.length)+e}v(PC,"encodeHex");var PP=1,Jo=2;function OC(t){this.schema=t.schema||oC,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=Fe.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=DC(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==='"'?Jo:PP,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(OC,"State");function zu(t,e){for(var r=Fe.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
|
|
456
|
+
`,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
|
|
457
|
+
`&&(s+=r),s+=o;return s}v(zu,"indentString");function Vl(t,e){return`
|
|
458
|
+
`+Fe.repeat(" ",t.indent*e)}v(Vl,"generateNextLine");function $C(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($C,"testImplicitResolving");function ta(t){return t===kP||t===bP}v(ta,"isWhitespace");function _s(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==Fp||65536<=t&&t<=1114111}v(_s,"isPrintable");function Wu(t){return _s(t)&&t!==Fp&&t!==CP&&t!==Zo}v(Wu,"isNsCharOrWhitespace");function qu(t,e,r){var n=Wu(t),i=n&&!ta(t);return(r?n:n&&t!==LC&&t!==AC&&t!==MC&&t!==IC&&t!==FC)&&t!==Ru&&!(e===Yl&&!i)||Wu(e)&&!ta(e)&&t===Ru||e===Yl&&i}v(qu,"isPlainSafe");function RC(t){return _s(t)&&t!==Fp&&!ta(t)&&t!==NP&&t!==LP&&t!==Yl&&t!==LC&&t!==AC&&t!==MC&&t!==IC&&t!==FC&&t!==Ru&&t!==TP&&t!==jP&&t!==vP&&t!==IP&&t!==EP&&t!==BP&&t!==_P&&t!==wP&&t!==SP&&t!==AP&&t!==MP}v(RC,"isPlainSafeFirst");function zC(t){return!ta(t)&&t!==Yl}v(zC,"isPlainSafeLast");function Ki(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(Ki,"codePointAt");function Dp(t){var e=/^\n* /;return e.test(t)}v(Dp,"needIndentIndicator");var WC=1,Hu=2,qC=3,HC=4,Vi=5;function UC(t,e,r,n,i,s,o,a){var l,h=0,u=null,d=!1,f=!1,p=n!==-1,m=-1,x=RC(Ki(t,0))&&zC(Ki(t,t.length-1));if(e||o)for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Ki(t,l),!_s(h))return Vi;x=x&&qu(h,u,a),u=h}else{for(l=0;l<t.length;h>=65536?l+=2:l++){if(h=Ki(t,l),h===Zo)d=!0,p&&(f=f||l-m-1>n&&t[m+1]!==" ",m=l);else if(!_s(h))return Vi;x=x&&qu(h,u,a),u=h}f=f||p&&l-m-1>n&&t[m+1]!==" "}return!d&&!f?x&&!o&&!i(t)?WC:s===Jo?Vi:Hu:r>9&&Dp(t)?Vi:o?s===Jo?Vi:Hu:f?HC:qC}v(UC,"chooseScalarStyle");function YC(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===Jo?'""':"''";if(!t.noCompatMode&&(FP.indexOf(e)!==-1||DP.test(e)))return t.quotingType===Jo?'"'+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 $C(t,h)}switch(v(l,"testAmbiguity"),UC(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case WC:return e;case Hu:return"'"+e.replace(/'/g,"''")+"'";case qC:return"|"+Uu(e,t.indent)+Yu(zu(e,s));case HC:return">"+Uu(e,t.indent)+Yu(zu(VC(e,o),s));case Vi:return'"'+GC(e)+'"';default:throw new pr("impossible error: invalid scalar style")}})()}v(YC,"writeScalar");function Uu(t,e){var r=Dp(t)?String(e):"",n=t[t.length-1]===`
|
|
459
|
+
`,i=n&&(t[t.length-2]===`
|
|
460
|
+
`||t===`
|
|
461
|
+
`),s=i?"+":n?"":"-";return r+s+`
|
|
462
|
+
`}v(Uu,"blockHeader");function Yu(t){return t[t.length-1]===`
|
|
463
|
+
`?t.slice(0,-1):t}v(Yu,"dropEndingNewline");function VC(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var h=t.indexOf(`
|
|
464
|
+
`);return h=h!==-1?h:t.length,r.lastIndex=h,Vu(t.slice(0,h),e)})(),i=t[0]===`
|
|
465
|
+
`||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
|
|
466
|
+
`:"")+Vu(l,e),i=s}return n}v(VC,"foldString");function Vu(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+=`
|
|
467
|
+
`+t.slice(i,s),i=s+1),o=a;return l+=`
|
|
468
|
+
`,t.length-i>e&&o>i?l+=t.slice(i,o)+`
|
|
469
|
+
`+t.slice(o+1):l+=t.slice(i),l.slice(1)}v(Vu,"foldLine");function GC(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=Ki(t,i),n=Je[r],!n&&_s(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||PC(r);return e}v(GC,"escapeString");function XC(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(XC,"writeFlowSequence");function Gu(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+=Vl(t,e)),t.dump&&Zo===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v(Gu,"writeBlockSequence");function KC(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(KC,"writeFlowMapping");function QC(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 pr("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!n||i!=="")&&(f+=Vl(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&&Zo===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,d&&(f+=Vl(t,e)),Jr(t,e+1,u,!0,d)&&(t.dump&&Zo===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,i+=f));t.tag=s,t.dump=i||"{}"}v(QC,"writeBlockMapping");function Xu(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,EC.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(BC.call(a.represent,l))n=a.represent[l](e,l);else throw new pr("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}v(Xu,"detectType");function Jr(t,e,r,n,i,s,o){t.tag=null,t.dump=r,Xu(t,r,!1)||Xu(t,r,!0);var a=EC.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?(QC(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(KC(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?Gu(t,e-1,t.dump,i):Gu(t,e,t.dump,i),f&&(t.dump="&ref_"+d+t.dump)):(XC(t,e,t.dump),f&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&YC(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new pr("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 ZC(t,e){var r=[],n=[],i,s;for(Gl(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v(ZC,"getDuplicateReferences");function Gl(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)Gl(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)Gl(t[n[i]],e,r)}v(Gl,"inspectNode");function OP(t,e){e=e||{};var r=new OC(e);r.noRefs||ZC(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Jr(r,0,n,!0,!0)?r.dump+`
|
|
470
|
+
`:""}v(OP,"dump$1");function $P(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($P,"renamed");var RP=q1,zP=yP.load;/*! Bundled license information:
|
|
471
|
+
|
|
472
|
+
js-yaml/dist/js-yaml.mjs:
|
|
473
|
+
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
474
|
+
*/var lo=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"),Ge={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},yg={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function _o(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=me(t),e=me(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(_o,"calculateDeltaAndAngle");var me=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),WP=v(t=>({x:v(function(e,r,n){let i=0;const s=me(n[0]).x<me(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(Ge,t.arrowTypeStart)){const{angle:p,deltaX:m}=_o(n[0],n[1]);i=Ge[t.arrowTypeStart]*Math.cos(p)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ge,t.arrowTypeEnd)){const{angle:p,deltaX:m}=_o(n[n.length-1],n[n.length-2]);i=Ge[t.arrowTypeEnd]*Math.cos(p)*(m>=0?1:-1)}const o=Math.abs(me(e).x-me(n[n.length-1]).x),a=Math.abs(me(e).y-me(n[n.length-1]).y),l=Math.abs(me(e).x-me(n[0]).x),h=Math.abs(me(e).y-me(n[0]).y),u=Ge[t.arrowTypeStart],d=Ge[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 me(e).x+i},"x"),y:v(function(e,r,n){let i=0;const s=me(n[0]).y<me(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(Ge,t.arrowTypeStart)){const{angle:p,deltaY:m}=_o(n[0],n[1]);i=Ge[t.arrowTypeStart]*Math.abs(Math.sin(p))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ge,t.arrowTypeEnd)){const{angle:p,deltaY:m}=_o(n[n.length-1],n[n.length-2]);i=Ge[t.arrowTypeEnd]*Math.abs(Math.sin(p))*(m>=0?1:-1)}const o=Math.abs(me(e).y-me(n[n.length-1]).y),a=Math.abs(me(e).x-me(n[n.length-1]).x),l=Math.abs(me(e).y-me(n[0]).y),h=Math.abs(me(e).x-me(n[0]).x),u=Ge[t.arrowTypeStart],d=Ge[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 me(e).y+i},"y")}),"getLineFunctionsWithOffset"),Pa={},Me={},bg;function qP(){return bg||(bg=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.BLANK_URL=Me.relativeFirstCharacters=Me.whitespaceEscapeCharsRegex=Me.urlSchemeRegex=Me.ctrlCharactersRegex=Me.htmlCtrlEntityRegex=Me.htmlEntitiesRegex=Me.invalidProtocolRegex=void 0,Me.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,Me.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,Me.htmlCtrlEntityRegex=/&(newline|tab);/gi,Me.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,Me.urlSchemeRegex=/^.+(:|:)/gim,Me.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Me.relativeFirstCharacters=[".","/"],Me.BLANK_URL="about:blank"),Me}var Cg;function HP(){if(Cg)return Pa;Cg=1,Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.sanitizeUrl=s;var t=qP();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 Pa}var UP=HP();function Mh(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 YP(){}function JC(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Pp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const VP="[object RegExp]",tk="[object String]",ek="[object Number]",rk="[object Boolean]",nk="[object Arguments]",GP="[object Symbol]",XP="[object Date]",KP="[object Map]",QP="[object Set]",ZP="[object Array]",JP="[object ArrayBuffer]",tO="[object Object]",eO="[object DataView]",rO="[object Uint8Array]",nO="[object Uint8ClampedArray]",iO="[object Uint16Array]",sO="[object Uint32Array]",oO="[object Int8Array]",aO="[object Int16Array]",lO="[object Int32Array]",cO="[object Float32Array]",hO="[object Float64Array]",kg=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();function Op(t){return typeof kg.Buffer<"u"&&kg.Buffer.isBuffer(t)}function uO(t){return Number.isSafeInteger(t)&&t>=0}function ik(t){return t!=null&&typeof t!="function"&&uO(t.length)}function dO(t){return t==="__proto__"}function $p(t){return t==null||typeof t!="object"&&typeof t!="function"}function Rp(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function pO(t,e){return Qi(t,void 0,t,new Map,e)}function Qi(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($p(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]=Qi(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,Qi(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(Qi(a,void 0,r,n,i));return o}if(Op(t))return t.subarray();if(Rp(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=Qi(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"&&fO(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),...JC(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=Qi(e[a],a,r,n,i))}}function fO(t){switch(Pp(t)){case nk:case ZP:case JP:case eO:case rk:case XP:case cO:case hO:case oO:case aO:case lO:case KP:case ek:case tO:case VP:case QP:case tk:case GP:case rO:case nO:case iO:case sO:return!0;default:return!1}}function mO(t,e){return pO(t,(r,n,i,s)=>{if(typeof t=="object"){if(Pp(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 ek:case tk:case rk:{const o=new t.constructor(t==null?void 0:t.valueOf());return Mr(o,t),o}case nk:{const o={};return Mr(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function vg(t){return mO(t)}function Ku(t){return t!==null&&typeof t=="object"&&Pp(t)==="[object Arguments]"}function Qu(t){return typeof t=="object"&&t!==null}function gO(t){return Qu(t)&&ik(t)}function ga(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(ga.Cache||Map),r}ga.Cache=Map;function hl(t){return Rp(t)}function xO(t){const e=t==null?void 0:t.constructor;return t===(typeof e=="function"?e.prototype:Object.prototype)}function yO(t){if($p(t))return t;if(Array.isArray(t)||Rp(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 bO(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=ul(i,o,n,new Map)}return i}function ul(t,e,r,n){if($p(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return yO(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),...JC(e)];for(let s=0;s<i.length;s++){const o=i[s];if(dO(o))continue;let a=e[o],l=t[o];if(Ku(a)&&(a={...a}),Ku(l)&&(l={...l}),Op(a)&&(a=vg(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(gO(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)||Qu(l)&&Qu(a)&&(Mh(l)||Mh(a)||hl(l)||hl(a))?t[o]=ul(l,a,r,n):l==null&&Mh(a)?t[o]=ul({},a,r,n):l==null&&hl(a)?t[o]=vg(a):(l===void 0||a!==void 0)&&(t[o]=a)}return t}function CO(t,...e){return bO(t,...e,YP)}function wg(t){if(t==null)return!0;if(ik(t))return typeof t.splice!="function"&&typeof t!="string"&&!Op(t)&&!hl(t)&&!Ku(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 xO(t)?e.filter(r=>r!=="constructor").length===0:e.length===0}return!0}var kO="",vO={curveBasis:Iu,curveBasisClosed:_D,curveBasisOpen:jD,curveBumpX:Zb,curveBumpY:Jb,curveBundle:ND,curveCardinalClosed:ED,curveCardinalOpen:BD,curveCardinal:n1,curveCatmullRomClosed:LD,curveCatmullRomOpen:AD,curveCatmullRom:s1,curveLinear:Po,curveLinearClosed:MD,curveMonotoneX:u1,curveMonotoneY:d1,curveNatural:f1,curveStep:m1,curveStepAfter:x1,curveStepBefore:g1},wO=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,SO=v(function(t,e){const r=sk(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);El(o),n=Ie(n,[...o])}else n=r.args;if(!n)return;let i=up(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),sk=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${wO.source})(?=[}][%]{2}).*
|
|
475
|
+
`,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),nt.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=Fo.exec(t))!==null;)if(s.index===Fo.lastIndex&&Fo.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 nt.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),TO=v(function(t){return t.replace(Fo,"")},"removeDirectives"),_O=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function zp(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return vO[r]??e}v(zp,"interpolateToCurve");function ok(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?UP.sanitizeUrl(r):r}v(ok,"formatUrl");var jO=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){nt.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function Wp(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(Wp,"distance");function ak(t){let e,r=0;t.forEach(i=>{r+=Wp(i,e),e=i});const n=r/2;return qp(t,n)}v(ak,"traverseEdge");function lk(t){return t.length===1?t[0]:ak(t)}v(lk,"calcLabelPosition");var Sg=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),qp=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=Wp(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:Sg((1-o)*r.x+o*i.x,5),y:Sg((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),NO=v((t,e,r)=>{nt.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=qp(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 ck(t,e,r){const n=structuredClone(r);nt.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=qp(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(ck,"calcTerminalLabelPosition");function hk(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(hk,"getStylesFromArray");var Tg=0,EO=v(()=>(Tg++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Tg),"generateId");function uk(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(uk,"makeRandomHex");var BO=v(t=>uk(t.length),"random"),LO=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"),AO=v(function(t,e){const r=e.text.replace(da.lineBreakRegex," "),[,n]=Ac(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"),MO=ga((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),da.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const l=Cn(`${o} `,r),h=Cn(s,r);if(l>e){const{hyphenatedStrings:f,remainingWord:p}=IO(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}`),IO=ga((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(Cn(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 dk(t,e){return Hp(t,e).height}v(dk,"calculateTextHeight");function Cn(t,e){return Hp(t,e).width}v(Cn,"calculateTextWidth");var Hp=ga((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=Ac(r),o=["sans-serif",n],a=t.split(da.lineBreakRegex),l=[],h=qt("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=LO();g.text=x||kO;const y=AO(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}`),xs,FO=(xs=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},v(xs,"InitIDGenerator"),xs),Oa,DO=v(function(t){return Oa=Oa||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Oa.innerHTML=t,unescape(Oa.textContent)},"entityDecode");function Up(t){return"str"in t}v(Up,"isDetailedError");var PO=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"),Ac=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 Yp(t,e){return CO({},t,e)}v(Yp,"cleanAndMerge");var Pr={assignWithDepth:Ie,wrapLabel:MO,calculateTextHeight:dk,calculateTextWidth:Cn,calculateTextDimensions:Hp,cleanAndMerge:Yp,detectInit:SO,detectDirective:sk,isSubstringInArray:_O,interpolateToCurve:zp,calcLabelPosition:lk,calcCardinalityPosition:NO,calcTerminalLabelPosition:ck,formatUrl:ok,getStylesFromArray:hk,generateId:EO,random:BO,runFunc:jO,entityDecode:DO,insertTitle:PO,isLabelCoordinateInPath:pk,parseFontSize:Ac,InitIDGenerator:FO},OO=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"),ki=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),JY=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function De(t){return t??null}v(De,"handleUndefinedAttr");function pk(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(pk,"isLabelCoordinateInPath");var Vp=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 fk(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=Qt().fontSize?Qt().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[h=hb.fontSize]=Ac(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(fk,"configureLabelImages");var $O=v(t=>{const{handDrawnSeed:e}=Qt();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Fs=v(t=>{const e=RO([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),RO=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"),mk=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"),Ct=v(t=>{const{stylesArray:e}=Fs(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];mk(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"),bt=v((t,e)=>{var l;const{themeVariables:r,handDrawnSeed:n}=Qt(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Fs(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:zO(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),zO=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 WO=Object.freeze({left:0,top:0,width:16,height:16}),Xl=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),gk=Object.freeze({...WO,...Xl}),qO=Object.freeze({...gk,body:"",hidden:!1}),HO=Object.freeze({width:null,height:null}),UO=Object.freeze({...HO,...Xl}),YO=(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 Ih(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 Ih(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return Ih(a,r)?a:null}return null},Ih=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function VO(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 _g(t,e){const r=VO(t,e);for(const n in qO)n in Xl?n in t&&!(n in r)&&(r[n]=Xl[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function GO(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 jg(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=_g(n[a]||i[a],s)}return o(e),r.forEach(o),_g(t,s)}function XO(t,e){if(t.icons[e])return jg(t,e,[]);const r=GO(t,[e])[e];return r?jg(t,e,r):null}const KO=/(-?[0-9.]*[0-9]+[0-9.]*)/g,QO=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ng(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(KO);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=QO.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 ZO(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 JO(t,e){return t?"<defs>"+t+"</defs>"+e:e}function t$(t,e,r){const n=ZO(t);return JO(n.defs,e+n.content+r)}const e$=t=>t==="unset"||t==="undefined"||t==="none";function r$(t,e){const r={...gk,...t},n={...UO,...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=t$(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=Ng(d,l/h)):(u=o==="auto"?l:o,d=a===null?Ng(u,h/l):a==="auto"?h:a);const f={},p=(x,g)=>{e$(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 n$=/\sid="(\S+)"/g,Eg=new Map;function i$(t){t=t.replace(/[0-9]+$/,"")||"a";const e=Eg.get(t)||0;return Eg.set(t,e+1),e?`${t}${e}`:t}function s$(t){const e=[];let r;for(;r=n$.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=i$(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 o$(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 Gp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _i=Gp();function xk(t){_i=t}var Oo={exec:()=>null};function Zt(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(sr.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var a$=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),sr={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")},l$=/^(?:[ \t]*(?:\n|$))+/,c$=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,h$=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,xa=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,u$=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xp=/(?:[*+-]|\d{1,9}[.)])/,yk=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,bk=Zt(yk).replace(/bull/g,Xp).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(),d$=Zt(yk).replace(/bull/g,Xp).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(),Kp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,p$=/^[^\n]+/,Qp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,f$=Zt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Qp).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),m$=Zt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xp).getRegex(),Mc="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",Zp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,g$=Zt("^ {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",Zp).replace("tag",Mc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ck=Zt(Kp).replace("hr",xa).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",Mc).getRegex(),x$=Zt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ck).getRegex(),Jp={blockquote:x$,code:c$,def:f$,fences:h$,heading:u$,hr:xa,html:g$,lheading:bk,list:m$,newline:l$,paragraph:Ck,table:Oo,text:p$},Bg=Zt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",xa).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",Mc).getRegex(),y$={...Jp,lheading:d$,table:Bg,paragraph:Zt(Kp).replace("hr",xa).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Bg).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",Mc).getRegex()},b$={...Jp,html:Zt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Zp).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:Oo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Zt(Kp).replace("hr",xa).replace("heading",` *#{1,6} *[^
|
|
476
|
+
]`).replace("lheading",bk).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},C$=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,k$=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,kk=/^( {2,}|\\)\n(?!\s*$)/,v$=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ic=/[\p{P}\p{S}]/u,tf=/[\s\p{P}\p{S}]/u,vk=/[^\s\p{P}\p{S}]/u,w$=Zt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,tf).getRegex(),wk=/(?!~)[\p{P}\p{S}]/u,S$=/(?!~)[\s\p{P}\p{S}]/u,T$=/(?:[^\s\p{P}\p{S}]|~)/u,_$=Zt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",a$?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Sk=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,j$=Zt(Sk,"u").replace(/punct/g,Ic).getRegex(),N$=Zt(Sk,"u").replace(/punct/g,wk).getRegex(),Tk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",E$=Zt(Tk,"gu").replace(/notPunctSpace/g,vk).replace(/punctSpace/g,tf).replace(/punct/g,Ic).getRegex(),B$=Zt(Tk,"gu").replace(/notPunctSpace/g,T$).replace(/punctSpace/g,S$).replace(/punct/g,wk).getRegex(),L$=Zt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vk).replace(/punctSpace/g,tf).replace(/punct/g,Ic).getRegex(),A$=Zt(/\\(punct)/,"gu").replace(/punct/g,Ic).getRegex(),M$=Zt(/^<(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(),I$=Zt(Zp).replace("(?:-->|$)","-->").getRegex(),F$=Zt("^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",I$).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,D$=Zt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Kl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_k=Zt(/^!?\[(label)\]\[(ref)\]/).replace("label",Kl).replace("ref",Qp).getRegex(),jk=Zt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Qp).getRegex(),P$=Zt("reflink|nolink(?!\\()","g").replace("reflink",_k).replace("nolink",jk).getRegex(),Lg=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ef={_backpedal:Oo,anyPunctuation:A$,autolink:M$,blockSkip:_$,br:kk,code:k$,del:Oo,emStrongLDelim:j$,emStrongRDelimAst:E$,emStrongRDelimUnd:L$,escape:C$,link:D$,nolink:jk,punctuation:w$,reflink:_k,reflinkSearch:P$,tag:F$,text:v$,url:Oo},O$={...ef,link:Zt(/^!?\[(label)\]\((.*?)\)/).replace("label",Kl).getRegex(),reflink:Zt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Kl).getRegex()},Zu={...ef,emStrongRDelimAst:B$,emStrongLDelim:N$,url:Zt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Lg).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:Zt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Lg).getRegex()},$$={...Zu,br:Zt(kk).replace("{2,}","*").getRegex(),text:Zt(Zu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$a={normal:Jp,gfm:y$,pedantic:b$},co={normal:ef,gfm:Zu,breaks:$$,pedantic:O$},R$={"&":"&","<":"<",">":">",'"':""","'":"'"},Ag=t=>R$[t];function Vr(t,e){if(e){if(sr.escapeTest.test(t))return t.replace(sr.escapeReplace,Ag)}else if(sr.escapeTestNoEncode.test(t))return t.replace(sr.escapeReplaceNoEncode,Ag);return t}function Mg(t){try{t=encodeURI(t).replace(sr.percentDecode,"%")}catch{return null}return t}function Ig(t,e){var s;let r=t.replace(sr.findPipe,(o,a,l)=>{let h=!1,u=a;for(;--u>=0&&l[u]==="\\";)h=!h;return h?"|":" |"}),n=r.split(sr.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(sr.slashPipe,"|");return n}function ho(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 z$(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 Fg(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 W$(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
|
|
477
|
+
`).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(`
|
|
478
|
+
`)}var Ql=class{constructor(e){re(this,"options");re(this,"rules");re(this,"lexer");this.options=e||_i}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:ho(n,`
|
|
479
|
+
`)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=W$(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=ho(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:ho(r[0],`
|
|
480
|
+
`)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=ho(r[0],`
|
|
481
|
+
`).split(`
|
|
482
|
+
`),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(`
|
|
483
|
+
`),d=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
484
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
485
|
+
${u}`:u,s=s?`${s}
|
|
486
|
+
${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+`
|
|
487
|
+
`+n.join(`
|
|
488
|
+
`),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+`
|
|
489
|
+
`+n.join(`
|
|
490
|
+
`),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(`
|
|
491
|
+
`);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(`
|
|
492
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),p=e.split(`
|
|
493
|
+
`,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+`
|
|
494
|
+
`,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(`
|
|
495
|
+
`,1)[0],L;if(p=N,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),L=p):L=p.replace(this.rules.other.tabCharGlobal," "),w.test(p)||_.test(p)||S.test(p)||C.test(p)||b.test(p))break;if(L.search(this.rules.other.nonSpaceChar)>=x||!p.trim())d+=`
|
|
496
|
+
`+L.slice(x);else{if(m||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(f)||_.test(f)||b.test(f))break;d+=`
|
|
497
|
+
`+p}!m&&!p.trim()&&(m=!0),u+=N+`
|
|
498
|
+
`,e=e.substring(N.length+1),f=L.slice(x)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0));let g=null,y;this.options.gfm&&(g=this.rules.other.listIsTask.exec(d),g&&(y=g[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:u,task:!!g,checked:y,loose:!1,text:d,tokens:[]}),s.raw+=u}let 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=Ig(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(`
|
|
499
|
+
`):[],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(Ig(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)===`
|
|
500
|
+
`?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=ho(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=z$(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)),Fg(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 Fg(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 Ju{constructor(e){re(this,"tokens");re(this,"options");re(this,"state");re(this,"tokenizer");re(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_i,this.options.tokenizer=this.options.tokenizer||new Ql,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:sr,block:$a.normal,inline:co.normal};this.options.pedantic?(r.block=$a.pedantic,r.inline=co.pedantic):this.options.gfm&&(r.block=$a.gfm,this.options.breaks?r.inline=co.breaks:r.inline=co.gfm),this.tokenizer.rules=r}static get rules(){return{block:$a,inline:co}}static lex(e,r){return new Ju(r).lex(e)}static lexInline(e,r){return new Ju(r).inlineTokens(e)}lex(e){e=e.replace(sr.carriageReturn,`
|
|
501
|
+
`),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(sr.tabCharGlobal," ").replace(sr.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+=`
|
|
502
|
+
`: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(`
|
|
503
|
+
`)?"":`
|
|
504
|
+
`)+a.raw,h.text+=`
|
|
505
|
+
`+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(`
|
|
506
|
+
`)?"":`
|
|
507
|
+
`)+a.raw,h.text+=`
|
|
508
|
+
`+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(`
|
|
509
|
+
`)?"":`
|
|
510
|
+
`)+a.raw,h.text+=`
|
|
511
|
+
`+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(`
|
|
512
|
+
`)?"":`
|
|
513
|
+
`)+a.raw,h.text+=`
|
|
514
|
+
`+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}},Zl=class{constructor(e){re(this,"options");re(this,"parser");this.options=e||_i}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(sr.notSpaceStart))==null?void 0:o[0],s=e.replace(sr.endingNewline,"")+`
|
|
515
|
+
`;return i?'<pre><code class="language-'+Vr(i)+'">'+(n?s:Vr(s,!0))+`</code></pre>
|
|
516
|
+
`:"<pre><code>"+(n?s:Vr(s,!0))+`</code></pre>
|
|
517
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
518
|
+
${this.parser.parse(e)}</blockquote>
|
|
519
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
|
|
520
|
+
`}hr(e){return`<hr>
|
|
521
|
+
`}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+`>
|
|
522
|
+
`+i+"</"+s+`>
|
|
523
|
+
`}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+" "+Vr(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>
|
|
524
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
525
|
+
`}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>
|
|
526
|
+
<thead>
|
|
527
|
+
`+r+`</thead>
|
|
528
|
+
`+i+`</table>
|
|
529
|
+
`}tablerow({text:e}){return`<tr>
|
|
530
|
+
${e}</tr>
|
|
531
|
+
`}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
|
|
532
|
+
`}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>${Vr(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=Mg(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+Vr(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=Mg(e);if(s===null)return Vr(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${Vr(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Vr(e.text)}},rf=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 td{constructor(e){re(this,"options");re(this,"renderer");re(this,"textRenderer");this.options=e||_i,this.options.renderer=this.options.renderer||new Zl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new rf}static parse(e,r){return new td(r).parse(e)}static parseInline(e,r){return new td(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+=`
|
|
533
|
+
`+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}},tl,jo=(tl=class{constructor(e){re(this,"options");re(this,"block");this.options=e||_i}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}},re(tl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),re(tl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),tl),q$=class{constructor(...e){re(this,"defaults",Gp());re(this,"options",this.setOptions);re(this,"parse",this.parseMarkdown(!0));re(this,"parseInline",this.parseMarkdown(!1));re(this,"Parser",Fr);re(this,"Renderer",Zl);re(this,"TextRenderer",rf);re(this,"Lexer",Ir);re(this,"Tokenizer",Ql);re(this,"Hooks",jo);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 Zl(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 Ql(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 jo;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];jo.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&jo.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+=`
|
|
534
|
+
Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Vr(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},vi=new q$;function ne(t,e){return vi.parse(t,e)}ne.options=ne.setOptions=function(t){return vi.setOptions(t),ne.defaults=vi.defaults,xk(ne.defaults),ne};ne.getDefaults=Gp;ne.defaults=_i;ne.use=function(...t){return vi.use(...t),ne.defaults=vi.defaults,xk(ne.defaults),ne};ne.walkTokens=function(t,e){return vi.walkTokens(t,e)};ne.parseInline=vi.parseInline;ne.Parser=Fr;ne.parser=Fr.parse;ne.Renderer=Zl;ne.TextRenderer=rf;ne.Lexer=Ir;ne.lexer=Ir.lex;ne.Tokenizer=Ql;ne.Hooks=jo;ne.parse=ne;ne.options;ne.setOptions;ne.use;ne.walkTokens;ne.parseInline;Fr.parse;Ir.lex;function Nk(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(`
|
|
535
|
+
[ ]{`.concat(Math.min.apply(Math,i),"}"),"g");n=n.map(function(a){return a.replace(s,`
|
|
536
|
+
`)})}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(`
|
|
537
|
+
`)&&(d=String(a).split(`
|
|
538
|
+
`).map(function(f,p){return p===0?f:"".concat(u).concat(f)}).join(`
|
|
539
|
+
`)),o+=d+n[l+1]}),o}var H$={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},ed=new Map,Ek=new Map,U$=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(nt.debug("Registering icon pack:",e.name),"loader"in e)Ek.set(e.name,e.loader);else if("icons"in e)ed.set(e.name,e.icons);else throw nt.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),Bk=v(async(t,e)=>{const r=YO(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=ed.get(n);if(!i){const o=Ek.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},ed.set(n,i)}catch(a){throw nt.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=XO(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),Y$=v(async t=>{try{return await Bk(t),!0}catch{return!1}},"isIconAvailable"),ya=v(async(t,e,r)=>{let n;try{n=await Bk(t,e==null?void 0:e.fallbackPrefix)}catch(o){nt.error(o),n=H$}const i=r$(n,e),s=o$(s$(i.body),{...i.attributes,...r});return zr(s,Ce())},"getIconSVG");function Lk(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
|
|
540
|
+
`).replace(/\n{2,}/g,`
|
|
541
|
+
`);return Nk(n)}v(Lk,"preprocessMarkdown");function Ak(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(Ak,"nonMarkdownToLines");function Mk(t,e={}){const r=Lk(t,e),n=ne.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
|
|
542
|
+
`).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(f=>{f=f.replace(/'/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(Mk,"markdownToLines");function Ik(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(Ik,"nonMarkdownToHTML");function Fk(t,{markdownAutoWrap:e}={}){const r=ne.lexer(t);function n(i){var s,o,a;return i.type==="text"?e===!1?i.text.replace(/\n */g,"<br/>").replace(/ /g," "):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:(nt.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(Fk,"markdownToHTML");function Dk(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(Dk,"splitTextToChars");function Pk(t,e){const r=Dk(e.content);return nf(t,[],r,e.type)}v(Pk,"splitWordToFitWidth");function nf(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}])?nf(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v(nf,"splitWordToFitWidthRecursion");function Ok(t,e){if(t.some(({content:r})=>r.includes(`
|
|
543
|
+
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return Jl(t,e)}v(Ok,"splitLineToFitWidth");function Jl(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 Jl(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=Pk(e,s);r.push([a]),l.content&&t.unshift(l)}return Jl(t,e,r)}v(Jl,"splitLineToFitWidthRecursion");function rd(t,e){e&&t.attr("style",e)}v(rd,"applyStyle");var Dg=16384;async function $k(t,e,r,n,i=!1,s=Ce()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,Dg)}px`),o.attr("height",`${Math.min(10*r,Dg)}px`);const a=o.append("xhtml:div"),l=Yo(e.label)?await Cb(e.label.replace(da.lineBreakRegex,`
|
|
544
|
+
`),s):zr(e.label,s),h=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),rd(u,e.labelStyle),u.attr("class",`${h} ${n}`),rd(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($k,"addHtmlSpan");function Fc(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(Fc,"createTspan");function Rk(t,e,r){const n=t.append("text"),i=Fc(n,1,e);Dc(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(Rk,"computeWidthOfText");function V$(t,e,r){var o;const n=t.append("text"),i=Fc(n,1,e);Dc(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(V$,"computeDimensionOfText");function zk(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=>Rk(o,1.1,p)<=t,"checkWidth"),f=d(u)?[u]:Ok(u,d);for(const p of f){const m=Fc(l,h,1.1,i);Dc(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(zk,"createFormattedText");function nd(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(nd,"decodeHTMLEntities");function Dc(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(nd(r.content)):i.text(" "+nd(r.content))})}v(Dc,"updateTextContentAndStyles");async function Wk(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await Y$(a)?await ya(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(Wk,"replaceIconSubstring");var Tn=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(nt.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",h),s){const d=o?Fk(e,u):Ik(e),f=await Wk(ki(d),u),p=e.replace(/\\\\/g,"\\"),m={isNode:a,label:Yo(e)?p:f,labelStyle:r.replace("fill:","color:")};return await $k(t,m,l,i,h,u)}else{const d=ki(e.replace(/<br\s*\/?>/g,"<br/>")),f=o?Mk(d.replace("<br>","<br/>"),u):Ak(d),p=zk(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:");qt(p).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");qt(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:");qt(p).select("text").attr("style",x)}return n?qt(p).selectAll("tspan.text-outer-tspan").classed("title-row",!0):qt(p).selectAll("tspan.text-outer-tspan").classed("row",!0),p}},"createText");function Fh(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 G$(t,e){return t[0]===e[0]&&t[1]===e[1]}function X$(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)Fh(h,a,i);const l=(function(h,u,d){const f=[];for(const C of h){const b=[...C];G$(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)Fh(h,a,-i);(function(h,u,d){const f=[];h.forEach((p=>f.push(...p))),Fh(f,u,d)})(l,a,-i)}return l}function ba(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),X$(t,i,n,s||1)}class sf{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=ba(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 Pc(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 K$ extends sf{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=ba(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)Pc([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 Q$ extends sf{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 Z${constructor(e){this.helper=e}fillPolygons(e,r){const n=ba(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=Pc(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 J${constructor(e){this.helper=e}fillPolygons(e,r){const n=ba(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=Pc(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 tR{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=ba(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=Pc(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 hr={};class eR{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const rR=0,Dh=1,Pg=2,Ra={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 Ph(t,e){return t.type===e}function of(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:rR,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:Dh,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:Pg,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!Ph(s,Pg);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return of("M0,0"+t);i++,o=Ra[s.text],n=s.text}else Ph(s,Dh)?o=Ra[n]:(i++,o=Ra[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(!Ph(h,Dh))throw new Error("Param not a number: "+n+","+h.text);a[a.length]=+h.text}if(typeof Ra[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 qk(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 Hk(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)&&(Uk(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 uo(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function Uk(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]=uo(t,e,-u),[r,n]=uo(r,n,-u);const W=(t-r)/2,P=(e-n)/2;let M=W*W/(i*i)+P*P/(s*s);M>1&&(M=Math.sqrt(M),i*=M,s*=M);const F=i*i,O=s*s,$=F*O-F*P*P-O*W*W,B=F*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,M=n;m=l&&m>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=Uk(r=x+i*Math.cos(m),n=g+s*Math.sin(m),P,M,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,L=4/3*s*S,A=[t,e],j=[t+N*b,e-L*C],I=[r+N*_,n-L*w],z=[r,n];if(j[0]=2*A[0]-j[0],j[1]=2*A[1]-j[1],h)return[j,I,z].concat(f);{f=[j,I,z].concat(f);const W=[];for(let P=0;P<f.length;P+=3){const M=uo(f[P][0],f[P][1],u),F=uo(f[P+1][0],f[P+1][1],u),O=uo(f[P+2][0],f[P+2][1],u);W.push([M[0],M[1],F[0],F[1],O[0],O[1]])}return W}}const nR={randOffset:function(t,e){return Lt(t,e)},randOffsetWithRange:function(t,e,r){return tc(t,e,r)},ellipse:function(t,e,r,n,i){const s=Vk(r,n,i);return id(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Un(t,e,r,n,i,!0)}};function Yk(t,e,r,n,i){return{type:"path",ops:Un(t,e,r,n,i)}}function dl(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Un(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Un(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?Yk(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function iR(t,e,r,n,i){return(function(s,o){return dl(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function Og(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=za(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:za(r[0],1.5*(1+.22*e.roughness),zg(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=za(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:za(o,1.5*(1+.22*e.roughness),zg(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 Vk(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 id(t,e,r,n){const[i,s]=Wg(n.increment,t,e,n.rx,n.ry,1,n.increment*tc(.1,tc(.4,1,r),r),r);let o=ec(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=Wg(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=ec(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function $g(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=qg(g,h,u,d,f,p,m,1,l);if(!l.disableMultiStroke){const C=qg(g,h,u,d,f,p,m,1.5,l);y.push(...C)}return o&&(a?y.push(...Un(h,u,h+d*Math.cos(p),u+f*Math.sin(p),l),...Un(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 Rg(t,e){const r=Hk(qk(of(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(...Un(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(...sR(l,h,u,d,f,p,s,e)),s=[f,p];break}case"Z":n.push(...Un(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function Oh(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 $i(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!hr[i])switch(i){case"zigzag":hr[i]||(hr[i]=new K$(n));break;case"cross-hatch":hr[i]||(hr[i]=new Q$(n));break;case"dots":hr[i]||(hr[i]=new Z$(n));break;case"dashed":hr[i]||(hr[i]=new J$(n));break;case"zigzag-line":hr[i]||(hr[i]=new tR(n));break;default:i="hachure",hr[i]||(hr[i]=new sf(n))}return hr[i]})(e,nR).fillPolygons(t,e)}function zg(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function Gk(t){return t.randomizer||(t.randomizer=new eR(t.seed||0)),t.randomizer.next()}function tc(t,e,r,n=1){return r.roughness*n*(Gk(r)*(e-t)+t)}function Lt(t,e,r=1){return tc(-t,t,e,r)}function Un(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=sd(t,e,r,n,i,!0,!1);if(o)return a;const l=sd(t,e,r,n,i,!0,!0);return a.concat(l)}function sd(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*Gk(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 za(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 ec(n,null,r)}function ec(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(...sd(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function Wg(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 qg(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)]),ec(u,null,l)}function sR(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 po(t){return[...t]}function Hg(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(po(t[0]),po(t[1]),po(t[2]),po(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(po(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 pl(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function oR(t,e,r){const n=pl(e,r);if(n===0)return pl(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)),pl(t,ni(e,r,i))}function ni(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function od(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(pl(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=ni(l,h,.5),p=ni(h,u,.5),m=ni(u,d,.5),x=ni(f,p,.5),g=ni(p,m,.5),y=ni(x,g,.5);od([l,f,x,y],0,r,i),od([y,g,m,d],0,r,i)}var s,o;return i}function aR(t,e){return rc(t,0,t.length,e)}function rc(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=oR(t[u],o,a);d>l&&(l=d,h=u)}return Math.sqrt(l)>n?(rc(t,e,h+1,n,s),rc(t,h,r,n,s)):(s.length||s.push(o),s.push(a)),s}function $h(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)od(t,3*s,e,n);return r&&r>0?rc(n,0,n.length,r):n}const Cr="none";class nc{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",[Yk(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=iR(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(Oh([h],o)):a.push($i([h],o))}return o.stroke!==Cr&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=Vk(n,i,o),h=id(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=id(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push($i([h.estimatedPoints],o));return o.stroke!==Cr&&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",[dl(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,l){const h=this._o(l),u=[],d=$g(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=$g(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,L=y;for(;N<0;)N+=2*Math.PI,L+=2*Math.PI;L-N>2*Math.PI&&(N=0,L=2*Math.PI);const A=(L-N)/C.curveStepCount,j=[];for(let I=N;I<=L;I+=A)j.push([b+_*Math.cos(I),w+S*Math.sin(I)]);return j.push([b+_*Math.cos(L),w+S*Math.sin(L)]),j.push([b,w]),$i([j],C)})(e,r,n,i,s,o,h));return h.stroke!==Cr&&u.push(d),this._d("arc",u,h)}curve(e,r){const n=this._o(r),i=[],s=Og(e,n);if(n.fill&&n.fill!==Cr)if(n.fillStyle==="solid"){const o=Og(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(...$h(Hg([h[0],h[0],h[1],h[2]]),10,(1+n.roughness)/2)):o.push(...$h(Hg(h),10,(1+n.roughness)/2))}o.length&&i.push($i([o],n))}return n.stroke!==Cr&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=dl(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(Oh([e],n)):i.push($i([e],n))),n.stroke!==Cr&&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!==Cr,o=n.stroke!==Cr,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,f){const p=Hk(qk(of(u))),m=[];let x=[],g=[0,0],y=[];const C=()=>{y.length>=4&&x.push(...$h(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=aR(_,f);S.length&&w.push(S)}return w})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),h=Rg(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=Rg(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(Oh(l,n));else i.push($i(l,n));return o&&(a?l.forEach((u=>{i.push(dl(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:Cr};break;case"fillPath":o={d:this.opsToPath(s),stroke:Cr,strokeWidth:0,fill:n.fill||Cr};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||Cr,strokeWidth:n,fill:Cr}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class lR{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new nc(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 Wa="http://www.w3.org/2000/svg";class cR{constructor(e,r){this.svg=e,this.gen=new nc(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(Wa,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(Wa,"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(Wa,"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(Wa,"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 yt={canvas:(t,e)=>new lR(t,e),svg:(t,e)=>new cR(t,e),generator:t=>new nc(t),newSeed:()=>nc.newSeed()},Bt=v(async(t,e,r)=>{var p,m;let n;const i=e.useHtmlLabels||Sn((p=Qt())==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",De(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 Tn(o,zr(ki(a),Qt()),{useHtmlLabels:i,width:e.width||((m=Qt().flowchart)==null?void 0:m.wrappingWidth),classes:h?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:h},Qt());let d=u.getBBox();const f=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=qt(u);await fk(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"),Rh=v(async(t,e,r)=>{var l,h;const n=r.useHtmlLabels??ar(Qt()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await Tn(i,zr(ki(e),Qt()),{useHtmlLabels:n,width:r.width||((h=(l=Qt())==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(ar(Qt())){const u=s.children[0],d=qt(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"),kt=v((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),jt=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Yt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Yt,"createPathFromPoints");function Yn(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(Yn,"generateFullSineWavePoints");function ea(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(ea,"generateCirclePoints");function ad(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(ad,"mergePaths");var hR=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"),Ds=hR,uR=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=Qt(),a=ar(o);return await Tn(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),Fn=uR,Xn=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"),Xk=v(async(t,e)=>{nt.info("Creating subgraph rect for ",e.id,e);const r=Qt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=Ct(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=ar(r),p=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await Tn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width}):m=await Fn(p,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(ar(r)){const N=m.children[0],L=qt(m);x=N.getBoundingClientRect(),L.attr("width",x.width),L.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,C=e.x-g/2,b=e.y-y/2;nt.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const N=yt.svg(d),L=bt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),A=N.path(Xn(C,b,g,y,0),L);w=d.insert(()=>(nt.debug("Rough node insert CXC",A),A),":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:_}=Vp(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 Ds(e,N)},{cluster:d,labelBBox:x}},"rect"),dR=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 Ds(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),pR=v(async(t,e)=>{const r=Qt(),{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 Fn(d,e.label,e.labelStyle,void 0,!0);let m=p.getBBox();if(ar(r)){const A=p.children[0],j=qt(p);m=A.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 A=e.cssClasses.includes("statediagram-cluster-alt"),j=yt.svg(h),I=e.rx||e.ry?j.path(Xn(w,_,y,C,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):j.rectangle(w,_,y,C,{seed:i});N=h.insert(()=>I,":first-child");const z=j.rectangle(w,S,y,b,{fill:A?s:o,fillStyle:A?"hachure":"solid",stroke:l,seed:i});N=h.insert(()=>I,":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-(ar(r)?0:3)})`);const L=N.node().getBBox();return e.height=L.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(A){return Ds(e,A)},{cluster:h,labelBBox:m}},"roundedWithTitle"),fR=v(async(t,e)=>{nt.info("Creating subgraph rect for ",e.id,e);const r=Qt(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:h,backgroundStyles:u}=Ct(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),f=ar(r),p=d.insert("g").attr("class","cluster-label "),m=await Tn(p,e.label,{style:e.labelStyle,useHtmlLabels:f,isNode:!0,width:e.width});let x=m.getBBox();if(ar(r)){const N=m.children[0],L=qt(m);x=N.getBoundingClientRect(),L.attr("width",x.width),L.attr("height",x.height)}const g=e.width<=x.width+e.padding?x.width+e.padding:e.width;e.width<=x.width+e.padding?e.diff=(g-e.width)/2-e.padding:e.diff=-e.padding;const y=e.height,C=e.x-g/2,b=e.y-y/2;nt.trace("Data ",e,JSON.stringify(e));let w;if(e.look==="handDrawn"){const N=yt.svg(d),L=bt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),A=N.path(Xn(C,b,g,y,e.rx),L);w=d.insert(()=>(nt.debug("Rough node insert CXC",A),A),":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:_}=Vp(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 Ds(e,N)},{cluster:d,labelBBox:x}},"kanbanSection"),mR=v((t,e)=>{const r=Qt(),{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=yt.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 Ds(e,x)},{cluster:o,labelBBox:{}}},"divider"),gR=Xk,xR={rect:Xk,squareRect:gR,roundedWithTitle:pR,noteGroup:dR,divider:mR,kanbanSection:fR},Kk=new Map,yR=v(async(t,e)=>{const r=e.shape||"rect",n=await xR[r](t,e);return Kk.set(e.id,n),n},"insertCluster"),sV=v(()=>{Kk=new Map},"clear");function Qk(t,e){return t.intersect(e)}v(Qk,"intersectNode");var bR=Qk;function Zk(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(Zk,"intersectEllipse");var Jk=Zk;function tv(t,e,r){return Jk(t,e,e,r)}v(tv,"intersectCircle");var CR=tv;function ev(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&&ld(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&&ld(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(ev,"intersectLine");function ld(t,e){return t*e>0}v(ld,"sameSign");var kR=ev;function rv(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=kR(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(rv,"intersectPolygon");var vR=rv,mt={node:bR,circle:CR,ellipse:Jk,polygon:vR,rect:Ds};function nv(t,e){const{labelStyles:r}=Ct(e);e.labelStyle=r;const n=jt(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=yt.svg(s),h=bt(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",De(a)),kt(e,d),e.intersect=function(f){return nt.info("Circle intersect",e,o,f),mt.circle(e,o,f)},s}v(nv,"anchor");function cd(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 L=N/19,A=b+L*_,j=y+i*Math.cos(A),I=C+s*Math.sin(A);S.push({x:j,y:I})}return S}v(cd,"generateArcPoints");function iv(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(iv,"calculateArcSagitta");async function sv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?16:i,o=e.look==="neo"?12:i,a=v(A=>A+o,"calcTotalHeight"),l=v(A=>{const j=A/2;return[j/(2.5+A/50),j]},"calcEllipseRadius"),{shapeSvg:h,bbox:u}=await Bt(t,e,jt(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[f,p]=l(d),m=iv(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},...cd(-g/2,-y/2,-g/2,y/2,f,p,!1),{x:g/2,y:y/2},...cd(g/2,y/2,g/2,-y/2,f,p,!0)],w=yt.svg(h),_=bt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const S=Yt(b),N=w.path(S,_),L=h.insert(()=>N,":first-child");return L.attr("class","basic label-container outer-path"),C&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",C),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(${f/2}, 0)`),kt(e,L),e.intersect=function(A){return mt.polygon(e,b,A)},h}v(sv,"bowTieRect");function _n(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(_n,"insertPolygonShape");var qa=12;async function ov(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(e)),h=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s+qa),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+qa,y:p},{x:f,y:p},{x:f,y:m},{x:d,y:m},{x:d,y:p+qa},{x:d+qa,y:p}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const C=yt.svg(a),b=bt(e,{}),w=Yt(x),_=C.path(w,b);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-h/2}, ${u/2})`),y&&g.attr("style",y)}else g=_n(a,h,u,x);return n&&g.attr("style",n),kt(e,g),e.intersect=function(C){return mt.polygon(e,x,C)},a}v(ov,"card");function av(t,e){const{nodeStyles:r}=Ct(e);e.label="";const n=t.insert("g").attr("class",jt(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=yt.svg(n),l=bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=Yt(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 mt.polygon(e,o,f)},n}v(av,"choice");async function af(t,e,r){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await Bt(t,e,jt(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=yt.svg(s),m=bt(e,{}),x=p.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",De(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 kt(e,d),e.calcIntersect=function(p,m){const x=p.width/2;return mt.circle(p,x,m)},e.intersect=function(p){return nt.info("Circle intersect",e,u,p),mt.circle(e,u,p)},s}v(af,"circle");function lv(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}
|
|
545
|
+
M ${i.x},${i.y} L ${o.x},${o.y}`}v(lv,"createLine");function cv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r,e.label="";const i=t.insert("g").attr("class",jt(e)).attr("id",e.domId??e.id),s=Math.max(30,(e==null?void 0:e.width)??0),{cssStyles:o}=e,a=yt.svg(i),l=bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const h=a.circle(0,0,s*2,l),u=lv(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),kt(e,f),e.intersect=function(p){return nt.info("crossedCircle intersect",e,{radius:s,point:p}),mt.circle(e,s,p)},i}v(cv,"crossedCircle");function fn(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(fn,"generateCirclePoints");async function hv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,jt(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=[...fn(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...fn(h/2+d*2,-d,d,20,-180,-270),...fn(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...fn(h/2,u/2,d,20,0,90)],m=[{x:h/2,y:-u/2-d},{x:-h/2,y:-u/2-d},...fn(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...fn(h/2+h*.1,-d,d,20,-180,-270),...fn(h/2+h*.1,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...fn(h/2,u/2,d,20,0,90),{x:-h/2,y:u/2+d},{x:h/2,y:u/2+d}],x=yt.svg(i),g=bt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Yt(p).replace("Z",""),b=x.path(C,g),w=Yt(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))})`),kt(e,S),e.intersect=function(N){return mt.polygon(e,m,N)},i}v(hv,"curlyBraceLeft");function mn(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(mn,"generateCirclePoints");async function uv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,jt(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=[...mn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...mn(h/2+d*2,-d,d,20,-180,-270),...mn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...mn(h/2,u/2,d,20,0,90)],m=[{x:-h/2,y:-u/2-d},{x:h/2,y:-u/2-d},...mn(h/2,-u/2,d,20,-90,0),{x:h/2+d,y:-d},...mn(h/2+d*2,-d,d,20,-180,-270),...mn(h/2+d*2,d,d,20,-90,-180),{x:h/2+d,y:u/2},...mn(h/2,u/2,d,20,0,90),{x:h/2,y:u/2+d},{x:-h/2,y:u/2+d}],x=yt.svg(i),g=bt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const C=Yt(p).replace("Z",""),b=x.path(C,g),w=Yt(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))})`),kt(e,S),e.intersect=function(N){return mt.polygon(e,m,N)},i}v(uv,"curlyBraceRight");function Re(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(Re,"generateCirclePoints");async function dv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,jt(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=[...Re(h/2,-u/2,d,30,-90,0),{x:-h/2-d,y:d},...Re(h/2+d*2,-d,d,20,-180,-270),...Re(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:-u/2},...Re(h/2,u/2,d,20,0,90)],m=[...Re(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...Re(-h/2-d/2,-d,d,20,0,90),...Re(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...Re(-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},...Re(h/2,-u/2,d,20,-90,0),{x:-h/2-d,y:-d},...Re(h/2+d*2,-d,d,20,-180,-270),...Re(h/2+d*2,d,d,20,-90,-180),{x:-h/2-d,y:u/2},...Re(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},...Re(-h/2+d+d/2,-u/2,d,20,-90,-180),{x:h/2-d/2,y:d},...Re(-h/2-d/2,-d,d,20,0,90),...Re(-h/2-d/2,d,d,20,-90,0),{x:h/2-d/2,y:-d},...Re(-h/2+d+d/2,u/2,d,30,-180,-270)],g=yt.svg(i),y=bt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=Yt(p).replace("Z",""),w=g.path(b,y),S=Yt(m).replace("Z",""),N=g.path(S,y),L=Yt(x),A=g.path(L,{...y}),j=i.insert("g",":first-child");return j.insert(()=>A,":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))})`),kt(e,j),e.intersect=function(I){return mt.polygon(e,x,I)},i}v(dv,"curlyBraces");async function pv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(h),g=bt(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},...ea(-b,-C/2,p,50,270,90)],S=Yt(_),N=x.path(S,g),L=h.insert(()=>N,":first-child");return L.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&L.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&L.selectChildren("path").attr("style",n),L.attr("transform",`translate(${-d/2}, ${-f/2})`),kt(e,L),e.intersect=function(A){return mt.polygon(e,_,A)},h}v(pv,"curvedTrapezoid");var wR=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"),SR=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"),TR=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Ug=8,Yg=8;async function fv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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<Yg&&(e.width=Yg);const C=g/2/(2.5+g/50);e.height=(e.height??0)-s-C*3,e.height<Ug&&(e.height=Ug)}const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,jt(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=yt.svg(a),y=SR(0,0,u,p,d,f),C=TR(0,f,u,p,d,f),b=bt(e,{}),w=g.path(y,b),_=g.path(C,bt(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=wR(0,0,u,p,d,f);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",De(x)).attr("style",n)}return m.attr("label-offset-y",f),m.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),kt(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=mt.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(fv,"cylinder");async function Ps(t,e,r){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await Bt(t,e,jt(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=yt.svg(s),g=bt(e,{}),y=f||p?x.path(Xn(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",De(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",De(f)).attr("ry",De(p)).attr("x",h).attr("y",u).attr("width",a).attr("height",l);return kt(e,d),e.calcIntersect=function(x,g){return mt.rect(x,g)},e.intersect=function(x){return mt.rect(e,x)},s}v(Ps,"drawRect");async function mv(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 Ps(t,e,l);if(e.look==="handDrawn"){const p=yt.svg(h),m=bt(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(mv,"datastore");async function gv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(e)),h=a.width+i,u=a.height+s,d=u*.2,f=-h/2,p=-u/2-d/2,{cssStyles:m}=e,x=yt.svg(o),g=bt(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))})`),kt(e,b),e.intersect=function(w){return mt.rect(e,w)},o}v(gv,"dividedRectangle");async function xv(t,e){var p,m;const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),g=bt(e,{roughness:.2,strokeWidth:2.5}),y=bt(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",De(e.cssClasses)).attr("style",De(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 kt(e,d),e.intersect=function(x){return nt.info("DoubleCircle intersect",e,h,x),mt.circle(e,h,x)},a}v(xv,"doublecircle");function yv(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=Ct(e);e.label="",e.labelStyle=n;const s=t.insert("g").attr("class",jt(e)).attr("id",e.domId??e.id),o=7,{cssStyles:a}=e,l=yt.svg(s),{nodeBorder:h}=r,u=bt(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),kt(e,f),e.intersect=function(p){return nt.info("filledCircle intersect",e,{radius:o,point:p}),mt.circle(e,o,p)},s}v(yv,"filledCircle");var Vg=10,Gg=10;async function bv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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<Vg&&(e.height=Vg),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<Gg&&(e.width=Gg));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,jt(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=yt.svg(o),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Yt(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,kt(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 nt.info("Triangle intersect",e,f,b),mt.polygon(e,f,b)},o}v(bv,"flippedTriangle");function Cv(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=Ct(e);e.label="";const o=t.insert("g").attr("class",jt(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=yt.svg(o),p=bt(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),kt(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 mt.rect(e,y)},o}v(Cv,"forkJoin");async function kv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(l),x=bt(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},...ea(-u/2+f,0,f,50,90,270),{x:u/2-f,y:d/2},{x:-u/2,y:d/2}],y=Yt(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),kt(e,b),e.intersect=function(w){return nt.info("Pill intersect",e,{radius:f,point:w}),mt.polygon(e,g,w)},l}v(kv,"halfRoundedRectangle");var _R=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 vv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(u),b=bt(e,{}),w=_R(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=_n(u,m,f,x);return n&&g.attr("style",n),e.width=m,e.height=f,kt(e,g),e.intersect=function(C){return mt.polygon(e,x,C)},u}v(vv,"hexagon");async function wv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await Bt(t,e,jt(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=yt.svg(i),h=bt(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=Yt(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})`),kt(e,p),e.intersect=function(m){return nt.info("Pill intersect",e,{points:u}),mt.polygon(e,u,m)},i}v(wv,"hourglass");async function Sv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(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}=Fs(e),y=-m/2,C=-p/2,b=e.label?8:0,w=yt.svg(h),_=bt(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),L=p+u.height+b,A=w.rectangle(-N/2,-L/2,N,L,{..._,fill:"transparent",stroke:"none"}),j=h.insert(()=>S,":first-child"),I=h.insert(()=>A);if(e.icon){const z=h.append("g");z.html(`<g>${await ya(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const W=z.node().getBBox(),P=W.width,M=W.height,F=W.x,O=W.y;z.attr("transform",`translate(${-P/2-F},${f?u.height/2+b/2-M/2-O:-u.height/2-b/2-M/2-O})`),z.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-L/2:L/2-u.height})`),j.attr("transform",`translate(0,${f?u.height/2+b/2:-u.height/2-b/2})`),kt(e,I),e.intersect=function(z){if(nt.info("iconSquare intersect",e,z),!e.label)return mt.rect(e,z);const W=e.x??0,P=e.y??0,M=e.height??0;let F=[];return f?F=[{x:W-u.width/2,y:P-M/2},{x:W+u.width/2,y:P-M/2},{x:W+u.width/2,y:P-M/2+u.height+b},{x:W+m/2,y:P-M/2+u.height+b},{x:W+m/2,y:P+M/2},{x:W-m/2,y:P+M/2},{x:W-m/2,y:P-M/2+u.height+b},{x:W-u.width/2,y:P-M/2+u.height+b}]:F=[{x:W-m/2,y:P-M/2},{x:W+m/2,y:P-M/2},{x:W+m/2,y:P-M/2+p},{x:W+u.width/2,y:P-M/2+p},{x:W+u.width/2/2,y:P+M/2},{x:W-u.width/2,y:P+M/2},{x:W-u.width/2,y:P-M/2+p},{x:W-m/2,y:P-M/2+p}],mt.polygon(e,F,z)},h}v(Sv,"icon");async function Tv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(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}=Fs(e),C=yt.svg(h),b=bt(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 ya(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const S=_.node().getBBox(),N=S.width,L=S.height,A=S.x,j=S.y,I=Math.max(N,L)*Math.SQRT2+f*2,z=C.circle(0,0,I,b),W=Math.max(I,u.width),P=I+u.height+p,M=C.rectangle(-W/2,-P/2,W,P,{...b,fill:"transparent",stroke:"none"}),F=h.insert(()=>z,":first-child"),O=h.insert(()=>M);return _.attr("transform",`translate(${-N/2-A},${m?u.height/2+p/2-L/2-j:-u.height/2-p/2-L/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})`),F.attr("transform",`translate(0,${m?u.height/2+p/2:-u.height/2-p/2})`),kt(e,O),e.intersect=function($){return nt.info("iconSquare intersect",e,$),mt.rect(e,$)},h}v(Tv,"iconCircle");async function _v(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(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}=Fs(e),b=-x/2,w=-m/2,_=e.label?8:0,S=yt.svg(h),N=bt(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const L=C.get("fill");N.stroke=L??y;const A=S.path(Xn(b,w,x,m,5),N),j=Math.max(x,u.width),I=m+u.height+_,z=S.rectangle(-j/2,-I/2,j,I,{...N,fill:"transparent",stroke:"none"}),W=h.insert(()=>A,":first-child").attr("class","icon-shape2"),P=h.insert(()=>z);if(e.icon){const M=h.append("g");M.html(`<g>${await ya(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=M.node().getBBox(),O=F.width,$=F.height,B=F.x,T=F.y;M.attr("transform",`translate(${-O/2-B},${p?u.height/2+_/2-$/2-T:-u.height/2-_/2-$/2-T})`),M.attr("style",`color: ${C.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-I/2:I/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),kt(e,P),e.intersect=function(M){if(nt.info("iconSquare intersect",e,M),!e.label)return mt.rect(e,M);const F=e.x??0,O=e.y??0,$=e.height??0;let B=[];return p?B=[{x:F-u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2+u.height+_},{x:F+x/2,y:O-$/2+u.height+_},{x:F+x/2,y:O+$/2},{x:F-x/2,y:O+$/2},{x:F-x/2,y:O-$/2+u.height+_},{x:F-u.width/2,y:O-$/2+u.height+_}]:B=[{x:F-x/2,y:O-$/2},{x:F+x/2,y:O-$/2},{x:F+x/2,y:O-$/2+m},{x:F+u.width/2,y:O-$/2+m},{x:F+u.width/2/2,y:O+$/2},{x:F-u.width/2,y:O+$/2},{x:F-u.width/2,y:O-$/2+m},{x:F-x/2,y:O-$/2+m}],mt.polygon(e,B,M)},h}v(_v,"iconRounded");async function jv(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=Ct(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}=Fs(e),b=-x/2,w=-m/2,_=e.label?8:0,S=yt.svg(h),N=bt(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const L=C.get("fill");N.stroke=L??y;const A=S.path(Xn(b,w,x,m,.1),N),j=Math.max(x,u.width),I=m+u.height+_,z=S.rectangle(-j/2,-I/2,j,I,{...N,fill:"transparent",stroke:"none"}),W=h.insert(()=>A,":first-child"),P=h.insert(()=>z);if(e.icon){const M=h.append("g");M.html(`<g>${await ya(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const F=M.node().getBBox(),O=F.width,$=F.height,B=F.x,T=F.y;M.attr("transform",`translate(${-O/2-B},${p?u.height/2+_/2-$/2-T:-u.height/2-_/2-$/2-T})`),M.attr("style",`color: ${C.get("stroke")??g};`)}return f.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-I/2:I/2-u.height})`),W.attr("transform",`translate(0,${p?u.height/2+_/2:-u.height/2-_/2})`),kt(e,P),e.intersect=function(M){if(nt.info("iconSquare intersect",e,M),!e.label)return mt.rect(e,M);const F=e.x??0,O=e.y??0,$=e.height??0;let B=[];return p?B=[{x:F-u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2},{x:F+u.width/2,y:O-$/2+u.height+_},{x:F+x/2,y:O-$/2+u.height+_},{x:F+x/2,y:O+$/2},{x:F-x/2,y:O+$/2},{x:F-x/2,y:O-$/2+u.height+_},{x:F-u.width/2,y:O-$/2+u.height+_}]:B=[{x:F-x/2,y:O-$/2},{x:F+x/2,y:O-$/2},{x:F+x/2,y:O-$/2+m},{x:F+u.width/2,y:O-$/2+m},{x:F+u.width/2/2,y:O+$/2},{x:F-u.width/2,y:O+$/2},{x:F-u.width/2,y:O-$/2+m},{x:F-x/2,y:O-$/2+m}],mt.polygon(e,B,M)},h}v(jv,"iconSquare");async function Nv(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}=Ct(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=yt.svg(d),b=bt(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"}),L=d.insert(()=>w,":first-child"),A=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})`),L.attr("transform",`translate(0,${m?f.height/2+y/2:-f.height/2-y/2})`),kt(e,A),e.intersect=function(j){if(nt.info("iconSquare intersect",e,j),!e.label)return mt.rect(e,j);const I=e.x??0,z=e.y??0,W=e.height??0;let P=[];return m?P=[{x:I-f.width/2,y:z-W/2},{x:I+f.width/2,y:z-W/2},{x:I+f.width/2,y:z-W/2+f.height+y},{x:I+h/2,y:z-W/2+f.height+y},{x:I+h/2,y:z+W/2},{x:I-h/2,y:z+W/2},{x:I-h/2,y:z-W/2+f.height+y},{x:I-f.width/2,y:z-W/2+f.height+y}]:P=[{x:I-h/2,y:z-W/2},{x:I+h/2,y:z-W/2},{x:I+h/2,y:z-W/2+u},{x:I+f.width/2,y:z-W/2+u},{x:I+f.width/2/2,y:z+W/2},{x:I-f.width/2,y:z+W/2},{x:I-f.width/2,y:z-W/2+u},{x:I-h/2,y:z-W/2+u}],mt.polygon(e,P,j)},d}v(Nv,"imageSquare");async function Ev(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),x=bt(e,{}),g=Yt(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=_n(a,h,u,d);return n&&f.attr("style",n),e.width=h,e.height=u,kt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(Ev,"inv_trapezoid");async function Bv(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))})`),kt(e,s),e.intersect=function(l){return mt.rect(e,l)},r}v(Bv,"labelRect");async function Lv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),x=bt(e,{}),g=Yt(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=_n(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,kt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(Lv,"lean_left");async function Av(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),x=bt(e,{}),g=Yt(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=_n(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,kt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(Av,"lean_right");function Mv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.label="",e.labelStyle=r;const i=t.insert("g").attr("class",jt(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=yt.svg(i),d=bt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const f=Yt(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})`),kt(e,m),e.intersect=function(x){return nt.info("lightningBolt intersect",e,x),mt.polygon(e,h,x)},i}v(Mv,"lightningBolt");var jR=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"),NR=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"),ER=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Xg=10,Kg=10;async function Iv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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<Kg&&(e.width=Kg);const b=y/2/(2.5+y/50);e.height=(e.height??0)-o-b*3,e.height<Xg&&(e.height=Xg)}const{shapeSvg:a,bbox:l,label:h}=await Bt(t,e,jt(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=yt.svg(a),C=NR(0,0,u,p,d,f,m),b=ER(0,f,u,p,d,f),w=bt(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=jR(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",De(g)).attr("style",n)}return x.attr("label-offset-y",f),x.attr("transform",`translate(${-u/2}, ${-(p/2+f)})`),kt(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=mt.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(Iv,"linedCylinder");async function Fv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),g=bt(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},...Yn(-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))})`),kt(e,b),e.intersect=function(w){return mt.polygon(e,y,w)},a}v(Fv,"linedWaveEdgedRect");async function Dv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(l),b=bt(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=Yt(w);let N=C.path(S,b);const L=Yt(_);let A=C.path(L,b);e.look!=="handDrawn"&&(N=ad(N),A=ad(A));const j=l.insert("g",":first-child");return j.insert(()=>N),j.insert(()=>A),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))})`),kt(e,j),e.intersect=function(I){return mt.polygon(e,w,I)},l}v(Dv,"multiRect");async function Pv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,jt(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=Yn(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=yt.svg(i),L=bt(e,{});e.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");const A=Yt(_),j=N.path(A,L),I=Yt(S),z=N.path(I,L),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))})`),kt(e,W),e.intersect=function(P){return mt.polygon(e,_,P)},i}v(Pv,"multiWaveEdgedRectangle");async function Ov(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n,e.useHtmlLabels||ar(Ce())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,jt(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=yt.svg(o),x=bt(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))})`),kt(e,y),e.intersect=function(C){return mt.rect(e,C)},o}v(Ov,"note");var BR=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 $v(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Bt(t,e,jt(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=yt.svg(i),m=bt(e,{}),x=BR(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=_n(i,l,l,u),d.attr("transform",`translate(${-l/2+h}, ${l/2})`);return n&&d.attr("style",n),kt(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=mt.polygon(p,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(p){return this.calcIntersect(e,p)},i}v($v,"question");async function Rv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),C=bt(e,{});e.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");const b=Yt(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))})`),kt(e,_),e.intersect=function(S){return mt.polygon(e,x,S)},a}v(Rv,"rect_left_inv_arrow");async function zv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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 Fn(a,h,e.labelStyle,!0,!0);let d={width:0,height:0};if(ar(Qt())){const L=u.children[0],A=qt(u);d=L.getBoundingClientRect(),A.attr("width",d.width),A.attr("height",d.height)}nt.info("Text 2",l);const f=l||[],p=u.getBBox(),m=await Fn(a,Array.isArray(f)?f.join("<br/>"):f,e.labelStyle,!0,!0),x=m.children[0],g=qt(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;qt(m).attr("transform","translate( "+(d.width>p.width?0:(p.width-d.width)/2)+", "+(p.height+y+5)+")"),qt(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 L=yt.svg(s),A=bt(e,{}),j=L.path(Xn(w,_,C,b,e.rx||0),A),I=L.line(-d.width/2-y,-d.height/2-y+p.height+y,d.width/2+y,-d.height/2-y+p.height+y,A);N=s.insert(()=>(nt.debug("Rough node insert CXC",j),I),":first-child"),S=s.insert(()=>(nt.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 kt(e,S),e.intersect=function(L){return mt.rect(e,L)},s}v(zv,"rectWithTitle");async function Wv(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 Ps(t,e,i)}v(Wv,"roundedRect");var ei=8;async function qv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(e)),h=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?ei:ei*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=h-ei,f=u,p=ei-h/2,m=-u/2,{cssStyles:x}=e,g=yt.svg(o),y=bt(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-ei,y:m+f},{x:p-ei,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",De(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(${ei/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),kt(e,w),e.intersect=function(_){return mt.rect(e,_)},o}v(qv,"shadedProcess");async function Hv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),C=bt(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=Yt(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))})`),kt(e,S),e.intersect=function(N){return mt.polygon(e,b,N)},a}v(Hv,"slopedRect");async function Uv(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 Ps(t,e,s)}v(Uv,"squareRect");async function Yv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),m=bt(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},...ea(-u/2+d,0,d,50,90,270),{x:u/2-d,y:h/2},...ea(u/2-d,0,d,50,270,450)],g=Yt(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),kt(e,C),e.intersect=function(b){return mt.polygon(e,x,b)},a}v(Yv,"stadium");async function Vv(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return Ps(t,e,r)}v(Vv,"state");function Gv(t,e,{config:{themeVariables:r}}){var C,b;const{labelStyles:n,nodeStyles:i}=Ct(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=yt.svg(u),f=bt(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 kt(e,y),e.intersect=function(w){return mt.circle(e,(e.width??0)/2,w)},u}v(Gv,"stateEnd");function Xv(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=yt.svg(s).circle(0,0,e.width,$O(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 kt(e,o),e.intersect=function(h){return mt.circle(e,(e.width??7)/2,h)},s}v(Xv,"stateStart");var Ri=8;async function Kv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(e)),h=((e==null?void 0:e.width)??l.width)+2*Ri+s,u=((e==null?void 0:e.height)??l.height)+o,d=h-2*Ri,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=yt.svg(a),y=bt(e,{}),C=g.rectangle(p,m,d+16,f,y),b=g.line(p+Ri,m,p+Ri,m+f,y),w=g.line(p+Ri+d,m,p+Ri+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",De(S)),kt(e,_)}else{const g=_n(a,d,f,x);n&&g.attr("style",n),kt(e,g)}return e.intersect=function(g){return mt.polygon(e,x,g)},a}v(Kv,"subroutine");var zh=.2;async function Qv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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-zh*(e.height+o*2),10));const{shapeSvg:a,bbox:l}=await Bt(t,e,jt(e)),h=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2,u=zh*h,d=zh*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=yt.svg(a),b=bt(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=Yt(w),N=C.path(S,b),L=Yt(_),A=C.path(L,{...b,fillStyle:"solid"}),j=a.insert(()=>A,":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),kt(e,j),e.intersect=function(I){return mt.polygon(e,w,I)},a}v(Qv,"taggedRect");async function Zv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await Bt(t,e,jt(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=yt.svg(i),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:f/2},...Yn(-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},...Yn(y+a,(C+l)*1.25,y+a-u,(C+l)*1.3,-l*.02,.5)],w=Yt(g),_=m.path(w,x),S=Yt(b),N=m.path(S,{...x,fillStyle:"solid"}),L=i.insert(()=>N,":first-child");return L.insert(()=>_,":first-child"),L.attr("class","basic label-container outer-path"),p&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(0,${-h/2})`),o.attr("transform",`translate(${-a/2+(e.padding??0)-(s.x-(s.left??0))},${-l/2+(e.padding??0)-h/2-(s.y-(s.top??0))})`),kt(e,L),e.intersect=function(A){return mt.polygon(e,g,A)},i}v(Zv,"taggedWaveEdgedRectangle");async function Jv(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await Bt(t,e,jt(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),kt(e,u),e.intersect=function(d){return mt.rect(e,d)},i}v(Jv,"text");var LR=v((t,e,r,n,i,s)=>`M${t},${e}
|
|
546
|
+
a${i},${s} 0,0,1 0,${-n}
|
|
547
|
+
l${r},0
|
|
548
|
+
a${i},${s} 0,0,1 0,${n}
|
|
549
|
+
M${r},${-n}
|
|
550
|
+
a${i},${s} 0,0,0 0,${n}
|
|
551
|
+
l${-r},0`,"createCylinderPathD"),AR=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"),MR=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,Zg=10;async function tw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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<Zg&&(e.width=Zg)}const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,jt(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=yt.svg(o),g=AR(0,0,f,h,d,u),y=MR(0,0,f,h,d,u),C=x.path(g,bt(e,{})),b=x.path(y,bt(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=LR(0,0,f,h,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",De(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))})`),kt(e,m),e.intersect=function(x){const g=mt.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(tw,"tiltedCylinder");async function ew(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),x=bt(e,{}),g=Yt(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=_n(a,u,h,d);return n&&f.attr("style",n),e.width=u,e.height=h,kt(e,f),e.intersect=function(m){return mt.polygon(e,d,m)},a}v(ew,"trapezoid");async function rw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(h),x=bt(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=Yt(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),kt(e,b),e.intersect=function(w){return mt.polygon(e,g,w)},h}v(rw,"trapezoidalPentagon");var Jg=10,tx=10;async function nw(t,e){var w;const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e.padding??0,s=e.look==="neo"?i*2:i;(e.width||e.height)&&(e.width=(((e==null?void 0:e.width)??0)-s)/2,e.width<tx&&(e.width=tx),e.height=(e==null?void 0:e.height)??0,e.height<Jg&&(e.height=Jg));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,jt(e)),h=Sn((w=Qt().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=yt.svg(o),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Yt(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,kt(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 nt.info("Triangle intersect",e,p,_),mt.polygon(e,p,_)},o}v(nw,"triangle");async function iw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(l),w=bt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const _=[{x:-d/2-C,y:m/2},...Yn(-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=Yt(_),N=b.path(S,w),L=l.insert(()=>N,":first-child");return L.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(0,${-p/2})`),u.attr("transform",`translate(${-d/2+(e.padding??0)-(h.x-(h.left??0))},${-f/2+(e.padding??0)-p-(h.y-(h.top??0))})`),kt(e,L),e.intersect=function(A){return mt.polygon(e,_,A)},l}v(iw,"waveEdgedRectangle");async function sw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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,jt(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=yt.svg(a),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-h/2,y:f/2},...Yn(-h/2,f/2,h/2,f/2,d,1),{x:h/2,y:-f/2},...Yn(h/2,-f/2,-h/2,-f/2,d,-1)],y=Yt(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),kt(e,b),e.intersect=function(w){return mt.polygon(e,g,w)},a}v(sw,"waveRectangle");var ke=10;async function ow(t,e){const{labelStyles:r,nodeStyles:n}=Ct(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-ke,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-ke,10));const{shapeSvg:o,bbox:a,label:l}=await Bt(t,e,jt(e)),h=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+ke,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+ke,d=h-ke,f=u-ke,p=-d/2,m=-f/2,{cssStyles:x}=e,g=yt.svg(o),y=bt(e,{}),C=[{x:p-ke,y:m-ke},{x:p-ke,y:m+f},{x:p+d,y:m+f},{x:p+d,y:m-ke}],b=`M${p-ke},${m-ke} L${p+d},${m-ke} L${p+d},${m+f} L${p-ke},${m+f} L${p-ke},${m-ke}
|
|
552
|
+
M${p-ke},${m} L${p+d},${m}
|
|
553
|
+
M${p},${m-ke} 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(${ke/2}, ${ke/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)+ke/2-(a.x-(a.left??0))}, ${-(a.height/2)+ke/2-(a.y-(a.top??0))})`),kt(e,_),e.intersect=function(S){return mt.polygon(e,C,S)},o}v(ow,"windowPane");var ex=new Set(["redux-color","redux-dark-color"]),IR=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function lf(t,e){var xt,$t,Ht,ct;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=Ce(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:X}=Ce(),{background:it}=X,vt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${it}`]};await lf(t,vt)}const h=Ce();e.useHtmlLabels=h.htmlLabels;let u=((xt=h.er)==null?void 0:xt.diagramPadding)??10,d=(($t=h.er)==null?void 0:$t.entityPadding)??6;const{cssStyles:f}=e,{labelStyles:p,nodeStyles:m}=Ct(e);if(r.attributes.length===0&&e.label){const X={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};Cn(e.label,h)+X.labelPaddingX*2<h.er.minEntityWidth&&(e.width=h.er.minEntityWidth);const it=await Ps(t,e,X);if(n!=null&&ex.has(n)){const vt=r.colorIndex??0;it.attr("data-color-id",`color-${vt%l.length}`)}if(!Sn(h.htmlLabels)){const vt=it.select("text"),gt=(Ht=vt.node())==null?void 0:Ht.getBBox();vt.attr("transform",`translate(${-gt.width/2}, 0)`)}return it}h.htmlLabels||(u*=1.25,d*=1.25);let x=jt(e);x||(x="node default");const g=t.insert("g").attr("class",x).attr("id",e.domId||e.id),y=await Gi(g,e.label??"",h,0,0,["name"],p);y.height+=d;let C=0;const b=[],w=[];let _=0,S=0,N=0,L=0,A=!0,j=!0;for(const X of r.attributes){const it=await Gi(g,X.type,h,0,C,["attribute-type"],p);_=Math.max(_,it.width+u);const vt=await Gi(g,X.name,h,0,C,["attribute-name"],p);S=Math.max(S,vt.width+u);const gt=await Gi(g,X.keys.join(),h,0,C,["attribute-keys"],p);N=Math.max(N,gt.width+u);const Jt=await Gi(g,X.comment,h,0,C,["attribute-comment"],p);L=Math.max(L,Jt.width+u);const Pt=Math.max(it.height,vt.height,gt.height,Jt.height)+d;w.push({yOffset:C,rowHeight:Pt}),C+=Pt}let I=4;N<=u&&(A=!1,N=0,I--),L<=u&&(j=!1,L=0,I--);const z=g.node().getBBox();if(y.width+u*2-(_+S+N+L)>0){const X=y.width+u*2-(_+S+N+L);_+=X/I,S+=X/I,N>0&&(N+=X/I),L>0&&(L+=X/I)}const W=_+S+N+L,P=yt.svg(g),M=bt(e,{});e.look!=="handDrawn"&&(M.roughness=0,M.fillStyle="solid");let F=0;w.length>0&&(F=w.reduce((X,it)=>X+((it==null?void 0:it.rowHeight)??0),0));const O=Math.max(z.width+u*2,(e==null?void 0:e.width)||0,W),$=Math.max((F??0)+y.height,(e==null?void 0:e.height)||0),B=-O/2,T=-$/2;if(g.selectAll("g:not(:first-child)").each((X,it,vt)=>{const gt=qt(vt[it]),Jt=gt.attr("transform");let Pt=0,Xt=0;if(Jt){const Kt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Jt);Kt&&(Pt=parseFloat(Kt[1]),Xt=parseFloat(Kt[2]),gt.attr("class").includes("attribute-name")?Pt+=_:gt.attr("class").includes("attribute-keys")?Pt+=_+S:gt.attr("class").includes("attribute-comment")&&(Pt+=_+S+N))}gt.attr("transform",`translate(${B+u/2+Pt}, ${Xt+T+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(T+d/2)+")"),n!=null&&ex.has(n)){const X=r.colorIndex??0;g.attr("data-color-id",`color-${X%l.length}`)}const V=P.rectangle(B,T,O,$,M),et=g.insert(()=>V,":first-child").attr("class","outer-path").attr("style",f.join(""));b.push(0);for(const[X,it]of w.entries()){const gt=(X+1)%2===0&&it.yOffset!==0,Jt=P.rectangle(B,y.height+T+(it==null?void 0:it.yOffset),O,it==null?void 0:it.rowHeight,{...M,fill:gt?s:o,stroke:a});g.insert(()=>Jt,"g.label").attr("style",f.join("")).attr("class",`row-rect-${gt?"even":"odd"}`)}const D=1e-4;let G=Xi(B,y.height+T,O+B,y.height+T,D),ht=P.polygon(G.map(X=>[X.x,X.y]),M);if(g.insert(()=>ht).attr("class","divider"),G=Xi(_+B,y.height+T,_+B,$+T,D),ht=P.polygon(G.map(X=>[X.x,X.y]),M),g.insert(()=>ht).attr("class","divider"),A){const X=_+S+B;G=Xi(X,y.height+T,X,$+T,D),ht=P.polygon(G.map(it=>[it.x,it.y]),M),g.insert(()=>ht).attr("class","divider")}if(j){const X=_+S+N+B;G=Xi(X,y.height+T,X,$+T,D),ht=P.polygon(G.map(it=>[it.x,it.y]),M),g.insert(()=>ht).attr("class","divider")}for(const X of b){const it=y.height+T+X;G=Xi(B,it,O+B,it,D),ht=P.polygon(G.map(vt=>[vt.x,vt.y]),M),g.insert(()=>ht).attr("class","divider")}if(kt(e,et),m&&e.look!=="handDrawn")if(n!=null&&IR.has(n))g.selectAll("path").attr("style",m);else{const X=m.split(";"),it=(ct=X==null?void 0:X.filter(vt=>vt.includes("stroke")))==null?void 0:ct.map(vt=>`${vt}`).join("; ");g.selectAll("path").attr("style",it??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(X){return mt.rect(e,X)},g}v(lf,"erBox");async function Gi(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!==Um(e)&&(e=Um(e),e=e.replaceAll("<","<").replaceAll(">",">"));const l=a.node().appendChild(await Tn(a,e,{width:Cn(e,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(e.includes("<")||e.includes(">")){let u=l.children[0];for(u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("<","<").replaceAll(">",">")}let h=l.getBBox();if(Sn(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const d=qt(l);h=u.getBoundingClientRect(),d.attr("width",h.width),d.attr("height",h.height)}return h}v(Gi,"addText");function Xi(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(Xi,"lineToPolygon");async function aw(t,e,r,n,i=r.class.padding??12){const s=n?0:3,o=t.insert("g").attr("class",jt(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 No(a,{text:`«${C}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await No(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 No(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 No(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(aw,"textHelper");async function No(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=Ce();let o="useHtmlLabels"in e?e.useHtmlLabels:Sn(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),Yo(a)&&(o=!0);const l=await Tn(i,gp(ki(a)),{width:Cn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let h,u=1;if(o){const d=l.children[0],f=qt(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")&&qt(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const d=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(d.textContent=a[0]+a.substring(1).replaceAll(">",">").replaceAll("<","<").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(No,"addText");async function lw(t,e){var P,M;const r=Qt(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??Sn(r.htmlLabels)??!0,l=e;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];const{shapeSvg:h,bbox:u}=await aw(t,e,r,a,o),{labelStyles:d,nodeStyles:f}=Ct(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&&!((M=r.class)!=null&&M.hideEmptyMembersBox),x=yt.svg(h),g=bt(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),L=h.insert(()=>N,":first-child");L.attr("class","basic label-container outer-path");const A=L.node().getBBox(),j=h.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,I=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+I+_+s-(_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(h.selectAll(".text").each((F,O,$)=>{var G,ht;const B=qt($[O]),T=B.attr("transform");let V=0;if(T){const $t=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(T);$t&&(V=parseFloat($t[2]))}let et=V+_+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(B.attr("class").includes("methods-group")){const xt=Math.max(z,o/2);b?et=Math.max(W,j+I+xt+_+o*2+s)+o*2:et=j+I+xt+_+o*4+s}l.members.length===0&&l.methods.length===0&&((G=r.class)!=null&&G.hideEmptyMembersBox)&&(l.annotations.length>0?et=V-o:et=V),a||(et-=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(xt,$t,Ht){window.getComputedStyle(Ht[$t]).textAnchor==="middle"&&(D=0)})),B.attr("transform",`translate(${D}, ${et})`)}),l.members.length>0||l.methods.length>0||m){const F=j+I+_+s,O=x.line(A.x,F,A.x+A.width,F+.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 F=j+I+z+_+o*2+s,O=x.line(A.x,b?Math.max(W,F):F,A.x+A.width,(b?Math.max(W,F):F)+.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),L.select(":nth-child(2)").attr("style",p),h.selectAll(".divider").select("path").attr("style",p),e.labelStyle?h.selectAll("span").attr("style",e.labelStyle):h.selectAll("span").attr("style",p),!a){const F=RegExp(/color\s*:\s*([^;]*)/),O=F.exec(p);if(O){const $=O[0].replace("color","fill");h.selectAll("tspan").attr("style",$)}else if(d){const $=F.exec(d);if($){const B=$[0].replace("color","fill");h.selectAll("tspan").attr("style",B)}}}return kt(e,L),e.intersect=function(F){return mt.rect(e,F)},h}v(lw,"classBox");async function cw(t,e){var A,j;const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,h=jt(e),{themeVariables:u}=Qt(),{borderColorArray:d,requirementEdgeLabelBackground:f}=u,p=t.insert("g").attr("class",h).attr("id",e.domId??e.id);let m;l?m=await Gr(p,`<<${i.type}>>`,0,e.labelStyle):m=await Gr(p,"<<Element>>",0,e.labelStyle);let x=m;const g=await Gr(p,i.name,x,e.labelStyle+"; font-weight: bold;");if(x+=g+a,l){const I=await Gr(p,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=I;const z=await Gr(p,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=z;const W=await Gr(p,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=W,await Gr(p,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const I=await Gr(p,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=I,await Gr(p,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((A=p.node())==null?void 0:A.getBBox().width)??200)+o,C=(((j=p.node())==null?void 0:j.getBBox().height)??200)+o,b=-y/2,w=-C/2,_=yt.svg(p),S=bt(e,{});e.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const N=_.rectangle(b,w,y,C,S),L=p.insert(()=>N,":first-child");if(L.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const I=e.colorIndex??0;p.attr("data-color-id",`color-${I%d.length}`)}if(p.selectAll(".label").each((I,z,W)=>{const P=qt(W[z]),M=P.attr("transform");let F=0,O=0;if(M){const V=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(M);V&&(F=parseFloat(V[1]),O=parseFloat(V[2]))}const $=O-C/2;let B=b+o/2;(z===0||z===1)&&(B=F),P.attr("transform",`translate(${B}, ${$+o})`)}),x>m+g+a){const I=w+m+g+a;let z;if(e.look==="neo"){const M=[[b,I],[b+y,I],[b+y,I+.001],[b,I+.001]];z=_.polygon(M,S)}else z=_.line(b,I,b+y,I,S);p.insert(()=>z).attr("class","divider")}return kt(e,L),e.intersect=function(I){return mt.rect(e,I)},n&&e.look!=="handDrawn"&&(f||d!=null&&d.length)&&p.selectAll("path").attr("style",n),p}v(cw,"requirementBox");async function Gr(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=Qt(),o=s.htmlLabels??!0,a=await Tn(i,gp(ki(e)),{width:Cn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let l;if(o){const h=a.children[0],u=qt(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(Gr,"addText");var FR=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 hw(t,e,{config:r}){var z,W;const{labelStyles:n,nodeStyles:i}=Ct(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,jt(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 Rh(f,"ticket"in e&&e.ticket||"",p):{label:m,bbox:x}=await Rh(a,"ticket"in e&&e.ticket||"",p);const{label:g,bbox:y}=await Rh(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 L;const{rx:A,ry:j}=e,{cssStyles:I}=e;if(e.look==="handDrawn"){const P=yt.svg(a),M=bt(e,{}),F=A||j?P.path(Xn(S,N,b,_,A||0),M):P.rectangle(S,N,b,_,M);L=a.insert(()=>F,":first-child"),L.attr("class","basic label-container").attr("style",I||null)}else{L=a.insert("rect",":first-child"),L.attr("class","basic label-container __APA__").attr("style",i).attr("rx",A??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 M=a.append("line"),F=S+2,O=N+Math.floor((A??0)/2),$=N+_-Math.floor((A??0)/2);M.attr("x1",F).attr("y1",O).attr("x2",F).attr("y2",$).attr("stroke-width","4").attr("stroke",FR(P))}}return kt(e,L),e.height=_,e.intersect=function(P){return mt.rect(e,P)},a}v(hw,"kanbanItem");async function uw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,jt(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
|
|
554
|
+
a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
|
|
555
|
+
a${u},${u} 1 0,0 ${m*.25},0
|
|
556
|
+
a${u},${u} 1 0,0 ${m*.25},0
|
|
557
|
+
a${u},${u} 1 0,0 ${m*.25},${x*.1}
|
|
558
|
+
|
|
559
|
+
a${u},${u} 1 0,0 ${m*.15},${x*.33}
|
|
560
|
+
a${u*.8},${u*.8} 1 0,0 0,${x*.34}
|
|
561
|
+
a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
|
|
562
|
+
|
|
563
|
+
a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
|
|
564
|
+
a${u},${u} 1 0,0 ${-1*m*.25},0
|
|
565
|
+
a${u},${u} 1 0,0 ${-1*m*.25},0
|
|
566
|
+
a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
|
|
567
|
+
|
|
568
|
+
a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
|
|
569
|
+
a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
|
|
570
|
+
a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
|
|
571
|
+
H0 V0 Z`;if(e.look==="handDrawn"){const C=yt.svg(i),b=bt(e,{}),w=C.path(y,b);g=i.insert(()=>w,":first-child"),g.attr("class","basic label-container").attr("style",De(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})`),kt(e,g),e.calcIntersect=function(C,b){return mt.rect(C,b)},e.intersect=function(C){return nt.info("Bang intersect",e,C),mt.rect(e,C)},i}v(uw,"bang");async function dw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,jt(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
|
|
572
|
+
a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
|
|
573
|
+
a${f},${f} 1 0,1 ${l*.4},${-1*l*.1}
|
|
574
|
+
a${d},${d} 1 0,1 ${l*.35},${l*.2}
|
|
575
|
+
|
|
576
|
+
a${u},${u} 1 0,1 ${l*.15},${h*.35}
|
|
577
|
+
a${p},${p} 1 0,1 ${-1*l*.15},${h*.65}
|
|
578
|
+
|
|
579
|
+
a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
|
|
580
|
+
a${f},${f} 1 0,1 ${-1*l*.5},0
|
|
581
|
+
a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
|
|
582
|
+
|
|
583
|
+
a${u},${u} 1 0,1 ${-1*l*.1},${-1*h*.35}
|
|
584
|
+
a${p},${p} 1 0,1 ${l*.1},${-1*h*.65}
|
|
585
|
+
H0 V0 Z`;if(e.look==="handDrawn"){const y=yt.svg(i),C=bt(e,{}),b=y.path(g,C);x=i.insert(()=>b,":first-child"),x.attr("class","basic label-container").attr("style",De(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})`),kt(e,x),e.calcIntersect=function(y,C){return mt.rect(y,C)},e.intersect=function(y){return nt.info("Cloud intersect",e,y),mt.rect(e,y)},i}v(dw,"cloud");async function pw(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await Bt(t,e,jt(e)),l=s.width+8*o,h=s.height+2*o,u=5,d=e.look==="neo"?`
|
|
586
|
+
M${-l/2} ${h/2-u}
|
|
587
|
+
v${-h+2*u}
|
|
588
|
+
q0,-${u} ${u},-${u}
|
|
589
|
+
h${l-2*u}
|
|
590
|
+
q${u},0 ${u},${u}
|
|
591
|
+
v${h-u}
|
|
592
|
+
H${-l/2}
|
|
593
|
+
Z
|
|
594
|
+
`:`
|
|
595
|
+
M${-l/2} ${h/2-u}
|
|
596
|
+
v${-h+2*u}
|
|
597
|
+
q0,-${u} ${u},-${u}
|
|
598
|
+
h${l-2*u}
|
|
599
|
+
q${u},0 ${u},${u}
|
|
600
|
+
v${h-2*u}
|
|
601
|
+
q0,${u} ${-u},${u}
|
|
602
|
+
h${-(l-2*u)}
|
|
603
|
+
q${-u},0 ${-u},${-u}
|
|
604
|
+
Z
|
|
605
|
+
`;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()),kt(e,f),e.calcIntersect=function(p,m){return mt.rect(p,m)},e.intersect=function(p){return mt.rect(e,p)},i}v(pw,"defaultMindmapNode");async function fw(t,e){const r={padding:e.padding??0};return af(t,e,r)}v(fw,"mindmapCircle");var DR=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Uv},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Wv},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Yv},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Kv},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:fv},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:mv},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:af},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:uw},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:dw},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:$v},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:vv},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Av},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Lv},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:ew},{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:Ev},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:xv},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Jv},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:ov},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:qv},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Xv},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Gv},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Cv},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:wv},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:hv},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:uv},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:dv},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Mv},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:iw},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:kv},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:tw},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:Iv},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:pv},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:gv},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:nw},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:ow},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:yv},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:rw},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:bv},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Hv},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Pv},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Dv},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:sv},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:cv},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Zv},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Qv},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:sw},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Rv},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:Fv}],PR=v(()=>{const e=[...Object.entries({state:Vv,choice:av,note:Ov,rectWithTitle:zv,labelRect:Bv,iconSquare:jv,iconCircle:Tv,icon:Sv,iconRounded:_v,imageSquare:Nv,anchor:nv,kanbanItem:hw,mindmapCircle:fw,defaultMindmapNode:pw,classBox:lw,erBox:lf,requirementBox:cw}),...DR.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),mw=PR();function OR(t){return t in mw}v(OR,"isValidShape");var Oc=new Map;async function gw(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?mw[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",De(e.look)),e.tooltip&&i.attr("title",e.tooltip),Oc.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(gw,"insertNode");var oV=v((t,e)=>{Oc.set(e.id,t)},"setNodeElem"),aV=v(()=>{Oc.clear()},"clear"),lV=v(t=>{const e=Oc.get(t.id);nt.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"),$R=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&rx(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&rx(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),RR={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}},zR=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],rx=v((t,e,r,n,i,s,o=!1,a)=>{var m;const l=RR[r],h=l&&zR.includes(l.type);if(!l){nt.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"),WR=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=Qt())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),ic=new Map,ze=new Map,cV=v(()=>{ic.clear(),ze.clear()},"clear"),fo=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),qR=v(async(t,e)=>{const r=Qt();let n=ar(r);const{labelStyles:i}=Ct(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 Tn(t,e.label,{style:fo(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(h),nt.info("abc82",e,e.labelType);let u=h.getBBox(),d=u;if(n){const p=h.children[0],m=qt(h);u=p.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const p=qt(h).select("text").node();p&&typeof p.getBBox=="function"&&(d=p.getBBox())}o.attr("transform",lo(d,n)),ic.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 Fn(m,e.startLabelLeft,fo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=qt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",lo(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).startLeft=p,Eo(f,e.startLabelLeft)}if(e.startLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Fn(m,e.startLabelRight,fo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=qt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",lo(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).startRight=p,Eo(f,e.startLabelRight)}if(e.endLabelLeft){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Fn(p,e.endLabelLeft,fo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=qt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",lo(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).endLeft=p,Eo(f,e.endLabelLeft)}if(e.endLabelRight){const p=t.insert("g").attr("class","edgeTerminals"),m=p.insert("g").attr("class","inner"),x=await Fn(p,e.endLabelRight,fo(e.labelStyle)||"",!1,!1);f=x;let g=x.getBBox();if(n){const y=x.children[0],C=qt(x);g=y.getBoundingClientRect(),C.attr("width",g.width),C.attr("height",g.height)}m.attr("transform",lo(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).endRight=p,Eo(f,e.endLabelRight)}return h},"insertEdgeLabel");function Eo(t,e){ar(Qt())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v(Eo,"setTerminalWidth");var HR=v((t,e)=>{nt.debug("Moving label abc88 ",t.id,t.label,ic.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=Qt(),{subGraphTitleTotalMargin:i}=Vp(n);if(t.label){const s=ic.get(t.id);let o=t.x,a=t.y;if(r){const l=Pr.calcLabelPosition(r);nt.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=ze.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=ze.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=ze.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=ze.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"),UR=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"),YR=v((t,e,r)=>{nt.debug(`intersection calc abc89:
|
|
606
|
+
outsidePoint: ${JSON.stringify(e)}
|
|
607
|
+
insidePoint : ${JSON.stringify(r)}
|
|
608
|
+
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),nt.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 nt.debug(`sides calc abc89, Q ${h}, q ${d}, R ${u}, r ${a}`,{_x:f,_y:p}),a===0&&(f=e.x,p=e.y),u===0&&(f=e.x),h===0&&(p=e.y),{x:f,y:p}}},"intersection"),nx=v((t,e)=>{nt.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(nt.info("abc88 checking point",s,e),!UR(e,s)&&!i){const o=YR(e,n,s);nt.debug("abc88 inside",s,n,o),nt.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)?nt.warn("abc88 no intersect",o,r):r.push(o),i=!0}else nt.warn("abc88 outside",s,n),n=s,i||r.push(s)}),nt.debug("returning points",r),r},"cutPathAtIntersect");function xw(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(xw,"extractCornerPoints");var ix=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"),VR=v(function(t){const{cornerPointPositions:e}=xw(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=ix(i,o,5),l=ix(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){nt.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 nt.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"),GR=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"),XR=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}=Qt();let h=e.points,u=!1;const d=i;var f=s;const p=[];for(const $ in e.cssCompiledStyles)mk($)||p.push(e.cssCompiledStyles[$]);nt.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])),nt.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&&(nt.info("to cluster abc88",r.get(e.toCluster)),h=nx(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(nt.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(h,null,2)),h=nx(h.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=h.filter($=>!Number.isNaN($.y));const g=WR(e.curve);g!=="rounded"&&(x=VR(x));let y=Po;switch(g){case"linear":y=Po;break;case"basis":y=Iu;break;case"cardinal":y=n1;break;case"bumpX":y=Zb;break;case"bumpY":y=Jb;break;case"catmullRom":y=s1;break;case"monotoneX":y=u1;break;case"monotoneY":y=d1;break;case"natural":y=f1;break;case"step":y=m1;break;case"stepAfter":y=x1;break;case"stepBefore":y=g1;break;case"rounded":y=Po;break;default:y=Iu}const{x:C,y:b}=WP(e),w=TD().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"?yw(bw(x,e),5):w(x);const L=Array.isArray(e.style)?e.style:[e.style];let A=L.find($=>$==null?void 0:$.startsWith("stroke:")),j="";e.animate&&(j="edge-animation-fast"),e.animation&&(j="edge-animation-"+e.animation);let I=!1;if(e.look==="handDrawn"){const $=yt.svg(t);Object.assign([],x);const B=$.path(N,{roughness:.3,seed:l});_+=" transition",S=qt(B).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(j?" "+j:"")).attr("style",L?L.reduce((V,et)=>V+";"+et,""):"");let T=S.attr("d");S.attr("d",T),t.node().appendChild(S.node())}else{const $=p.join(";"),B=L?L.reduce((ht,xt)=>ht+xt+";",""):"",T=($?$+";"+B+";":B)+";"+(L?L.reduce((ht,xt)=>ht+";"+xt,""):"");S=t.append("path").attr("d",N).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(j?" "+j:"")).attr("style",T),A=(O=T.match(/stroke:([^;]+)/))==null?void 0:O[1],I=e.animate===!0||!!e.animation||$.includes("animation");const V=S.node(),et=typeof V.getTotalLength=="function"?V.getTotalLength():0,D=yg[e.arrowTypeStart]||0,G=yg[e.arrowTypeEnd]||0;if(e.look==="neo"&&!I){const xt=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?GR(et,D,G):`0 ${D} ${et-D-G} ${G}`}; stroke-dashoffset: 0;`;S.attr("style",xt+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",De(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="";(Qt().flowchart.arrowMarkerAbsolute||Qt().state.arrowMarkerAbsolute)&&(z=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,z=z.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),nt.info("arrowTypeStart",e.arrowTypeStart),nt.info("arrowTypeEnd",e.arrowTypeEnd);const W=!I&&(e==null?void 0:e.look)==="neo";$R(S,e,z,o,n,W,A);const P=Math.floor(h.length/2),M=h[P];Pr.isLabelCoordinateInPath(M,S.attr("d"))||(u=!0);let F={};return u&&(F.updatedPath=h),F.originalPath=e.points,F},"insertEdge");function yw(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,L=o.y-g*S,A=o.x+y*S,j=o.y+C*S;r+=`L${N},${L}`,r+=`Q${o.x},${o.y} ${A},${j}`}}return r}v(yw,"generateRoundedPath");function hd(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(hd,"calculateDeltaAndAngle");function bw(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&Ge[e.arrowTypeStart]){const i=Ge[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=hd(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&&Ge[e.arrowTypeEnd]){const i=Ge[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=hd(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(bw,"applyMarkerOffsetsToPoints");var KR=v((t,e,r,n)=>{e.forEach(i=>{b6[i](t,r,n)})},"insertMarkers"),QR=v((t,e,r)=>{nt.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"),ZR=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"),JR=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"),t6=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"),e6=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"),r6=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"),n6=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"),i6=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"),s6=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"),o6=v((t,e,r)=>{const n=Ce(),{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"),a6=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"),l6=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"),c6=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"),h6=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"),u6=v((t,e,r)=>{const n=Ce(),{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"),d6=v((t,e,r)=>{const n=Ce(),{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"),p6=v((t,e,r)=>{const n=Ce(),{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"),f6=v((t,e,r)=>{const n=Ce(),{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"),m6=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
|
|
609
|
+
L20,10
|
|
610
|
+
M20,10
|
|
611
|
+
L0,20`)},"requirement_arrow"),g6=v((t,e,r)=>{const n=Ce(),{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
|
|
612
|
+
L20,10
|
|
613
|
+
M20,10
|
|
614
|
+
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),x6=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"),y6=v((t,e,r)=>{const n=Ce(),{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"),b6={extension:QR,composition:ZR,aggregation:JR,dependency:t6,lollipop:e6,point:r6,circle:n6,cross:i6,barb:s6,barbNeo:o6,only_one:a6,zero_or_one:l6,one_or_more:c6,zero_or_more:h6,only_one_neo:u6,zero_or_one_neo:d6,one_or_more_neo:p6,zero_or_more_neo:f6,requirement_arrow:m6,requirement_contains:x6,requirement_arrow_neo:g6,requirement_contains_neo:y6},C6=KR,k6={common:da,getConfig:Ce,insertCluster:yR,insertEdge:XR,insertEdgeLabel:qR,insertMarkers:C6,insertNode:gw,interpolateToCurve:zp,labelHelper:Bt,log:nt,positionEdgeLabel:HR},ra={},Cw=v(t=>{for(const e of t)ra[e.name]=e},"registerLayoutLoaders"),v6=v(()=>{Cw([{name:"dagre",loader:v(async()=>await Vt(()=>import("./dagre-BM42HDAG-C2fmFG1L.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Vt(()=>import("./cose-bilkent-S5V4N54A-Dd3Ids4E.js"),__vite__mapDeps([8,7,3,4,5,6])),"loader")}])},"registerDefaultLayoutLoaders");v6();var hV=v(async(t,e)=>{if(!(t.layoutAlgorithm in ra))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=ra[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,k6,{algorithm:r.algorithm})},"render"),uV=v((t="",{fallback:e="dagre"}={})=>{if(t in ra)return t;if(e in ra)return nt.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"),cf="comm",kw="rule",vw="decl",w6="@media",S6="@import",T6="@supports",_6="@namespace",ud="@keyframes",ww="@layer",j6="@scope",N6=Math.abs,$o=String.fromCharCode;function Sw(t){return t.trim()}function dd(t,e,r){return t.replace(e,r)}function rs(t,e){return t.charCodeAt(e)|0}function js(t,e,r){return t.slice(e,r)}function Kr(t){return t.length}function Tw(t){return t.length}function Ha(t,e){return e.push(t),t}var $c=1,Ns=1,_w=0,Br=0,Be=0,Os="";function hf(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:$c,column:Ns,length:o,return:"",siblings:a}}function E6(){return Be}function B6(){return Be=Br>0?rs(Os,--Br):0,Ns--,Be===10&&(Ns=1,$c--),Be}function Rr(){return Be=Br<_w?rs(Os,Br++):0,Ns++,Be===10&&(Ns=1,$c++),Be}function Dn(){return rs(Os,Br)}function fl(){return Br}function Rc(t,e){return js(Os,t,e)}function na(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 L6(t){return $c=Ns=1,_w=Kr(Os=t),Br=0,[]}function A6(t){return Os="",t}function Wh(t){return Sw(Rc(Br-1,pd(t===91?t+2:t===40?t+1:t)))}function M6(t){for(;(Be=Dn())&&Be<33;)Rr();return na(t)>2||na(Be)>3?"":" "}function I6(t,e){for(;--e&&Rr()&&!(Be<48||Be>102||Be>57&&Be<65||Be>70&&Be<97););return Rc(t,fl()+(e<6&&Dn()==32&&Rr()==32))}function pd(t){for(;Rr();)switch(Be){case t:return Br;case 34:case 39:t!==34&&t!==39&&pd(Be);break;case 40:t===41&&pd(t);break;case 92:Rr();break}return Br}function F6(t,e){for(;Rr()&&t+Be!==57;)if(t+Be===84&&Dn()===47)break;return"/*"+Rc(e,Br-1)+"*"+$o(t===47?t:Rr())}function D6(t){for(;!na(Dn());)Rr();return Rc(t,Br)}function P6(t){return A6(ml("",null,null,null,[""],t=L6(t),0,[0],t))}function ml(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,L=w;g;)switch(m=b,b=Rr()){case 40:m!=108&&rs(L,d-1)==58?(C++,L+="("):L+=Wh(b);break;case 41:C--,L+=")";break;case 34:case 39:case 91:L+=Wh(b);break;case 9:case 10:case 13:case 32:if(C>0){L+=$o(b);break}L+=M6(m);break;case 92:L+=I6(fl()-1,7);continue;case 47:switch(Dn()){case 42:case 47:Ha(O6(F6(Rr(),fl()),e,r,l),l),(na(m||1)==5||na(Dn()||1)==5)&&Kr(L)&&js(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*x:a[h++]=Kr(L)*y;case 125*x:case 59:case 0:if(C>0&&b){L+=$o(b);break}switch(b){case 0:case 125:g=0;case 59+u:y==-1&&(L=dd(L,/\f/g,"")),p>0&&(Kr(L)-d||x===0)&&Ha(p>32?ox(L+";",n,r,d-1,l):ox(dd(L," ","")+";",n,r,d-2,l),l);break;case 59:L+=";";default:if(Ha(N=sx(L,e,r,h,u,i,a,w,_=[],S=[],d,s),s),b===123)if(u===0)ml(L,e,N,N,_,s,d,a,S);else{switch(f){case 99:if(rs(L,3)===110)break;case 108:if(rs(L,2)===97)break;default:u=0;case 100:case 109:case 115:}u?ml(t,N,N,n&&Ha(sx(t,N,N,0,0,i,a,w,i,_=[],d,S),S),i,S,d,a,n?_:S):ml(L,N,N,N,[""],S,0,a,S)}}h=u=p=0,x=y=1,w=L="",d=o;break;case 58:d=1+Kr(L),p=m;default:if(x<1){if(b==123)--x;else if(b==125&&x++==0&&B6()==125)continue}switch(L+=$o(b),b*x){case 38:y=u>0?1:(L+="\f",-1);break;case 44:if(C>0)break;a[h++]=(Kr(L)-1)*y,y=1;break;case 64:Dn()===45&&(L+=Wh(Rr())),f=Dn(),u=d=Kr(w=L+=D6(fl())),b++;break;case 45:m===45&&Kr(L)==2&&(x=0)}}return s}function sx(t,e,r,n,i,s,o,a,l,h,u,d){for(var f=i-1,p=i===0?s:[""],m=Tw(p),x=0,g=0,y=0;x<n;++x)for(var C=0,b=js(t,f+1,f=N6(g=o[x])),w=t;C<m;++C)(w=Sw(g>0?p[C]+" "+b:dd(b,/&\f/g,p[C])))&&(l[y++]=w);return hf(t,e,r,i===0?kw:a,l,h,u,d)}function O6(t,e,r,n){return hf(t,e,r,cf,$o(E6()),js(t,2,-2),0,n)}function ox(t,e,r,n,i){return hf(t,e,r,vw,js(t,0,n),js(t,n+1,-1),n,i)}function fd(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function $6(t,e,r,n){switch(t.type){case ww:if(t.children.length)break;case S6:case _6:case vw:return t.return=t.return||t.value;case cf:return"";case ud:return t.return=t.value+"{"+fd(t.children,n)+"}";case kw:if(!Kr(t.value=t.props.join(",")))return""}return Kr(r=fd(t.children,n))?t.return=t.value+"{"+r+"}":""}function R6(t){var e=Tw(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 jw="c4",z6=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),W6=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./c4Diagram-AAUBKEIU-B-tXpPJU.js");return{diagram:e}},__vite__mapDeps([9,10,3,4,5,6,7]));return{id:jw,diagram:t}},"loader"),q6={id:jw,detector:z6,loader:W6},H6=q6,Nw="flowchart",U6=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"),Y6=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DKGbnIHA.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:Nw,diagram:t}},"loader"),V6={id:Nw,detector:U6,loader:Y6},G6=V6,Ew="flowchart-v2",X6=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"),K6=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DKGbnIHA.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:Ew,diagram:t}},"loader"),Q6={id:Ew,detector:X6,loader:K6},Z6=Q6,Bw="er",J6=v(t=>/^\s*erDiagram/.test(t),"detector"),t8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./erDiagram-TEJ5UH35-DWszA5vM.js");return{diagram:e}},__vite__mapDeps([16,13,14,15,3,4,5,6,7]));return{id:Bw,diagram:t}},"loader"),e8={id:Bw,detector:J6,loader:t8},r8=e8,Lw="gitGraph",n8=v(t=>/^\s*gitGraph/.test(t),"detector"),i8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-PVQCEYII-wraCb0iO.js");return{diagram:e}},__vite__mapDeps([17,18,19,20,5,3,4,6,7]));return{id:Lw,diagram:t}},"loader"),s8={id:Lw,detector:n8,loader:i8},o8=s8,Aw="gantt",a8=v(t=>/^\s*gantt/.test(t),"detector"),l8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./ganttDiagram-6RSMTGT7-D5CoNr7u.js");return{diagram:e}},__vite__mapDeps([21,3,4,22,23,24,5,6,7]));return{id:Aw,diagram:t}},"loader"),c8={id:Aw,detector:a8,loader:l8},h8=c8,Mw="info",u8=v(t=>/^\s*info/.test(t),"detector"),d8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./infoDiagram-5YYISTIA-CLT2YJ_w.js");return{diagram:e}},__vite__mapDeps([25,20,5,3,4,6,7]));return{id:Mw,diagram:t}},"loader"),p8={id:Mw,detector:u8,loader:d8},Iw="pie",f8=v(t=>/^\s*pie/.test(t),"detector"),m8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./pieDiagram-4H26LBE5-CppszhAX.js");return{diagram:e}},__vite__mapDeps([26,18,20,5,3,4,6,27,28,23,7]));return{id:Iw,diagram:t}},"loader"),g8={id:Iw,detector:f8,loader:m8},Fw="quadrantChart",x8=v(t=>/^\s*quadrantChart/.test(t),"detector"),y8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./quadrantDiagram-W4KKPZXB-jpp555QD.js");return{diagram:e}},__vite__mapDeps([29,22,23,24,3,4,5,6,7]));return{id:Fw,diagram:t}},"loader"),b8={id:Fw,detector:x8,loader:y8},C8=b8,Dw="xychart",k8=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),v8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./xychartDiagram-2RQKCTM6-CrSsH0ZL.js");return{diagram:e}},__vite__mapDeps([30,23,28,22,24,3,4,5,6,7]));return{id:Dw,diagram:t}},"loader"),w8={id:Dw,detector:k8,loader:v8},S8=w8,Pw="requirement",T8=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),_8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./requirementDiagram-4Y6WPE33-nKJCyHfW.js");return{diagram:e}},__vite__mapDeps([31,13,14,3,4,5,6,7]));return{id:Pw,diagram:t}},"loader"),j8={id:Pw,detector:T8,loader:_8},N8=j8,Ow="sequence",E8=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),B8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./sequenceDiagram-3UESZ5HK-CcOMecR8.js");return{diagram:e}},__vite__mapDeps([32,10,19,3,4,5,6,7]));return{id:Ow,diagram:t}},"loader"),L8={id:Ow,detector:E8,loader:B8},A8=L8,$w="class",M8=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"),I8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./classDiagram-4FO5ZUOK-Vt88epYI.js");return{diagram:e}},__vite__mapDeps([33,34,12,10,13,14,3,4,5,6,7]));return{id:$w,diagram:t}},"loader"),F8={id:$w,detector:M8,loader:I8},D8=F8,Rw="classDiagram",P8=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"),O8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./classDiagram-v2-Q7XG4LA2-Vt88epYI.js");return{diagram:e}},__vite__mapDeps([35,34,12,10,13,14,3,4,5,6,7]));return{id:Rw,diagram:t}},"loader"),$8={id:Rw,detector:P8,loader:O8},R8=$8,zw="state",z8=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"),W8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./stateDiagram-AJRCARHV-D0yHv9PM.js");return{diagram:e}},__vite__mapDeps([36,37,13,14,1,2,3,4,5,6,7]));return{id:zw,diagram:t}},"loader"),q8={id:zw,detector:z8,loader:W8},H8=q8,Ww="stateDiagram",U8=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"),Y8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-BHNVJYJU-CFwFamMD.js");return{diagram:e}},__vite__mapDeps([38,37,13,14,3,4,5,6,7]));return{id:Ww,diagram:t}},"loader"),V8={id:Ww,detector:U8,loader:Y8},G8=V8,qw="journey",X8=v(t=>/^\s*journey/.test(t),"detector"),K8=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./journeyDiagram-JHISSGLW-CbYKANnV.js");return{diagram:e}},__vite__mapDeps([39,12,10,27,3,4,5,6,7]));return{id:qw,diagram:t}},"loader"),Q8={id:qw,detector:X8,loader:K8},Z8=Q8,J8=v((t,e,r)=>{nt.debug(`rendering svg for syntax error
|
|
615
|
+
`);const n=ID(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),kb(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"),Hw={draw:J8},tz=Hw,ez={db:{},renderer:Hw,parser:{parse:v(()=>{},"parse")}},rz=ez,Uw="flowchart-elk",nz=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"),iz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-DKGbnIHA.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:Uw,diagram:t}},"loader"),sz={id:Uw,detector:nz,loader:iz},oz=sz,Yw="timeline",az=v(t=>/^\s*timeline/.test(t),"detector"),lz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./timeline-definition-PNZ67QCA-hsR-T0Te.js");return{diagram:e}},__vite__mapDeps([40,27,3,4,5,6,7]));return{id:Yw,diagram:t}},"loader"),cz={id:Yw,detector:az,loader:lz},hz=cz,Vw="mindmap",uz=v(t=>/^\s*mindmap/.test(t),"detector"),dz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./mindmap-definition-RKZ34NQL-DzXKDTRa.js");return{diagram:e}},__vite__mapDeps([41,13,14,3,4,5,6,7]));return{id:Vw,diagram:t}},"loader"),pz={id:Vw,detector:uz,loader:dz},fz=pz,Gw="kanban",mz=v(t=>/^\s*kanban/.test(t),"detector"),gz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./kanban-definition-UN3LZRKU-CYNaaEmw.js");return{diagram:e}},__vite__mapDeps([42,12,3,4,5,6,7]));return{id:Gw,diagram:t}},"loader"),xz={id:Gw,detector:mz,loader:gz},yz=xz,Xw="sankey",bz=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),Cz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./sankeyDiagram-5OEKKPKP-D-oX8o5g.js");return{diagram:e}},__vite__mapDeps([43,28,23,3,4,5,6,7]));return{id:Xw,diagram:t}},"loader"),kz={id:Xw,detector:bz,loader:Cz},vz=kz,Kw="packet",wz=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),Sz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./diagram-LMA3HP47-DkhUcRJZ.js");return{diagram:e}},__vite__mapDeps([44,18,20,5,3,4,6,7]));return{id:Kw,diagram:t}},"loader"),Tz={id:Kw,detector:wz,loader:Sz},Qw="radar",_z=v(t=>/^\s*radar-beta/.test(t),"detector"),jz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./diagram-2AECGRRQ-gZjYzjSJ.js");return{diagram:e}},__vite__mapDeps([45,18,20,5,3,4,6,7]));return{id:Qw,diagram:t}},"loader"),Nz={id:Qw,detector:_z,loader:jz},Zw="block",Ez=v(t=>/^\s*block(-beta)?/.test(t),"detector"),Bz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./blockDiagram-GPEHLZMM-DgA84B2f.js");return{diagram:e}},__vite__mapDeps([46,12,1,15,3,4,5,6,7]));return{id:Zw,diagram:t}},"loader"),Lz={id:Zw,detector:Ez,loader:Bz},Az=Lz,Jw="treeView",Mz=v(t=>/^\s*treeView-beta/.test(t),"detector"),Iz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./diagram-5GNKFQAL-uxJ9zL35.js");return{diagram:e}},__vite__mapDeps([47,18,19,20,5,3,4,6,7]));return{id:Jw,diagram:t}},"loader"),Fz={id:Jw,detector:Mz,loader:Iz},Dz=Fz,t2="architecture",Pz=v(t=>/^\s*architecture/.test(t),"detector"),Oz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./architectureDiagram-3BPJPVTR-SiqLJ2Dv.js");return{diagram:e}},__vite__mapDeps([48,18,20,5,3,4,6,7]));return{id:t2,diagram:t}},"loader"),$z={id:t2,detector:Pz,loader:Oz},Rz=$z,e2="eventmodeling",zz=v(t=>/^\s*eventmodeling/.test(t),"detector"),Wz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./diagram-KO2AKTUF--9DBGjk3.js");return{diagram:e}},__vite__mapDeps([49,18,20,5,3,4,6,7]));return{id:e2,diagram:t}},"loader"),qz={id:e2,detector:zz,loader:Wz},Hz=qz,r2="ishikawa",Uz=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),Yz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-YF4QCWOH-1WQ5ViOx.js");return{diagram:e}},__vite__mapDeps([50,3,4,5,6,7]));return{id:r2,diagram:t}},"loader"),Vz={id:r2,detector:Uz,loader:Yz},n2="venn",Gz=v(t=>/^\s*venn-beta/.test(t),"detector"),Xz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./vennDiagram-CIIHVFJN-C9b10oqu.js");return{diagram:e}},__vite__mapDeps([51,3,4,5,6,7]));return{id:n2,diagram:t}},"loader"),Kz={id:n2,detector:Gz,loader:Xz},Qz=Kz,i2="treemap",Zz=v(t=>/^\s*treemap/.test(t),"detector"),Jz=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./diagram-OG6HWLK6-BaJ__gNW.js");return{diagram:e}},__vite__mapDeps([52,14,18,20,5,3,4,6,24,28,23,7]));return{id:i2,diagram:t}},"loader"),t9={id:i2,detector:Zz,loader:Jz},s2="wardley-beta",e9=v(t=>/^\s*wardley-beta/i.test(t),"detector"),r9=v(async()=>{const{diagram:t}=await Vt(async()=>{const{diagram:e}=await import("./wardleyDiagram-YWT4CUSO-DReamCcN.js");return{diagram:e}},__vite__mapDeps([53,18,20,5,3,4,6,7]));return{id:s2,diagram:t}},"loader"),n9={id:s2,detector:e9,loader:r9},i9=n9,ax=!1,zc=v(()=>{ax||(ax=!0,Ml("error",rz,t=>t.toLowerCase().trim()==="error"),Ml("---",{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("---")),bu(oz,fz,Rz),bu(H6,yz,R8,D8,r8,h8,p8,g8,N8,A8,Z6,G6,hz,o8,G8,H8,Z8,C8,vz,Tz,S8,Az,Hz,Dz,Nz,Vz,t9,Qz,i9))},"addDiagrams"),s9=v(async()=>{nt.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(xi).map(async([r,{detector:n,loader:i}])=>{if(i)try{Su(r)}catch{try{const{diagram:s,id:o}=await i();Ml(o,s,n)}catch(s){throw nt.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete xi[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){nt.error(`Failed to load ${e.length} external diagrams`);for(const r of e)nt.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),o9="graphics-document document";function o2(t,e){t.attr("role",o9),e!==""&&t.attr("aria-roledescription",e)}v(o2,"setA11yDiagramInfo");function a2(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(a2,"addSVGa11yTitleDescription");var pi,md=(pi=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=Ce(),i=up(e,n);e=OO(e)+`
|
|
616
|
+
`;try{Su(i)}catch{const d=tM(i);if(!d)throw new ob(`Diagram ${i} not found.`);const{id:f,diagram:p}=await d();Ml(f,p)}const{db:s,parser:o,renderer:a,init:l}=Su(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 pi(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(pi,"Diagram"),pi),lx=[],a9=v(()=>{lx.forEach(t=>{t()}),lx=[]},"attachFunctions"),l9=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function l2(t){const e=t.match(sb);if(!e)return{text:t,metadata:{}};let r=zP(e[1],{schema:RP})??{};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(l2,"extractFrontMatter");var c9=v(t=>t.replace(/\r\n?/g,`
|
|
617
|
+
`).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),h9=v(t=>{const{text:e,metadata:r}=l2(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"),u9=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:TO(t),directive:e}},"processDirectives");function uf(t){const e=c9(t),r=h9(e),n=u9(r.text),i=Yp(r.config,n.directive);return t=l9(n.text),{code:t,title:r.title,config:i}}v(uf,"preprocessDiagram");function c2(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(c2,"toBase64");var d9=5e4,p9="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",f9="sandbox",m9="loose",g9="http://www.w3.org/2000/svg",x9="http://www.w3.org/1999/xlink",y9="http://www.w3.org/1999/xhtml",b9="100%",C9="100%",k9="border:0;margin:0;",v9="margin:0",w9="allow-top-navigation-by-user-activation allow-popups",S9='The "iframe" tag is not supported by your browser.',T9=["foreignobject"],_9=["dominant-baseline"];function df(t){const e=uf(t);return Ll(),jM(e.config??{}),e}v(df,"processAndSetConfigs");async function h2(t,e){zc();try{const{code:r,config:n}=df(t);return{diagramType:(await d2(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(h2,"parse");var cx=v((t,e,r=[])=>{const n=ub(`{ ${r.join(" !important; ")} !important; }`);return`.${t} ${e} ${n}`},"cssImportantStyles"),j9=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=ar(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(l=>{wg(l.styles)||a.forEach(h=>{r.insertRule(cx(l.id,h,l.styles),r.cssRules.length)}),wg(l.textStyles)||r.insertRule(cx(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=wu(i)+`
|
|
618
|
+
`}else n+=`${t.themeCSS}
|
|
619
|
+
`;return n+wu(r)},"createCssStyles"),N9=v((t,e)=>fd(P6(`${t}{${e}}`),R6([v(function(n,i,s,o){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===ud)return;n.props=n.props.map(a=>a.startsWith(t)?a:`${t} ${a}`)}else n.type.startsWith("@")&&([...[w6,T6,ww,j6,"@container","@starting-style"],ud].includes(n.type)||(nt.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=cf))},"addNamespace"),$6])),"compileCSS"),E9=v((t,e,r,n)=>{const i=j9(t,r),s=YM(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return N9(n,s)},"createUserStyles"),B9=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=ki(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),L9=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":C9,n=c2(`<body style="${v9}">${t}</body>`);return`<iframe style="width:${b9};height:${r};${k9}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${w9}">
|
|
620
|
+
${S9}
|
|
621
|
+
</iframe>`},"putIntoIFrame"),hx=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",g9);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function gd(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(gd,"sandboxedIframe");var A9=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"),M9=v(async function(t,e,r){var z,W,P,M,F,O;zc();const n=df(e);e=n.code;const i=Ce();nt.debug(i),e.length>((i==null?void 0:i.maxTextSize)??d9)&&(e=p9);const s=`#${t}`,o="i"+t,a="#"+o,l="d"+t,h="#"+l,u=v(()=>{const B=qt(f?a:h).node();B&&"remove"in B&&B.remove()},"removeTempElements");let d=qt(document.body);const f=i.securityLevel===f9,p=i.securityLevel===m9,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),f){const $=gd(qt(r),o);d=qt($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=qt(r);hx(d,t,l,`font-family: ${m}`,x9)}else{if(A9(document,t,l,o),f){const $=gd(qt(document.body),o);d=qt($.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=qt("body");hx(d,t,l)}let x,g;try{x=await md.fromText(e,{title:n.title})}catch($){if(i.suppressErrorRendering)throw u(),$;x=await md.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=E9(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():tz.draw(e,t,"11.15.0"),$}const L=d.select(`${h} svg`),A=(M=(P=x.db).getAccTitle)==null?void 0:M.call(P),j=(O=(F=x.db).getAccDescription)==null?void 0:O.call(F);p2(C,L,A,j),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",y9);let I=d.select(h).node().innerHTML;if(nt.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),I=B9(I,f,Sn(i.arrowMarkerAbsolute)),f){const $=d.select(h+" svg").node();I=L9(I,$)}else p||(I=ks.sanitize(I,{ADD_TAGS:T9,ADD_ATTR:_9,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(a9(),g)throw g;return u(),{diagramType:C,svg:I,bindFunctions:x.db.bindFunctions}},"render");function u2(t={}){var n;const e=Ie({},t);e!=null&&e.fontFamily&&!((n=e.themeVariables)!=null&&n.fontFamily)&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),TM(e),e!=null&&e.theme&&e.theme in gn?e.themeVariables=gn[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=gn.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?SM(e):db();hp(r.logLevel),zc()}v(u2,"initialize");var d2=v((t,e={})=>{const{code:r}=uf(t);return md.fromText(r,e)},"getDiagramFromText");function p2(t,e,r,n){o2(e,t),a2(e,r,n,e.attr("id"))}v(p2,"addA11yInfo");var wi=Object.freeze({render:M9,parse:h2,getDiagramFromText:d2,initialize:u2,getConfig:Ce,setConfig:pb,getSiteConfig:db,updateSiteConfig:_M,reset:v(()=>{Ll()},"reset"),globalReset:v(()=>{Ll(vs)},"globalReset"),defaultConfig:vs});hp(Ce().logLevel);Ll(Ce());var I9=v((t,e,r)=>{nt.warn(t),Up(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"),f2=v(async function(t={querySelector:".mermaid"}){try{await F9(t)}catch(e){if(Up(e)&&nt.error(e.str),Sr.parseError&&Sr.parseError(e),!t.suppressErrors)throw nt.error("Use the suppressErrors option to suppress these errors"),e}},"run"),F9=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=wi.getConfig();nt.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");nt.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(nt.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),wi.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(nt.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const h=`mermaid-${s.next()}`;o=l.innerHTML,o=Nk(Pr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Pr.detectInit(o);u&&nt.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:f}=await y2(h,o,l);l.innerHTML=d,t&&await t(h),f&&f(l)}catch(d){I9(d,a,Sr.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),m2=v(function(t){wi.initialize(t)},"initialize"),D9=v(async function(t,e,r){nt.warn("mermaid.init is deprecated. Please use run instead."),t&&m2(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await f2(n)},"init"),P9=v(async(t,{lazyLoad:e=!0}={})=>{zc(),bu(...t),e===!1&&await s9()},"registerExternalDiagrams"),g2=v(function(){if(Sr.startOnLoad){const{startOnLoad:t}=wi.getConfig();t&&Sr.run().catch(e=>nt.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",g2,!1);var O9=v(function(t){Sr.parseError=t},"setParseErrorHandler"),sc=[],qh=!1,x2=v(async()=>{if(!qh){for(qh=!0;sc.length>0;){const t=sc.shift();if(t)try{await t()}catch(e){nt.error("Error executing queue",e)}}qh=!1}},"executeQueue"),$9=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{wi.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;nt.error("Error parsing",a),(l=Sr.parseError)==null||l.call(Sr,a),o(a),n(a)})}),"performCall");sc.push(i),x2().catch(n)}),"parse"),y2=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{wi.render(t,e,r).then(l=>{o(l),n(l)},l=>{var h;nt.error("Error parsing",l),(h=Sr.parseError)==null||h.call(Sr,l),a(l),i(l)})}),"performCall");sc.push(s),x2().catch(i)}),"render"),R9=v(()=>Object.keys(xi).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),Sr={startOnLoad:!0,mermaidAPI:wi,parse:$9,render:y2,init:D9,run:f2,registerExternalDiagrams:P9,registerLayoutLoaders:Cw,initialize:m2,parseError:void 0,contentLoaded:g2,setParseErrorHandler:O9,detectType:up,registerIconPacks:U$,getRegisteredDiagramsMetadata:R9},b2=Sr;/*! Check if previously processed *//*!
|
|
622
|
+
* Wait for document loaded before starting the execution
|
|
623
|
+
*/b2.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function z9({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 b2.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}
|
|
624
|
+
|
|
625
|
+
${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 W9({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?c.jsx(z9,{code:String(e).trim()}):c.jsx("code",{className:t,...r,children:e})}const q9=`prose prose-sm prose-invert max-w-none
|
|
626
|
+
prose-headings:text-foreground prose-p:text-muted-foreground
|
|
627
|
+
prose-a:text-accent prose-strong:text-foreground
|
|
628
|
+
prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
|
|
629
|
+
prose-pre:bg-muted prose-pre:border prose-pre:border-border
|
|
630
|
+
prose-li:text-muted-foreground prose-table:text-xs
|
|
631
|
+
prose-th:text-foreground prose-td:text-muted-foreground
|
|
632
|
+
prose-hr:border-border`;function Wc({content:t,className:e}){return c.jsx("article",{className:st(q9,e),children:c.jsx(Jd,{remarkPlugins:[np],components:{code:W9},children:t||""})})}function H9(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 C2(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=C2(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function k2(t){let e=t.files.length;for(const r of t.children.values())e+=k2(r);return e}function v2({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=U9(t,e),h=r.has(l)||!!a,u=k2(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(nT,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):c.jsx(Id,{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(v2,{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(w2,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function w2({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(Si,{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 U9(t,e){return`dir-${e}-${t.name}`}function S2({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=X=>{p(X),r&&r(X)},[g,y]=k.useState(null),[C,b]=k.useState(!1),[w,_]=k.useState(!1),[S,N]=k.useState(""),[L,A]=k.useState(null),[j,I]=k.useState(!1),z=k.useRef(null),[W,P]=k.useState(""),[M,F]=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),V=k.useCallback(X=>{X.preventDefault(),B.current=!0;const it=gt=>{if(!B.current||!T.current)return;const Jt=T.current.getBoundingClientRect(),Pt=Math.min(Math.max(gt.clientX-Jt.left,160),500);$(Pt)},vt=()=>{B.current=!1,document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",vt),$(gt=>(localStorage.setItem("compose:docsTreeWidth",gt),gt))};document.addEventListener("mousemove",it),document.addEventListener("mouseup",vt)},[]),et=w&&S!==L,D=k.useCallback(async()=>{if(!(!m||j)){I(!0);try{const X=await Nt("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:S})});X.ok?(A(S),y(S),oe("Saved","info")):oe(`Save failed (${X.status})`,"error")}catch(X){oe(`Save failed: ${X.message}`,"error")}I(!1)}},[m,S,j]),G=k.useCallback(()=>{_(X=>(!X&&g!==null&&(N(g),A(g)),!X))},[g]);k.useEffect(()=>{if(!w)return;const X=it=>{(it.metaKey||it.ctrlKey)&&it.key==="s"&&(it.preventDefault(),D())};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[w,D]),k.useEffect(()=>{_(!1),N(""),A(null)},[m]),k.useEffect(()=>{Nt("/api/files").then(X=>X.json()).then(X=>{h(X.files||[]),d(!1);const it=new Set(["dir-0-docs"]);for(const vt of X.files||[]){const gt=vt.split("/");gt.length>1&&it.add(`dir-1-${gt[1]}`)}F(it)}).catch(()=>d(!1))},[]),k.useEffect(()=>{if(!m){y(null);return}b(!0),Nt(`/api/file?path=${encodeURIComponent(m)}`).then(X=>X.json()).then(X=>{y(X.content??null),b(!1)}).catch(()=>{y(null),b(!1)})},[m]);const ht=k.useMemo(()=>!o||!s?l:l.filter(X=>X.includes(`features/${s}/`)),[l,o,s]),xt=k.useMemo(()=>{const X=new Set,it=vt=>vt.split("/").pop();for(const vt of t){const gt=`${vt.title||""} ${vt.description||""} ${vt.planLink||""}`.toLowerCase();for(const Jt of ht)(gt.includes(Jt.toLowerCase())||gt.includes(it(Jt).replace(".md","").toLowerCase()))&&X.add(Jt)}return X},[t,ht]),$t=k.useMemo(()=>H9(ht),[ht]),Ht=k.useMemo(()=>C2($t,W),[$t,W]),ct=k.useCallback(X=>{F(it=>{const vt=new Set(it);return vt.has(X)?vt.delete(X):vt.add(X),vt})},[]);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(ha,{featureCode:s,active:o,onToggle:a})}),c.jsxs("div",{className:"relative",children:[c.jsx(vn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),c.jsx(jd,{placeholder:"Search files...",value:W,onChange:X=>P(X.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(kn,{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-xt.size," untracked"]})]})]}),c.jsx(Wn,{className:"flex-1",children:c.jsxs("div",{className:"py-1",children:[[...Ht.children.values()].sort((X,it)=>X.name.localeCompare(it.name)).map(X=>c.jsx(v2,{node:X,depth:0,expandedDirs:M,onToggleDir:ct,selectedFile:m,onSelectFile:x,trackedPaths:xt,searchQuery:W},X.name)),Ht.files.sort((X,it)=>X.name.localeCompare(it.name)).map(X=>c.jsx(w2,{file:X,depth:0,isSelected:m===X.path,isTracked:xt.has(X.path),onSelect:()=>x(X.path)},X.path))]})})]}),c.jsx("div",{onMouseDown:V,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(AS,{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}),et&&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"}),xt.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||!et,className:st("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",et?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[c.jsx(IT,{className:"h-3 w-3"}),j?"Saving...":"Save"]}),c.jsx("button",{onClick:G,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(u0,{className:"h-3.5 w-3.5"}):c.jsx(f0,{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:X=>N(X.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(Wn,{className:"flex-1",children:c.jsx("div",{className:"px-6 py-4 max-w-3xl",children:c.jsx(Wc,{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(Si,{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 Y9{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 L=_.oldPos-C;S=_&&0<=L&&L<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 V9 extends Y9{constructor(){super(...arguments),this.tokenize=K9}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
633
|
+
`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
|
|
634
|
+
`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
635
|
+
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
|
636
|
+
`)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const G9=new V9;function X9(t,e,r){return G9.diff(t,e,r)}function K9(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
|
637
|
+
`));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 pf({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=X9(t,e);let l=0,h=0;for(const u of a){const d=u.value.split(`
|
|
638
|
+
`).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(`
|
|
639
|
+
`);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 T2(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 Q9({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=x0[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 Z9(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 J9({gate:t}){const e=Z9(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 ux({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 t7({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:yn[t.stepId]??`${Te[t.fromPhase]??t.fromPhase} → ${Te[t.toPhase]??t.toPhase}`}),c.jsx(Q9,{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(Ls,{className:"h-3 w-3"}):c.jsx(fi,{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(Wc,{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(pf,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),c.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:T2(t.createdAt)})]}),c.jsx("div",{className:"mt-1.5",children:c.jsx(J9,{gate:t})}),c.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[c.jsx(Dt,{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(Dt,{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(Dt,{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(Dt,{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 e7(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function r7({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=e7(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(gr,{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:T2(t.resolvedAt)})]}),c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:yn[t.stepId]??`${Te[t.fromPhase]??t.fromPhase} → ${Te[t.toPhase]??t.toPhase}`}),t.comment&&c.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function _2({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o,focusedGateId:a,onFocusHandled:l}){const[h,u]=k.useState(null),[d,f]=k.useState(null),p=k.useRef(new Map),[m,x]=k.useState(null),g=k.useMemo(()=>{if(!s||!i)return t;const L=new Set(e.filter(A=>{var j;return A.featureCode===i||((j=A.lifecycle)==null?void 0:j.featureCode)===i}).map(A=>A.id));return t.filter(A=>L.has(A.itemId))},[t,e,s,i]),y=(L,A)=>{u(L),f(A)},{pending:C,resolved:b,priorRevisions:w}=k.useMemo(()=>{const L=[],A=[];for(const I of g)I.status==="pending"?L.push(I):I.resolvedAt&&A.push(I);L.sort((I,z)=>new Date(I.createdAt)-new Date(z.createdAt)),A.sort((I,z)=>new Date(z.resolvedAt)-new Date(I.resolvedAt));const j=new Map;for(const I of L){const z=A.find(W=>W.stepId===I.stepId&&W.itemId===I.itemId&&(W.outcome==="revised"||W.outcome==="revise")&&W.comment);z&&j.set(I.id,{comment:z.comment,priorSnapshot:z.artifactSnapshot||null,currentSnapshot:I.artifactSnapshot||null})}return{pending:L,resolved:A,priorRevisions:j}},[g]),[_,S]=k.useState(!1),N=k.useMemo(()=>new Map(e.map(L=>[L.id,L])),[e]);return k.useEffect(()=>{var j;if(!a)return;const L=p.current.get(a);if(!L)return;(j=L.scrollIntoView)==null||j.call(L,{behavior:"smooth",block:"center"}),x(a),l==null||l();const A=setTimeout(()=>x(null),1600);return()=>clearTimeout(A)},[a,C,b,l]),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(ha,{featureCode:i,active:s,onToggle:o}),c.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),C.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:[C.length," pending"]}):c.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),b.length>0&&c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",b.length," resolved"]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[C.length>0&&c.jsx(ux,{title:"Pending",count:C.length,color:"#f59e0b",children:C.map(L=>c.jsx("div",{ref:A=>{A?p.current.set(L.id,A):p.current.delete(L.id)},className:st("transition-colors duration-500",m===L.id&&"bg-amber-400/15 ring-1 ring-amber-400/40 rounded"),children:c.jsx(t7,{gate:L,item:N.get(L.itemId),priorRevision:w.get(L.id),isExpanded:h===L.id,expandedAction:h===L.id?d:null,onExpand:y,onResolve:r,onSelect:n})},L.id))}),b.length>0&&c.jsxs(ux,{title:"History",count:b.length,color:"#22c55e",children:[(_?b.slice(0,50):b.slice(0,10)).map(L=>c.jsx("div",{ref:A=>{A?p.current.set(L.id,A):p.current.delete(L.id)},className:st("transition-colors duration-500",m===L.id&&"bg-amber-400/15 ring-1 ring-amber-400/40 rounded"),children:c.jsx(r7,{gate:L,item:N.get(L.itemId)})},L.id)),b.length>10&&!_&&c.jsxs("button",{className:"w-full px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>S(!0),children:["Show all ",b.length," resolved gates"]})]}),C.length===0&&b.length===0&&c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function j2({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: ${qo(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 n7({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=k.useContext(bc),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=`
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
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}
|
|
643
|
+
`;try{const y=await Nt(yS("/api/terminal/inject"),{method:"POST",headers:Pn({"Content-Type":"application/json"}),body:JSON.stringify({text:g})});if(!y.ok){oe(`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),oe(`Could not send to terminal: ${y.message}`,"error")}},[t]),p=k.useCallback(()=>{const x=a.trim()?`${t.description||""}
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
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))":xr.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(Dt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:p,children:c.jsx(Fd,{className:"h-3 w-3"})}),c.jsx(Dt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:c.jsx(kn,{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(dc,{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(oa,{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(XS,{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 N2({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 Nt(`/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?`
|
|
647
|
+
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(`
|
|
648
|
+
`);l("running");try{const y=await Nt("/api/agent/spawn",{method:"POST",headers:Pn({"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"),oe(`Could not start challenge agent (${y.status})`,"error");return}const C=await y.json();o(C.agentId)}catch(y){l("failed"),u(y.message),oe(`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(yl,{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(Dt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:c.jsx(kn,{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(p0,{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(n7,{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(Dt,{size:"sm",className:st("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[c.jsx(yl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const i7=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],s7=["gate","flag","skip"],o7=["light","dark","system"],dx=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function mo({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 zi({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 a7({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 E2({settings:t,onSettingsChange:e,onReset:r}){var p,m,x,g,y,C;const n=e0();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(mo,{title:"Phase Policies",children:i7.map(b=>c.jsx(zi,{label:Te[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:"—"}),s7.map(w=>c.jsx("option",{value:w,children:w},w))]})},b))}),c.jsxs(mo,{title:"Iteration Limits",children:[c.jsx(zi,{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(zi,{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(mo,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var w;return c.jsx(zi,{label:b,children:c.jsx(a7,{className:f+" w-48",value:((w=t.models)==null?void 0:w[b])||"",onCommit:_=>o(b,_)},b)},b)})}),c.jsxs(mo,{title:"Appearance",children:[c.jsx(zi,{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:o7.map(b=>c.jsx("option",{value:b,children:b},b))})}),c.jsx(zi,{label:"Default view",children:c.jsx("select",{className:d,value:dx.includes((C=t.ui)==null?void 0:C.defaultView)?t.ui.defaultView:"graph",onChange:b=>l(b.target.value),children:dx.map(b=>c.jsx("option",{value:b,children:b},b))})})]}),c.jsx(mo,{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 l7(){const[t,e]=k.useState([]),[r,n]=k.useState(!0),[i,s]=k.useState(null);k.useEffect(()=>{Nt("/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 Nt("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})});l.ok||oe(`Could not create draft (${l.status})`,"error")}catch(l){console.error("[TemplateSelector] Failed to create draft:",l),oe(`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(p0,{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",r_[a.category]||"border-border bg-card"),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Si,{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(dT,{className:"w-3 h-3"})," ",a.steps," steps"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(h0,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),c.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function B2({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=C=>{const b=i===C?null:C;s(b),r&&r(b)},d=()=>{n&&n()},f=async()=>{if(e!=null&&e.draftId){a(!0);try{const C=await Nt("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});C.ok?oe("Draft approved","info"):oe(`Approve failed (${C.status})`,"error")}catch(C){console.error("[PipelineView] Approve failed:",C),oe(`Approve failed: ${C.message}`,"error")}a(!1)}},p=async()=>{if(e!=null&&e.draftId){h(!0);try{const C=await Nt("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})});C.ok||oe(`Reject failed (${C.status})`,"error")}catch(C){console.error("[PipelineView] Reject failed:",C),oe(`Reject failed: ${C.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(Wo,{className:"w-3 h-3"})," Refresh"]})})]}),c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(l7,{})})]});if(e){const C=e.steps||[],b=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(kn,{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(oa,{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: ",b.label||b.id||"Pipeline"]}),c.jsx("span",{className:"text-muted-foreground ml-2",children:b.description||""}),b.category&&c.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",b.category]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3",children:c.jsx("div",{className:"space-y-1",children:C.map((w,_)=>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:_+1}),c.jsx("span",{className:"text-xs text-foreground",children:w.id}),w.agent&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:w.agent}),w.function&&c.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",w.function]})]},w.id||_))})})]})}const m=(t==null?void 0:t.currentStepId)??null,x=bS(mf,(t==null?void 0:t.steps)??[],m),g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(C=>[C.id,C.status])):{},y=Object.keys(bf).map(C=>({phase:C,config:bf[C],steps:x.filter(b=>b.phase===C)}));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(Ua,{icon:Ji,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),c.jsx(Ua,{icon:Md,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),c.jsx(Ua,{icon:Dd,color:"text-slate-300 bg-slate-500/10",label:"Human"}),c.jsx(Ua,{icon:As,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(Wo,{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??mf.length]}),m&&c.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",c.jsx("span",{className:"font-medium",children:m})]})]}),c.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:y.map(({phase:C,config:b,steps:w})=>c.jsxs("div",{className:st("rounded-lg border p-3",b.color),children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:b.label}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((_,S)=>{const N=g[_.id]??null,L=_.id===m,A=_.id===i;return c.jsxs(Wt.Fragment,{children:[c.jsx(c7,{step:_,liveStatus:N,isCurrent:L,isSelected:A,onClick:()=>u(_.id)}),S<w.length-1&&c.jsx(s0,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},_.id)})})]},C))})]})}function c7({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?As:t.agent==="claude"?Ji:t.agent==="codex"?Md:Dd,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 Ua({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 h7(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 u7={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:Ji},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:Md},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:Ji},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:Dd},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:Ji}},d7={bg:"bg-slate-800",text:"text-slate-600",Icon:Ji},px={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 p7({agent:t,size:e="md",className:r}){const n=u7[t]||d7,i=px[e]||px.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 le(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 Vn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const L2=6048e5,f7=864e5,Ya=43200,fx=1440;let m7={};function Ca(){return m7}function ia(t,e){var a,l,h,u;const r=Ca(),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=le(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 oc(t){return ia(t,{weekStartsOn:1})}function A2(t){const e=le(t),r=e.getFullYear(),n=Vn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=oc(n),s=Vn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=oc(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function mx(t){const e=le(t);return e.setHours(0,0,0,0),e}function ac(t){const e=le(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 g7(t,e){const r=mx(t),n=mx(e),i=+r-ac(r),s=+n-ac(n);return Math.round((i-s)/f7)}function x7(t){const e=A2(t),r=Vn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),oc(r)}function gl(t,e){const r=le(t),n=le(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function y7(t){return Vn(t,Date.now())}function b7(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function C7(t){if(!b7(t)&&typeof t!="number")return!1;const e=le(t);return!isNaN(Number(e))}function k7(t,e){const r=le(t),n=le(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function v7(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function w7(t,e){return+le(t)-+le(e)}function S7(t){const e=le(t);return e.setHours(23,59,59,999),e}function T7(t){const e=le(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function _7(t){const e=le(t);return+S7(e)==+T7(e)}function j7(t,e){const r=le(t),n=le(e),i=gl(r,n),s=Math.abs(k7(r,n));let o;if(s<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*s);let a=gl(r,n)===-i;_7(le(t))&&s===1&&gl(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function N7(t,e,r){const n=w7(t,e)/1e3;return v7(r==null?void 0:r.roundingMethod)(n)}function E7(t){const e=le(t),r=Vn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const B7={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"}},L7=(t,e,r)=>{let n;const i=B7[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 Hh(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const A7={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},M7={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},I7={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},F7={date:Hh({formats:A7,defaultWidth:"full"}),time:Hh({formats:M7,defaultWidth:"full"}),dateTime:Hh({formats:I7,defaultWidth:"full"})},D7={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},P7=(t,e,r,n)=>D7[t];function go(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 O7={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$7={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},R7={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"]},z7={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"]},W7={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"}},q7={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"}},H7=(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"},U7={ordinalNumber:H7,era:go({values:O7,defaultWidth:"wide"}),quarter:go({values:$7,defaultWidth:"wide",argumentCallback:t=>t-1}),month:go({values:R7,defaultWidth:"wide"}),day:go({values:z7,defaultWidth:"wide"}),dayPeriod:go({values:W7,defaultWidth:"wide",formattingValues:q7,defaultFormattingWidth:"wide"})};function xo(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)?V7(a,d=>d.test(o)):Y7(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 Y7(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function V7(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function G7(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 X7=/^(\d+)(th|st|nd|rd)?/i,K7=/\d+/i,Q7={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},Z7={any:[/^b/i,/^(a|c)/i]},J7={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},tW={any:[/1/i,/2/i,/3/i,/4/i]},eW={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},rW={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]},nW={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},iW={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]},sW={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},oW={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}},aW={ordinalNumber:G7({matchPattern:X7,parsePattern:K7,valueCallback:t=>parseInt(t,10)}),era:xo({matchPatterns:Q7,defaultMatchWidth:"wide",parsePatterns:Z7,defaultParseWidth:"any"}),quarter:xo({matchPatterns:J7,defaultMatchWidth:"wide",parsePatterns:tW,defaultParseWidth:"any",valueCallback:t=>t+1}),month:xo({matchPatterns:eW,defaultMatchWidth:"wide",parsePatterns:rW,defaultParseWidth:"any"}),day:xo({matchPatterns:nW,defaultMatchWidth:"wide",parsePatterns:iW,defaultParseWidth:"any"}),dayPeriod:xo({matchPatterns:sW,defaultMatchWidth:"any",parsePatterns:oW,defaultParseWidth:"any"})},M2={code:"en-US",formatDistance:L7,formatLong:F7,formatRelative:P7,localize:U7,match:aW,options:{weekStartsOn:0,firstWeekContainsDate:1}};function lW(t){const e=le(t);return g7(e,E7(e))+1}function cW(t){const e=le(t),r=+oc(e)-+x7(e);return Math.round(r/L2)+1}function I2(t,e){var u,d,f,p;const r=le(t),n=r.getFullYear(),i=Ca(),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=Vn(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=ia(o,e),l=Vn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const h=ia(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=h.getTime()?n:n-1}function hW(t,e){var a,l,h,u;const r=Ca(),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=I2(t,e),s=Vn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),ia(s,e)}function uW(t,e){const r=le(t),n=+ia(r,e)-+hW(r,e);return Math.round(n/L2)+1}function se(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const Ln={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return se(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):se(r+1,2)},d(t,e){return se(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 se(t.getHours()%12||12,e.length)},H(t,e){return se(t.getHours(),e.length)},m(t,e){return se(t.getMinutes(),e.length)},s(t,e){return se(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return se(i,e.length)}},Wi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gx={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 Ln.y(t,e)},Y:function(t,e,r,n){const i=I2(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return se(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):se(s,e.length)},R:function(t,e){const r=A2(t);return se(r,e.length)},u:function(t,e){const r=t.getFullYear();return se(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 se(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 se(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 Ln.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 se(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=uW(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):se(i,e.length)},I:function(t,e,r){const n=cW(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):se(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Ln.d(t,e)},D:function(t,e,r){const n=lW(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):se(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 se(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 se(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 se(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=Wi.noon:n===0?i=Wi.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=Wi.evening:n>=12?i=Wi.afternoon:n>=4?i=Wi.morning:i=Wi.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 Ln.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Ln.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):se(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):se(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Ln.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Ln.s(t,e)},S:function(t,e){return Ln.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return yx(n);case"XXXX":case"XX":return ii(n);case"XXXXX":case"XXX":default:return ii(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return yx(n);case"xxxx":case"xx":return ii(n);case"xxxxx":case"xxx":default:return ii(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+xx(n,":");case"OOOO":default:return"GMT"+ii(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+xx(n,":");case"zzzz":default:return"GMT"+ii(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return se(n,e.length)},T:function(t,e,r){const n=t.getTime();return se(n,e.length)}};function xx(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+se(s,2)}function yx(t,e){return t%60===0?(t>0?"-":"+")+se(Math.abs(t)/60,2):ii(t,e)}function ii(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=se(Math.trunc(n/60),2),s=se(n%60,2);return r+i+e+s}const bx=(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"})}},F2=(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"})}},dW=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return bx(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}}",bx(n,e)).replace("{{time}}",F2(i,e))},pW={p:F2,P:dW},fW=/^D+$/,mW=/^Y+$/,gW=["D","DD","YY","YYYY"];function xW(t){return fW.test(t)}function yW(t){return mW.test(t)}function bW(t,e,r){const n=CW(t,e,r);if(console.warn(n),gW.includes(t))throw new RangeError(n)}function CW(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 kW=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,vW=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,wW=/^'([^]*?)'?$/,SW=/''/g,TW=/[a-zA-Z]/;function _W(t,e,r){var u,d,f,p;const n=Ca(),i=n.locale??M2,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=le(t);if(!C7(a))throw new RangeError("Invalid time value");let l=e.match(vW).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=pW[x];return g(m,i.formatLong)}return m}).join("").match(kW).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:jW(m)};if(gx[x])return{isToken:!0,value:m};if(x.match(TW))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;(yW(x)||xW(x))&&bW(x,e,String(t));const g=gx[x[0]];return g(a,x,i.localize,h)}).join("")}function jW(t){const e=t.match(wW);return e?e[1].replace(SW,"'"):t}function NW(t,e,r){const n=Ca(),i=(r==null?void 0:r.locale)??n.locale??M2,s=2520,o=gl(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o});let l,h;o>0?(l=le(e),h=le(t)):(l=le(t),h=le(e));const u=N7(h,l),d=(ac(h)-ac(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<fx){const m=Math.round(f/60);return i.formatDistance("aboutXHours",m,a)}else{if(f<s)return i.formatDistance("xDays",1,a);if(f<Ya){const m=Math.round(f/fx);return i.formatDistance("xDays",m,a)}else if(f<Ya*2)return p=Math.round(f/Ya),i.formatDistance("aboutXMonths",p,a)}if(p=j7(h,l),p<12){const m=Math.round(f/Ya);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 EW(t,e){return NW(t,y7(t),e)}function D2({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=EW(r,{addSuffix:!0}),i=_W(r,"PPpp");return c.jsx("time",{dateTime:r.toISOString(),title:i,className:st("text-muted-foreground tabular-nums",e),children:n})}function P2({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=h7(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(ha,{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(vn,{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"}),y0.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(vc,{icon:Ad,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),p.map(m=>c.jsx(BW,{session:m,items:e,onSelectItem:r},m.id))]})]})}function BW({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=yf[n]||yf.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(p7,{agent:t.agent,size:"sm",className:"shrink-0"}),c.jsx(cp,{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(D2,{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 Cx=t=>Symbol.iterator in t,kx=t=>"entries"in t,vx=(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},LW=(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 AW(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:Cx(t)&&Cx(e)?kx(t)&&kx(e)?vx(t,e):LW(t,e):vx({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function ji(t){const e=Wt.useRef(void 0);return r=>{const n=t(r);return AW(e.current,n)?e.current:e.current=n}}function O2({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=mr(ji(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:qo(S,i.find(N=>N.id===S.itemId)),sub:yn[S.stepId]?`${Te[S.fromPhase]??S.fromPhase} → ${Te[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:qo(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(vn,{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(As,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&c.jsx(pc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&c.jsx(Ad,{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(cp,{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 Va=[{id:"feature",label:"Feature",defaults:{type:"feature",phase:"vision",priority:2,governance:"gate"}},{id:"task",label:"Task",defaults:{type:"task",phase:"planning",priority:1,governance:"flag"}},{id:"decision",label:"Decision",defaults:{type:"decision",phase:"specification",priority:2,governance:"gate"}},{id:"question",label:"Question",defaults:{type:"question",phase:"specification",priority:1,governance:"flag"}},{id:"idea",label:"Idea",defaults:{type:"idea",phase:"vision",priority:0,governance:"skip"}},{id:"spec",label:"Spec",defaults:{type:"spec",phase:"specification",priority:2,governance:"gate"}}],MW=["gate","flag","skip"];function wx(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function $2({open:t,onClose:e,parentItem:r,initialType:n="task"}){const i=mr(b=>b.createItem),[s,o]=k.useState(()=>wx(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=Va.find(_=>_.id===n)||Va.find(_=>_.id==="task"),w=wx(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=Va.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(Nd,{open:t,onOpenChange:b=>!b&&e(),children:c.jsxs(Ed,{className:"max-w-md",onKeyDown:C,children:[c.jsx(Bd,{children:c.jsx(Ld,{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:Va.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(l0,{className:"h-3 w-3"}):c.jsx(Ls,{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:g0.map(b=>c.jsx("option",{value:b,children:bl[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:y0.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:MW.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(r0,{children:[c.jsx(Dt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),c.jsx(Dt,{size:"sm",onClick:y,disabled:d||!s.title.trim(),children:d?"Creating…":"Create"})]})]})})}const IW=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],FW=[{id:"gate",Icon:As,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:u0,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:m0,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function DW(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 R2({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(Nd,{open:t,onOpenChange:l=>!l&&e(),children:c.jsxs(Ed,{className:"max-w-sm",children:[c.jsx(Bd,{children:c.jsxs("div",{className:"flex items-center justify-between pr-6",children:[c.jsx(Ld,{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:IW.map(l=>{const h=l==="explore_design",u=DW(r,l),d=Te[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:FW.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 z2({onOpenGate:t}){const{gates:e,items:r}=mr(ji(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=qo(h,u),f=n_[h.fromPhase]??i_,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(As,{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(a0,{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(fi,{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(kn,{className:"h-3 w-3"})})]})}const PW="●",OW="text-zinc-400";function $W(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 RW(t){var e;return((e=b0[t])==null?void 0:e.icon)??PW}function zW(t){var e;return((e=b0[t])==null?void 0:e.color)??OW}const WW={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 qW(t){return WW[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function HW(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function UW(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function YW({event:t,now:e}){const r=RW(t.kind),n=zW(t.kind),i=$W(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||UW(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",qW(s.name)),children:s.name},o))})]})}function W2({events:t=[],currentFeatureCode:e,now:r}){const n=HW(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(YW,{event:i,now:r},i.id))})})}function VW(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 GW="Select a feature to see status.";function q2({featureCode:t,snapshot:e}){const[r,n]=k.useState(!1),i=k.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??GW,o=VW(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 XW({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:L,setActiveBuild:A,pipelineDraft:j,sessions:I,selectedPhase:z,setSelectedPhase:W,decisionEvents:P,statusSnapshots:M,setStatusSnapshot:F}=mr(),[O,$]=k.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),B=k.useRef(!!sessionStorage.getItem("vision-activeView")),[T,V]=k.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[et,D]=k.useState(""),[G,ht]=k.useState(null),[xt,$t]=k.useState(!1),[Ht,ct]=k.useState(!1),[X,it]=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 vt=k.useRef(!1);k.useEffect(()=>{var q;(q=_==null?void 0:_.ui)!=null&&q.defaultView&&!vt.current&&!B.current&&(V(_.ui.defaultView),vt.current=!0)},[_]),k.useEffect(()=>{o&&(o.view&&V(o.view),o.phase!==void 0&&W(o.phase),o.select!==void 0&&$(o.select),a())},[o,a]),k.useEffect(()=>{const q=()=>{var H;return["INPUT","TEXTAREA","SELECT"].includes((H=document.activeElement)==null?void 0:H.tagName)},Z=H=>{(H.metaKey||H.ctrlKey)&&H.key==="k"&&(H.preventDefault(),$t(rt=>!rt)),(H.metaKey||H.ctrlKey)&&H.key==="n"&&(H.preventDefault(),ct(!0)),H.key===","&&!H.metaKey&&!H.ctrlKey&&!q()&&it(!0)};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[]);const gt=k.useMemo(()=>{let q=n;if(z&&(q=q.filter(Z=>Z.phase===z)),et){const Z=et.toLowerCase();q=q.filter(H=>H.title.toLowerCase().includes(Z)||(H.description||"").toLowerCase().includes(Z))}return q},[n,z,et]),Jt=k.useMemo(()=>z?n.filter(q=>q.phase===z):n,[n,z]),Pt=k.useMemo(()=>new Set(Jt.map(q=>q.id)),[Jt]),Xt=k.useMemo(()=>z?C.filter(q=>Pt.has(q.itemId)):C,[C,Pt,z]),je=k.useMemo(()=>{if(!z&&!et)return i;const q=new Set(gt.map(Z=>Z.id));return i.filter(Z=>q.has(Z.fromId)&&q.has(Z.toId))},[i,gt,z,et]);k.useEffect(()=>{y(()=>({activeView:T,selectedPhase:z,searchQuery:et,selectedItemId:O,totalItems:n.length,filteredCount:gt.length,connected:s}))},[y,T,z,et,O,n.length,gt.length,s]);const Kt=k.useCallback(q=>{$(q),t&&t({type:"item",id:q})},[t]),br=k.useCallback((q,Z)=>{u(q,Z)},[u]);k.useCallback(async()=>{const Z=await h({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:z||"vision"});Z&&Z.id&&$(Z.id)},[h,z]),k.useCallback(async q=>{await d(q),O===q&&($(null),t&&t(null))},[d,O,t]);const ue=k.useCallback(q=>{const Z=C.find(H=>H.id===q);Z&&($(Z.itemId),t&&t({type:"item",id:Z.itemId}))},[C,t]);k.useCallback(async q=>f(q),[f]),k.useCallback(async q=>p(q),[p]);const Pe=k.useCallback(()=>{Nt("/api/build/state").then(q=>q.json()).then(q=>A(q.state??null)).catch(()=>{})},[A]),We=k.useCallback(q=>{t&&t({type:"step",id:q})},[t]),de=k.useMemo(()=>{var Z;if(!O)return null;const q=n.find(H=>H.id===O);return((Z=q==null?void 0:q.lifecycle)==null?void 0:Z.featureCode)||null},[O,n]);return k.useEffect(()=>{de&&(M&&M[de]||Nt(`/api/lifecycle/status?featureCode=${encodeURIComponent(de)}`).then(q=>q.json()).then(q=>{q.snapshot&&F&&F(de,q.snapshot)}).catch(()=>{}))},[de]),c.jsx(bc.Provider,{value:l,children:c.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[c.jsx(q2,{featureCode:de,snapshot:de?(M==null?void 0:M[de])??null:null}),de&&c.jsx(W2,{events:P,currentFeatureCode:de}),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(Gy,{items:n,gates:C,activeBuild:L,activeView:T,onViewChange:V,selectedPhase:z,onPhaseSelect:W,searchQuery:et,onSearchChange:D,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Kt,onThemeChange:S,onNewItem:()=>ct(!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(Ky,{items:gt,connections:je,selectedItemId:O,onSelect:Kt}),T==="graph"&&c.jsx(Zy,{items:gt,connections:je,selectedItemId:O,onSelect:Kt}),T==="pipeline"&&c.jsx(B2,{activeBuild:L,pipelineDraft:j,onSelectStep:We,onRefresh:Pe}),T==="sessions"&&c.jsx(P2,{sessions:I,items:n,onSelectItem:Kt}),T==="docs"&&c.jsx(S2,{items:Jt}),T==="gates"&&c.jsx(_2,{gates:Xt,items:Jt,onResolve:w,onSelect:Kt}),T==="settings"&&c.jsx(E2,{settings:_,onSettingsChange:S,onReset:N})]}),c.jsx(z2,{onOpenGate:ue}),G&&(()=>{const q=n.find(Z=>Z.id===G);return q?c.jsx(N2,{item:q,items:n,connections:i,onUpdate:br,onClose:()=>ht(null)}):null})(),c.jsx(j2,{event:b,items:n,onNavigate:()=>V("gates")}),c.jsx(O2,{open:xt,onClose:()=>$t(!1),onSelectItem:q=>{Kt(q),$t(!1)},onSelectGate:q=>{ue(q),$t(!1)}}),c.jsx($2,{open:Ht,onClose:()=>ct(!1)}),c.jsx(R2,{open:X,onClose:()=>it(!1),settings:_,onSettingsChange:S})]})]})})}sa.use(i0);const KW={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},QW={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function ZW(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 JW(){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 tq={"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}},eq={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function rq(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 lc="compose:graph:";function nq(t){try{const e=localStorage.getItem(lc+t);return e?JSON.parse(e):null}catch{return null}}function iq(t,e){try{localStorage.setItem(lc+t,JSON.stringify(e))}catch{}}const sq=[{style:"solid",label:"Structural / hard",dash:null},{style:"dashed",label:"Informational / weak",dash:"4,3"},{style:"dotted",label:"Soft dependency",dash:"1.5,3"}];function Zi({onClick:t,active:e,children:r,title:n}){return 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 Ga({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 Uh(){return c.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function Sx({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 oq({nodes:t,edges:e,graphKey:r}){const[n,i]=k.useState(()=>{try{const l=localStorage.getItem(lc+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});k.useEffect(()=>{try{localStorage.setItem(lc+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(Zi,{onClick:()=>i(new Set),children:"Expand all"}),c.jsx(Zi,{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(Sx,{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(Sx,{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 aq({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=JW(),m=p?KW:QW,x=k.useMemo(()=>nq(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),[L,A]=k.useState((x==null?void 0:x.viewMode)||"graph");k.useEffect(()=>{iq(a,{layoutKey:g,showEdgeLabels:C,hiddenNodes:[...w],showLegend:S,viewMode:L})},[a,g,C,w,S,L]);const j=t||(e&&r?rq(e,r):[]),I=k.useMemo(()=>i||ZW(m),[i,p]),z=n||tq[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=sa({container:h.current,elements:P,style:I,layout:z,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=T,T.on("mouseover","node",V=>{const et=V.target;et.style("border-width",2),et.style("border-opacity",1);const D=et.renderedPosition();f({x:D.x,y:D.y-et.renderedHeight()/2-12,label:et.data("label"),sublabel:et.data("sublabel"),id:et.id(),color:et.data("color")})}),T.on("mouseout","node",V=>{V.target.style("border-width",1),V.target.style("border-opacity",.5),f(null)}),l&&T.on("tap","node",V=>l(V.target.id())),T.on("layoutstop",()=>T.fit(void 0,40)),()=>{T.destroy(),u.current=null}},[JSON.stringify(P),JSON.stringify(z),p,L]),k.useEffect(()=>{const T=u.current;T&&T.edges().forEach(V=>{V.data("label")&&V.style("label",C?V.data("label"):"")})},[C]);const M=k.useCallback(()=>{var T;return(T=u.current)==null?void 0:T.fit(void 0,40)},[]),F=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=>{_(V=>{const et=new Set(V);return et.has(T)?et.delete(T):et.add(T),et})},[]),B=k.useCallback(()=>_(new Set),[]);return L==="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(Ga,{mode:"graph",active:L==="graph",onClick:()=>A("graph")}),c.jsx(Ga,{mode:"tree",active:L==="tree",onClick:()=>A("tree")})]})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(oq,{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(eq).map(([T,V])=>c.jsx("option",{value:T,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:V},T))}),c.jsx(Uh,{}),c.jsx(Zi,{onClick:O,title:"Zoom out",children:"−"}),c.jsx(Zi,{onClick:M,title:"Fit to view",children:"Fit"}),c.jsx(Zi,{onClick:F,title:"Zoom in",children:"+"}),c.jsx(Uh,{}),c.jsx(Zi,{onClick:()=>N(!S),active:S,title:S?"Hide legend":"Show legend",children:"Legend"}),c.jsx(Uh,{}),c.jsx(Ga,{mode:"graph",active:L==="graph",onClick:()=>A("graph")}),c.jsx(Ga,{mode:"tree",active:L==="tree",onClick:()=>A("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 V=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:V?.35:1},title:V?`Show ${T.label}`:`Hide ${T.label}`,children:[c.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:V?"transparent":T.color,border:`1.5px solid ${T.color}`}}),c.jsx("span",{className:"text-xs",style:{color:V?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:V?"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:sq.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 Rt={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"},lq=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:Rt.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:Rt.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:Rt.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:Rt.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:Rt.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:Rt.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:Rt.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:Rt.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:Rt.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:Rt.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:Rt.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:Rt.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:Rt.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:Rt.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:Rt.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:Rt.decision},{id:"question",label:"Question",sublabel:"may block progress",color:Rt.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:Rt.artifact}],cq=[{from:"p-vision",to:"p-specification",color:Rt.pipeline},{from:"p-specification",to:"p-planning",color:Rt.pipeline},{from:"p-planning",to:"p-implementation",color:Rt.pipeline},{from:"p-implementation",to:"p-verification",color:Rt.pipeline},{from:"p-verification",to:"p-release",color:Rt.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:Rt.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:Rt.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:Rt.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:Rt.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:Rt.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:Rt.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:Rt.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:Rt.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:Rt.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:Rt.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:Rt.track},{from:"task",to:"feature",label:"implements",color:Rt.task},{from:"spec",to:"feature",label:"implements",color:Rt.spec},{from:"feature",to:"feature",label:"blocks",color:Rt.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:Rt.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:Rt.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:Rt.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:Rt.artifact},{from:"question",to:"decision",label:"contradicts",color:Rt.question},{from:"feature",to:"p-vision",label:"enters",color:Rt.feature,style:"dashed"}];function hq(){return c.jsx(aq,{graphKey:"product",nodes:lq,edges:cq,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const uq="compose-popout";function H2(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 Xa({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:H2(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(BS,{style:{width:11,height:11}}),"pop in"]})]})}function dq({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=H2(t)+" — Compose"},[t]),k.useEffect(()=>{const h=new BroadcastChannel(uq);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}Nt(`/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(Xa,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(XW,{})})]}):a==="graph"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Xa,{path:t,onDock:l}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(hq,{})})]}):a==="html"?c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[c.jsx(Xa,{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(Xa,{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(Jd,{remarkPlugins:[np],children:e||""})})})]})}const pq="/api/stratum";async function qc(t,e={}){return(await Nt(`${pq}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function fq(t,e){return qc(t,{method:"POST",body:JSON.stringify(e)})}function U2({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 ff(){return c.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function mq({onAction:t}){const[e,r]=k.useState(null),[n,i]=k.useState(null),[s,o]=k.useState({}),[a,l]=k.useState({}),h=k.useCallback(()=>{qc("/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 fq(`/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(ff,{}):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 gq({flowId:t,onClose:e}){const[r,n]=k.useState(null),[i,s]=k.useState(null);return k.useEffect(()=>{qc(`/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(ff,{}),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(U2,{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 xq({activeBuild:t}){const[e,r]=k.useState(null),[n,i]=k.useState(null),[s,o]=k.useState(null),a=k.useCallback(()=>{qc("/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(ff,{}):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(U2,{status:l.status})]})]})},l.flow_id)),s&&c.jsx("div",{style:{marginTop:8},children:c.jsx(gq,{flowId:s,onClose:()=>o(null)})})]})}const yq={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 bq({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:yq}),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 Cq(){const t=mr(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(bq,{build:t,onDismiss:n}),c.jsx(mq,{}),c.jsx("div",{style:{marginTop:20},children:c.jsx(xq,{activeBuild:t})})]})}function kq({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 vq={dashboard:{label:"Dashboard",icon:fT,tip:"Overview of project status and activity"},tree:{label:"Items",icon:d0,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:TT,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:ZT,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:Ad,tip:"Active and past agent sessions"},"build-history":{label:"Builds",icon:nu,tip:"History of past build runs and outcomes"},gates:{label:"Gates",icon:As,tip:"Quality gates and approval checkpoints"},docs:{label:"Docs",icon:Si,tip:"Project documentation and specs"},journal:{label:"Journal",icon:o0,tip:"Project journal and changelog"},design:{label:"Design",icon:dc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:mi,tip:"Captured ideas and suggestions"}};function wq({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=vq[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(vn,{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 Sq(){const[t,e]=k.useState(k0);function r(){const n=!t;__(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 Xe={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},Tq={[Xe.COLLAPSED]:Xe.EXPANDED,[Xe.EXPANDED]:Xe.MAXIMIZED,[Xe.MAXIMIZED]:Xe.COLLAPSED};function _q(t){return Tq[t]??Xe.COLLAPSED}function jq(t){return Xe.COLLAPSED}function Nq(t){return Xe.MAXIMIZED}const Eq=new Set(Object.values(Xe));function Bq(t){return Eq.has(t)}function Lq(t){switch(t){case Xe.COLLAPSED:return"h-7";case Xe.EXPANDED:return"h-[40vh]";case Xe.MAXIMIZED:return"flex-1";default:return"h-7"}}const Y2="compose:agentBarState";function Aq(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(Y2);return Bq(e)?e:Xe.COLLAPSED}catch{return Xe.COLLAPSED}}function Mq(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(Y2,t)}catch{}}const Tx="▾",Iq="▴",Fq="⤢";function Dq({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(_q(t))},[t,e]),a=k.useCallback(()=>{e==null||e(jq())},[t,e]);k.useCallback(()=>{e==null||e(Nq())},[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?Iq:h?Fq:Tx}),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(Sq,{}),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:Tx})]}),!l&&c.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:c.jsx(S0,{})})]})}const V2=k.createContext(null);function Pq(){return k.useContext(V2)}const Oq={item:"openItem",feature:"openFeature",gate:"openGate",view:"openView"};function $s({kind:t,id:e,label:r,className:n}){const i=Pq(),s=r??e,o=i==null?void 0:i[Oq[t]],a=typeof(i==null?void 0:i.canNavigate)=="function"?i.canNavigate(t,e):!0;return typeof o!="function"||!a?c.jsx("span",{className:st("text-[11px] font-mono text-muted-foreground",n),children:s}):c.jsx("button",{type:"button",onClick:l=>{l.stopPropagation();try{o(e)}catch{}},className:st("text-[11px] font-mono text-blue-400 hover:underline cursor-pointer",n),children:s})}const $q=280,Rq=.6;function zq({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*Rq,C=Math.max($q,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:Wt.Children.toArray(i).length>0?c.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):c.jsx(qq,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const Wq={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function _x(t){return Wq[t]||"#6b7280"}function qq({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] truncate",children:c.jsx($s,{kind:"gate",id:a.id,label:qo(a,n.find(h=>h.id===a.itemId)),className:"text-[10px]"})},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:_x(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:_x(a)}}),a,": ",l]},a))})]})]})]})}const An=60,Ar=24,Ka=80,Yh=28,Vh=48,jx=8,ns=5,cc=9;function Hq(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function Uq(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 Gh(t,e,r,n,i){const s=Math.min(t,ns),o=s*n+(s-1)*jx,a=(r-o)/2,l=[];for(let h=0;h<s;h++)l.push({x:a+h*(n+jx),y:e,w:n,h:i});return{positions:l,overflow:t>ns?t-ns+1:0}}function Qa({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:h}){const u=xr[t.type]||xr.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?cc+1:cc,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:Hq(t.title,s?10:8)})]})}function Yq({item:t,pos:e}){if(!t||!e)return null;const r=xr[t.type]||xr.task,n=zn[t.status]||zn.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:Pd[t.confidence||0]})]})]})}function Vq({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(()=>Uq(t,e,r),[t,e,r]),d=k.useCallback((M,F)=>{const O=F.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),$=F.currentTarget.getBoundingClientRect();s(M),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 M=Gh(l.length,g,m,An,Ar);y=M.positions,C=M.overflow,g+=Ar+Vh}const b=(m-Ka)/2,w=g;g+=Yh+Vh;let _=[],S=0;if(h.length>0){const M=Gh(h.length,g,m,An,Ar);_=M.positions,S=M.overflow,g+=Ar}let N=new Map,L=new Map;const A=[...u.entries()];let j=[];if(A.length>0){g+=Vh;for(const[O,$]of A)for(const B of $)j.push({...B,_parentChildId:O});const M=Gh(j.length,g,m,An,Ar);let F=0;for(const[O,$]of A){const B=[];for(let T=0;T<$.length&&F<M.positions.length;T++,F++)B.push(M.positions[F]);N.set(O,B)}M.overflow>0&&L.set("all",M.overflow),g+=Ar}const I=g+12;for(let M=0;M<y.length;M++){const F=y[M];x.push({x1:F.x+F.w/2,y1:F.y+F.h,x2:b+Ka/2,y2:w})}for(let M=0;M<_.length;M++){const F=_[M];x.push({x1:b+Ka/2,y1:w+Yh,x2:F.x+F.w/2,y2:F.y})}for(const[M,F]of N){const O=h.findIndex($=>$.id===M);if(O>=0&&O<_.length){const $=_[O];for(const B of F)x.push({x1:$.x+$.w/2,y1:$.y+$.h,x2:B.x+B.w/2,y2:B.y})}}const z=l.slice(0,ns-(C>0?1:0)),W=h.slice(0,ns-(S>0?1:0)),P=j.slice(0,ns-(L.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:I,className:"w-full",viewBox:`0 0 ${m} ${I}`,children:[x.map((M,F)=>c.jsx("line",{x1:M.x1,y1:M.y1,x2:M.x2,y2:M.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},F)),z.map((M,F)=>c.jsx(Qa,{item:M,x:y[F].x,y:y[F].y,w:An,h:Ar,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:f},M.id)),C>0&&c.jsxs("text",{x:y[y.length-1].x+An/2,y:y[0].y+Ar/2,textAnchor:"middle",dominantBaseline:"central",fontSize:cc,fill:"hsl(var(--muted-foreground))",children:["+",C," more"]}),c.jsx(Qa,{item:t,x:b,y:w,w:Ka,h:Yh,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:f}),W.map((M,F)=>c.jsx(Qa,{item:M,x:_[F].x,y:_[F].y,w:An,h:Ar,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},M.id)),S>0&&c.jsxs("text",{x:_[_.length-1].x+An/2,y:_[0].y+Ar/2,textAnchor:"middle",dominantBaseline:"central",fontSize:cc,fill:"hsl(var(--muted-foreground))",children:["+",S," more"]}),P.map((M,F)=>{const $=[...N.values()].flat()[F];return $?c.jsx(Qa,{item:M,x:$.x,y:$.y,w:An,h:Ar,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:f},M.id):null})]}),c.jsx(Yq,{item:i,pos:o})]})]})}const Gq=["Untested","Low","Moderate","High","Crystallized"];function Xq({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=Gq[r]??"Untested",i=r===0?kf[0]:kf[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 Kq(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 Nx(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function Qq(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function Zq(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 Jq(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:Kq(new Date(n).toISOString(),e)}function tH(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=Jq(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 eH(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 Ex({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:`${Nx(i.tokens_in)} / ${Nx(i.tokens_out)}`},{label:"USD",value:Qq(i.usd)},{label:"Wall clock",value:Zq(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 rH({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}=tH(t,i),[u,d]=eH(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(Ex,{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(Ex,{branch:d,extraRows:n(d)})]})]}),c.jsx("div",{className:"col-span-2",children:x?c.jsx(pf,{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 nH={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function iH(t){return nH[t]??t}function Bx(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function sH(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 oH({item:t}){const[e,r]=k.useState(!1),n=sH(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(pc,{size:13}),c.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?c.jsx(l0,{size:13,style:{marginLeft:"auto"}}):c.jsx(Ls,{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:iH(s.axis_id)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:Bx(s.ratio)}),c.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:Bx(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))})]})]})}async function G2({featureCode:t,mode:e="feature",description:r=""}){const n=await Nt("/api/build/start",{method:"POST",headers:Pn({"Content-Type":"application/json"}),body:JSON.stringify({featureCode:t,mode:e,description:r})});if(!n.ok){let i=null;try{i=await n.json()}catch{}const s=new Error(i&&i.error||`Failed to start build (HTTP ${n.status})`);throw s.status=n.status,s}return n}function aH({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{await G2({featureCode:g,mode:s,description:a.trim()}),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 lH({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:Pd[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 cH({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:zn[h.status]||zn.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:xr[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(kn,{className:"h-3 w-3"})})]},u))})]},`${l.type}-${l.direction}`))]})}function Za(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 hH({featureCode:t,lineage:e}){const r=mr(i=>i.selectedBranches),n=mr(i=>i.setSelectedBranches);return c.jsx(rH,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function uH({featureCode:t}){const[e,r]=k.useState([]),[n,i]=k.useState(!0);return k.useEffect(()=>{const s=new AbortController;return i(!0),Nt(`/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 dH=["informs","supports","blocks","contradicts"];function pH({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:dH.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(vn,{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:zn[u.status]||zn.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:xr[u.type]},children:u.type})]},u.id))})]})})}function fH({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(Dt,{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(Dt,{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(Dt,{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(Dt,{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 mH({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,V,et,D;const f=e0(),[p,m]=k.useState(!1),[x,g]=k.useState(""),[y,C]=k.useState(!1),[b,w]=k.useState(""),[_,S]=k.useState(!1),[N,L]=k.useState(!1),[A,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 I=k.useCallback(()=>{const G=A.trim(),ht=(t==null?void 0:t.group)||"";G!==ht&&i(t.id,{group:G||null})},[A,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]),M=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]),F=k.useMemo(()=>{if(!t)return 0;let G=0;for(const ht of r)ht.type==="contradicts"&&(ht.fromId===t.id||ht.toId===t.id)&&G++;return G},[t==null?void 0:t.id,r]);if(!t)return null;const O=xr[t.type]||xr.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(gr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:O,borderColor:O},children:t.type}),t.phase&&c.jsx(gr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:bl[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:G=>g(G.target.value),onBlur:W,onKeyDown:G=>{G.key==="Enter"&&W(),G.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(Dt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:h,children:c.jsx(kn,{className:"h-3.5 w-3.5"})})]}),c.jsx(jl,{}),c.jsx(Wn,{className:"flex-1",children:c.jsxs("div",{className:"p-3 space-y-4",children:[c.jsx(oH,{item:t}),(($=t.lifecycle)==null?void 0:$.featureCode)&&c.jsx(hH,{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:G=>i(t.id,{status:G.target.value}),children:t_.map(G=>c.jsx("option",{value:G,children:G.replace("_"," ")},G))}),c.jsx(lH,{level:t.confidence||0,onChange:G=>i(t.id,{confidence:G})})]}),c.jsx(Xq,{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:G=>i(t.id,{phase:G.target.value||null}),children:[c.jsx("option",{value:"",children:"No phase"}),g0.map(G=>c.jsx("option",{value:G,children:bl[G]},G))]})]}),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:A,placeholder:"(none)",onChange:G=>j(G.target.value),onBlur:I,onKeyDown:G=>{G.key==="Enter"&&(G.preventDefault(),G.currentTarget.blur()),G.key==="Escape"&&(j(t.group||""),G.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:G=>w(G.target.value),onBlur:M,onKeyDown:G=>{G.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(cH,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),c.jsx(Vq,{item:t,items:e,connections:r,onSelect:l}),((T=t.lifecycle)==null?void 0:T.featureCode)&&c.jsx(uH,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(G=>G.itemId===t.id))&&(()=>{var Ht;const G=t.lifecycle,ht=n?n.filter(ct=>ct.itemId===t.id):[],xt=ht.filter(ct=>ct.status==="pending"),$t=ht.filter(ct=>ct.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:[G&&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:Te[G.currentPhase]??G.currentPhase}),G.featureCode&&c.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:G.featureCode})]}),((Ht=G==null?void 0:G.phaseHistory)==null?void 0:Ht.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:G.phaseHistory.map((ct,X)=>c.jsxs("span",{className:st("text-[10px]",ct.phase===G.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[Te[ct.phase]??ct.phase,ct.outcome&&ct.outcome!=="approved"&&c.jsxs("span",{className:"text-amber-400",children:[" (",ct.outcome,")"]}),X<G.phaseHistory.length-1&&" → "]},X))})]}),xt.map(ct=>{var vt,gt;const X=ct.artifactAssessment,it=x0[ct.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:"," ",c.jsx($s,{kind:"gate",id:ct.id,label:yn[ct.stepId]??`${Te[ct.fromPhase]??ct.fromPhase} → ${Te[ct.toPhase]??ct.toPhase}`,className:"text-[10px]"})]}),X&&X.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[it&&c.jsx("span",{className:"font-mono",children:it}),it&&": ",Math.round(X.completeness*100),"% complete"," · ",X.wordCount," words",((gt=(vt=X.sections)==null?void 0:vt.missing)==null?void 0:gt.length)>0&&c.jsxs("span",{className:"text-amber-400",children:[" (missing: ",X.sections.missing.join(", "),")"]}),!X.meetsMinWordCount&&c.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),X&&!X.exists&&c.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[it??"Artifact"," not found"]}),d&&c.jsx(fH,{gate:ct,onResolveGate:d})]},ct.id)}),$t.map(ct=>{const X={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:yn[ct.stepId]??`${Te[ct.fromPhase]??ct.fromPhase} → ${Te[ct.toPhase]??ct.toPhase}`}),c.jsx(gr,{variant:"outline",className:st("text-[10px] px-1.5 py-0 h-4 ml-auto",X[ct.outcome]||""),children:ct.outcome})]},ct.id)})]})]})})(),((et=(V=t.evidence)==null?void 0:V.stratumViolations)==null?void 0:et.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:Za(t.evidence.violatedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((G,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:G})]},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:Za(t.evidence.tracedAt)})]}),c.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(G=>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:G.step_id}),G.attempts>1&&c.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[G.attempts,"x"]}),G.duration_ms!=null&&c.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:G.duration_ms<1e3?`${G.duration_ms}ms`:`${(G.duration_ms/1e3).toFixed(1)}s`})]},G.step_id))})]}),c.jsxs("div",{className:"space-y-0.5",children:[c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",Za(t.createdAt)]}),c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",Za(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(Dt,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",N&&"bg-accent/10 border-accent"),onClick:()=>L(!N),"data-testid":"item-start-build",title:"Start the build/bug-fix lifecycle for this item",children:[c.jsx(NT,{className:"h-3 w-3"})," Start"]}),N&&c.jsx(aH,{item:t,onClose:()=>L(!1)})]}),c.jsxs("div",{className:"relative",children:[c.jsxs(Dt,{variant:"outline",size:"sm",className:st("h-7 text-xs gap-1",_&&"bg-accent/10 border-accent"),onClick:()=>S(!_),children:[c.jsx(xT,{className:"h-3 w-3"})," Connect"]}),_&&c.jsx(pH,{item:t,items:e,onCreateConnection:o,onDismiss:()=>S(!1)})]}),c.jsxs(Dt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:z,children:[c.jsx(f0,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&c.jsxs(Dt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[c.jsx(yl,{className:"h-3 w-3"})," Pressure Test",F>0&&c.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:F})]}),t.status!=="killed"&&c.jsxs(Dt,{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 G=await Nt(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!G.ok){const ht=await G.json().catch(()=>({}));console.error("[vision] Lifecycle kill failed:",ht.error),oe(`Kill failed: ${ht.error||G.status}`,"error")}}catch(G){console.error("[vision] Lifecycle kill failed:",G.message),oe(`Kill failed: ${G.message}`,"error")}else i(t.id,{status:"killed"})},children:[c.jsx(xf,{className:"h-3 w-3"})," Kill"]}),s&&c.jsxs(Dt,{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(xf,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const X2=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];X2.map(t=>t.id);const gH={overview:Si,pipeline:d0,sessions:h0,errors:pc,files:Id};function xH({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:X2.map(({id:n,label:i})=>{const s=gH[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 Lx=[{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 xd(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 yH({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:Lx.map((o,a)=>{const l=xd(o.id,i,e,s),h=Cf[l],u=r===o.id;return c.jsxs(Wt.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:Lx.map(o=>{const a=xd(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)":Cf[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(bH,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function bH({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=xd(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 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 kH(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function vH({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:kH(a.durationMs)}),c.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:CH(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 wH(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 Xh=10;function SH({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(YS,{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,Xh);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:wH(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>Xh&&c.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-Xh," more"]})]})}function TH(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function _H(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 jH({featureCode:t,onOpenFile:e}){const[r,n]=k.useState([]),[i,s]=k.useState(!0);k.useEffect(()=>{const l=new AbortController;return s(!0),Nt("/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(Id,{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(Si,{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:TH(f)}),p&&c.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:_H(p)})]},h)})]})}function NH({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}=mr(ji(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(xH,{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(mH,{item:y,items:o,connections:a,gates:l,onUpdate:(N,L)=>h(N,L),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(yH,{item:y,activeBuild:m}),C==="sessions"&&c.jsx(vH,{featureCode:w,sessions:x,items:o}),C==="errors"&&c.jsx(SH,{featureCode:w,errors:g,items:o}),C==="files"&&c.jsx(jH,{featureCode:w,onOpenFile:n})]})]}):c.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function EH(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 BH(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function LH(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function AH(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 MH(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 Ax(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const Mx=[{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 IH({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:[Mx.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(Wt.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=Mx.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 Kh(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function FH(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const Ix={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function Fx(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 DH({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=AH(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:[Fx(i.elapsedMs),i.timeoutMs!=null&&c.jsxs("span",{className:"text-muted-foreground",children:[" / ",Fx(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 PH({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=mr(ji(A=>({activeBuild:A.activeBuild,iterationStates:A.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,Nt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(A=>A.json()).then(A=>h(A)).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 A=r.length-1;A>=0;A--){const j=r[A];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 A={};let j=null;for(const I of e)I.subtype==="gate_tier_result"?A[I.tierId]=I.passed:I.subtype==="gate_tier_summary"&&(j=I);return{tierMap:A,tierSummary:j}},[e]),y=Object.keys(x).length>0||g!==null,C=k.useMemo(()=>{const A=p.filter(j=>j.cost_usd!=null);return A.length===0?[]:[...A].sort((j,I)=>o?(j.cost_usd??0)-(I.cost_usd??0):(I.cost_usd??0)-(j.cost_usd??0))},[p,o]),b=C.length>0?C[0].id:null,w=k.useMemo(()=>EH(f),[f]),_=k.useMemo(()=>BH(f),[f]),S=k.useMemo(()=>LH(s,t),[s,t]),N=k.useMemo(()=>{if(!n||n.length===0)return null;const A=n.filter(z=>z.stepId===t);if(A.length===0)return null;const j=A.filter(z=>z.severity==="violation").length,I=A.filter(z=>z.severity==="warning").length;return{total:A.length,hardViolations:j,warnings:I}},[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 L={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 ${L[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((A,j)=>c.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",j+1,A.reason?`: ${A.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((A,j)=>c.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:A},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:Ax(f.cost_usd)})]})]}),y&&c.jsx("div",{children:c.jsx(IH,{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((A,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 A=="string"?A:A.message||JSON.stringify(A)})]},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(DH,{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 ${Kh(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 ${Kh(m.score)}`,children:[FH(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(([A,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:Ix[A]??A}),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 ${Kh(j)}`,children:j})]},A)),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(A=>Ix[A]??A).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(A=>!A),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(A=>{const j=A.id===b,I=A.id===t,z=A.durationMs!=null?A.durationMs<1e3?`${A.durationMs}ms`:A.durationMs<6e4?`${(A.durationMs/1e3).toFixed(1)}s`:`${(A.durationMs/6e4).toFixed(1)}m`:"—";return c.jsxs("tr",{className:`${j?"text-amber-400":"text-foreground"} ${I?"font-semibold":""}`,children:[c.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:A.id}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((A.input_tokens??0)/1e3).toFixed(1),"k"]}),c.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((A.output_tokens??0)/1e3).toFixed(1),"k"]}),c.jsx("td",{className:"text-right py-0.5 font-mono",children:Ax(A.cost_usd)}),c.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:z})]},A.id)})})]})})]})]})}function K2(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 Dx(t,e){var l;const r=(e||[]).filter(h=>!h.superseded);if(r.length===0)return"";let n=`# Design Document
|
|
649
|
+
|
|
650
|
+
`;const i=(t||[]).filter(h=>h.role==="human"&&h.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
|
|
651
|
+
|
|
652
|
+
`,n+=i.map(h=>h.content).join(`
|
|
653
|
+
|
|
654
|
+
`),n+=`
|
|
655
|
+
|
|
656
|
+
`);for(const h of r){const u=h.selectedOption||{};n+=`## ${h.question}
|
|
657
|
+
|
|
658
|
+
`,n+=`**Decision:** ${u.title||u.id||"Selected option"}
|
|
659
|
+
|
|
660
|
+
`,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
|
|
661
|
+
`),n+=`
|
|
662
|
+
|
|
663
|
+
`),h.comment&&(n+=`*Note: ${h.comment}*
|
|
664
|
+
|
|
665
|
+
`)}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(`
|
|
666
|
+
`);for(const d of u){const f=d.trim();f.endsWith("?")&&f.length>10&&f.length<200&&a.push(f)}}return n+=`## Open Threads
|
|
667
|
+
|
|
668
|
+
`,a.length>0?(n+=a.map(h=>`- ${h}`).join(`
|
|
669
|
+
`),n+=`
|
|
670
|
+
`):n+=`_No open threads._
|
|
671
|
+
`,n}function OH(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const yo={es:null},Rn=ip((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 Nt(`/api/design/session${a}`),{session:h}=await l.json();if(h){const u=h.messages||[],d=h.decisions||[],f=Dx(u,d),p=OH(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 Nt("/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 Nt("/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 Nt("/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 Nt("/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 Nt("/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(yo.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}`);yo.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:()=>{yo.es&&(yo.es.close(),yo.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=Dx(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function $H(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=Rn(ji(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(Jd,{remarkPlugins:[np],children:t})})})]})}const Qh={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%)"}},Px={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 RH({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?Qh.done:Qh[t])||Qh.build,l=Px[o]||Px.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 zH(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function WH(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function qH(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function HH({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=zH(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=yn[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=`, ${WH(f)}/${qH(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 UH({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=mr(ji(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,Nt(`/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((M,F)=>M+(F.count??0),0):0;P!==y.current&&(y.current=P,Nt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(M=>M.json()).then(M=>m(M)).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 M=setTimeout(()=>w(null),3e3);return C.current=r,()=>clearTimeout(M)}C.current=r},[r]);const _=r||b,[S,N]=k.useState(()=>Date.now()),L=a&&[...a.values()].some(P=>P.status==="running");k.useEffect(()=>{if(!L)return;const P=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(P)},[L]);const A=k.useMemo(()=>HH({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:S}),[_,n,i,s,a,S]),j=k.useMemo(()=>A.filter(P=>!d.current.has(P.key)),[A]);k.useEffect(()=>{const P=new Set(u.current.map(F=>F.key)),M=j.filter(F=>!P.has(F.key)).map(F=>F.key);M.length>0&&(h(F=>{const O=new Map(F);for(const $ of M)O.set($,"enter");return O}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{h(F=>{const O=new Map(F);for(const $ of M)O.get($)==="enter"&&O.set($,"steady");return O})})}));for(const F of j)F.type==="done"&&!f.current.has(F.key)&&(f.current.add(F.key),h(O=>{const $=new Map(O);return $.set(F.key,"flash"),$}),setTimeout(()=>{h(O=>{const $=new Map(O);return $.set(F.key,"exit"),$}),setTimeout(()=>{d.current.add(F.key),h(O=>{const $=new Map(O);return $.delete(F.key),$})},500)},2e3));u.current=j},[j]);const I=k.useCallback(P=>{h(M=>{const F=new Map(M);return F.set(P,"exit"),F}),setTimeout(()=>{d.current.add(P),h(M=>{const F=new Map(M);return F.delete(P),F})},200)},[]),z=k.useCallback(P=>{o&&o(P,"approve","Approved from ops strip")},[o]);if(t==="docs"||j.length===0)return null;const W=MH(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(RH,{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"?()=>I(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 Zh=["dashboard","graph","tree","docs","journal","design","gates","pipeline","sessions","build-history","ideabox"];function YH(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function VH(t){return(t==null?void 0:t[0])??null}const GH="compose:mainTabs",Q2="compose:activeTab";function XH(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(GH);if(!e)return[...Zh];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of Zh)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[...Zh]}function KH(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(Q2);if(r&&YH(t,r))return r}catch{}return VH(t)}function Ox(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(Q2,t)}catch{}}function Z2(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 J2(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const tS="compose:sidebarOpen",eS="compose:contextPanelOpen";function QH(){return Z2(tS,!0)}function ZH(t){return J2(tS,t)}function JH(){return Z2(eS,!1)}function $x(t){return J2(eS,t)}const Rx={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 tU(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 eU(t){return typeof t!="number"||t<=0?null:`$${t.toFixed(t<1?4:2)}`}function rU({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(nu,{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(vn,{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(vc,{icon:nu,title:"No past builds yet",description:"Builds are recorded here after each run completes",className:"py-8"}),a.map((l,h)=>c.jsx(nU,{build:l,items:e,onSelectItem:r},`${l.featureCode}-${l.completedAt}-${h}`))]})]})}function nU({build:t,items:e,onSelectItem:r}){const n=t.featureCode?e.find(u=>{var d;return u.featureCode===t.featureCode||u.feature_code===t.featureCode||((d=u.lifecycle)==null?void 0:d.featureCode)===t.featureCode}):null,i=Rx[t.status]||Rx.killed,s=eU(t.cost_usd),o=t.status==="failed"||t.status==="aborted",[a,l]=k.useState(!1);async function h(){const u=t.featureCode;l(!0);try{await G2({featureCode:u,mode:t.mode}),oe(`Build restarted for ${u}`,"info")}catch(d){d.status===409?oe(`A build for ${u} is already active`,"warn"):oe(d.message||"Failed to restart build","error")}finally{l(!1)}}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(D2,{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:["⏱ ",tU(t.durationMs)]}),s&&c.jsxs("span",{children:["💵 ",s]}),typeof t.stepCount=="number"&&c.jsxs("span",{children:["◆ ",t.stepCount," steps"]})]}),(t.failureReason||o)&&c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.failureReason&&c.jsx("p",{className:"text-[11px] text-red-400/90 truncate flex-1 min-w-0",children:t.failureReason}),o&&c.jsxs("button",{onClick:h,disabled:a,className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted/50 disabled:opacity-50 shrink-0 ml-auto cursor-pointer",title:`Restart build for ${t.featureCode}`,"data-testid":"past-build-retry",children:[c.jsx(AT,{className:"h-2.5 w-2.5"}),a?"Retrying…":"Retry"]})]})]})}const yd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("rounded-xl border bg-card text-card-foreground shadow",t),...e}));yd.displayName="Card";const bd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex flex-col space-y-1.5 p-6",t),...e}));bd.displayName="CardHeader";const Cd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("font-semibold leading-none tracking-tight",t),...e}));Cd.displayName="CardTitle";const iU=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("text-sm text-muted-foreground",t),...e}));iU.displayName="CardDescription";const kd=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("p-6 pt-0",t),...e}));kd.displayName="CardContent";const sU=k.forwardRef(({className:t,...e},r)=>c.jsx("div",{ref:r,className:st("flex items-center p-6 pt-0",t),...e}));sU.displayName="CardFooter";function oU(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 zx({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:oU(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 aU(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 qi(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 Wx(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const lU=(t,e)=>Math.abs(t-e)<1.01,cU=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}};let bo;const Jh=()=>{if(bo!==void 0)return bo;if(typeof navigator>"u")return bo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return bo=!0;const t=navigator.maxTouchPoints;return bo=navigator.platform==="MacIntel"&&t!==void 0&&t>0},qx=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},hU=t=>t,uU=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},dU=(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(qx(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(qx(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},hc={passive:!0},pU=typeof window>"u"?!0:"onscrollend"in window,fU=(t,e,r)=>{const n=t.scrollElement;if(!n)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&pU;let o=0;const a=s?null:cU(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,hc),s&&n.addEventListener("scrollend",u,hc),()=>{n.removeEventListener("scroll",h),s&&n.removeEventListener("scrollend",u)}},mU=(t,e)=>fU(t,e,r=>{const{horizontal:n,isRtl:i}=t.options;return n?r.scrollLeft*(i&&-1||1):r.scrollTop}),gU=(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"]},xU=(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})},yU=xU;class bU{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:hU,rangeExtractor:uU,onChange:()=>{},measureElement:gU,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=qi(()=>(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,!(!Jh()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,hc),s.addEventListener("touchend",a,hc),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&&(Jh()&&(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=qi(()=>[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=qi(()=>[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=aU(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],L=N!==void 0?f[N]:void 0;C=L?L.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=qi(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?CU({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=qi(()=>{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=qi(()=>[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=rS(0,n.length-1,s?a=>i[a*2]:a=>Wx(n[a]).start,r);return Wx(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&&(Jh()&&(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&&lU(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 rS=(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 CU({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=rS(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 tu=typeof document<"u"?k.useLayoutEffect:k.useEffect;function kU({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?SS.flushSync(i):i()),(d=n.onChange)==null||d.call(n,h,u)}},[l]=k.useState(()=>{const h=new bU(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),tu(()=>l._didMount(),[]),tu(()=>l._willUpdate()),tu(()=>{o(l)}),l}function vU(t){return kU({observeElementRect:dU,observeElementOffset:mU,scrollToFn:yU,...t})}function wU(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=yn[u.stepId]??(u.fromPhase&&u.toPhase?`${Te[u.fromPhase]??u.fromPhase} → ${Te[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 SU={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function TU(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 _U({event:t,onSelectItem:e,style:r}){const n=SU[t.category]||"●",i=o_[t.category]||"text-zinc-400",s=s_[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:TU(t.timestamp)})]})}const jU=["all","phase","gate","session","iteration","error"],Hx={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function NU({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=k.useState("all"),[s,o]=k.useState([]),a=k.useRef(null),l=mr(m=>m.gates),h=mr(m=>m.featureTimeline),u=mr(m=>m.setFeatureTimeline);k.useEffect(()=>{if(!t)return;let m=!1;return Nt(`/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=wU(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=vU({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:jU.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:[Hx[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 "${Hx[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(_U,{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 Ro=["explore_design","prd","architecture","blueprint","plan","execute","report"];function EU(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 BU({currentPhase:t}){const e=Ro.indexOf(t);return c.jsx("div",{className:"space-y-1.5",children:Ro.map((r,n)=>{const i=e>n,s=e===n,o=Te[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(c0,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?c.jsx(s0,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):c.jsx(QS,{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 LU({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(zx,{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(zx,{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(Si,{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 AU({gates:t,allGates:e,items:r,onResolveGate:n}){const i=TS(),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:[yn[o.stepId]??Te[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(pf,{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(Dt,{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(Dt,{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(Dt,{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 MU({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(VT,{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($s,{kind:"feature",id:s,label:s,className:"text-[9px]"}),c.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:EU(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 IU({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 L;return N.featureCode===s||((L=N.lifecycle)==null?void 0:L.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 L=!N;try{localStorage.setItem("compose:timeline-open",String(L))}catch{}return L})},[]),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=Ro.indexOf(C),w=C?Math.max(0,(b+1)/Ro.length):0,_=k.useMemo(()=>{let N=e.filter(L=>L.status==="pending"||!L.resolvedAt);if(s){const L=new Set(t.filter(A=>{var j;return A.featureCode===s||((j=A.lifecycle)==null?void 0:j.featureCode)===s}).map(A=>A.id));N=N.filter(A=>L.has(A.itemId))}return N},[e,t,s]);if(!s){const N=t.filter(L=>L.type==="feature"&&(L.status==="complete"||L.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(Dt,{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(L=>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(L.id),children:[c.jsx(c0,{className:"w-3 h-3 text-emerald-400 shrink-0"}),c.jsx("span",{className:"text-[11px] text-foreground truncate",children:L.title}),L.featureCode&&c.jsx(gr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:L.featureCode})]},L.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(gr,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),C&&c.jsx(gr,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:Te[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(bT,{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 ${Ro.length} phases`:"Phase unknown"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs(yd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[c.jsx(bd,{className:"p-3 pb-2",children:c.jsx(Cd,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),c.jsx(kd,{className:"p-3 pt-0",children:c.jsx(BU,{currentPhase:C})})]}),c.jsxs(yd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[c.jsx(bd,{className:"p-3 pb-2",children:c.jsx(Cd,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),c.jsx(kd,{className:"p-3 pt-0",children:c.jsx(LU,{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(AU,{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(MU,{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(NU,{featureCode:s,itemId:m==null?void 0:m.id,onSelectItem:h})]})]})}function FU(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 DU(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:FU(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function PU({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(mi,{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(Dt,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function OU({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=Cs(),[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?DU(w,s.filter(I=>I.id!==w.id)):[],[w,s]),S=k.useCallback(()=>{const I=l+1;I>=o.length?p(!0):(h(I),y(!1),x(""))},[l,o.length]),N=k.useCallback(async I=>{if(!(!w||C)){b(!0);try{await r(w.id,I),d(z=>[...z,{id:w.id,action:"priority",priority:I}]),S()}finally{b(!1)}}},[w,C,r,S]),L=k.useCallback(async()=>{if(!(!w||C)){b(!0);try{await n(w.id,m),d(I=>[...I,{id:w.id,action:"kill"}]),y(!1),x(""),S()}finally{b(!1)}}},[w,C,n,m,S]),A=k.useCallback(()=>{w&&(d(I=>[...I,{id:w.id,action:"skip"}]),S())},[w,S]),j=k.useCallback(async()=>{if(!(!w||C)){b(!0);try{await i(w.id),d(I=>[...I,{id:w.id,action:"promote"}]),S()}finally{b(!1)}}},[w,C,i,S]);return k.useEffect(()=>{const I=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")&&A(),z.key==="k"&&y(!0))};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[g,N,A,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(mi,{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(kn,{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(PU,{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(gr,{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(I=>c.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:I},I))}),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(I=>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(gr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:I.id}),c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:I.title})]},I.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:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&L(),I.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(Dt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),c.jsx(Dt,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:L,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(Dt,{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(Dt,{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(Dt,{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(Dt,{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(Dt,{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(Dt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:A,title:"Press s or →",children:[c.jsx(m0,{className:"w-3 h-3"}),"Skip ",c.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function Ux(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 $U(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
|
|
672
|
+
|
|
673
|
+
**Date:** ${r}
|
|
674
|
+
**Promoted from:** ${t.id}
|
|
675
|
+
**Priority:** ${t.priority||"TBD"}
|
|
676
|
+
**Tags:** ${n}
|
|
677
|
+
|
|
678
|
+
## Context
|
|
679
|
+
|
|
680
|
+
${t.description||t.title}
|
|
681
|
+
|
|
682
|
+
## Source
|
|
683
|
+
|
|
684
|
+
${t.source||"Internal idea"}
|
|
685
|
+
|
|
686
|
+
## Goals
|
|
687
|
+
|
|
688
|
+
- [ ] Define acceptance criteria
|
|
689
|
+
- [ ] Identify affected components
|
|
690
|
+
- [ ] Estimate effort
|
|
691
|
+
|
|
692
|
+
## Related
|
|
693
|
+
|
|
694
|
+
${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
|
|
695
|
+
`.trimStart()}function RU({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(oa,{className:"w-3 h-3"}):t})})}function zU({idea:t,onClose:e}){var _;const{promoteIdea:r}=Cs(),[n,i]=k.useState(1),[s,o]=k.useState(()=>Ux(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($U(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(Nd,{open:!0,onOpenChange:S=>!S&&e(),children:c.jsxs(Ed,{className:"max-w-lg",children:[c.jsx(Bd,{children:c.jsxs(Ld,{className:"flex items-center gap-2",children:[c.jsx(mi,{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(Wt.Fragment,{children:[c.jsx(RU,{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(fi,{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(gr,{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:[Ux(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((S,N,L)=>L.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(oa,{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(Dt,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&c.jsxs(r0,{children:[n>1&&c.jsxs(Dt,{variant:"ghost",size:"sm",onClick:C,disabled:d,children:[c.jsx(a0,{className:"w-3 h-3 mr-1"}),"Back"]}),c.jsx(Dt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?c.jsxs(Dt,{size:"sm",onClick:y,children:["Next",c.jsx(fi,{className:"w-3 h-3 ml-1"})]}):c.jsx(Dt,{size:"sm",onClick:b,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const vd=["S","M","L"],WU=["high","medium","low"],qU={"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"},Yx={"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"},Vx=["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 HU({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:vd.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 UU({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]=Vx[p%Vx.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:vd.map(u=>c.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),WU.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})}),vd.map(d=>{const f=`${u}-${d}`,p=qU[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",Yx[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(Yx).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(HU,{idea:u,onSubmit:h,onCancel:()=>s(null)})})]},u.id))})]})]})}function eu({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 YU({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)",L=N.length>30?N.slice(0,30)+"…":N;o[L]=(o[L]||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(Ls,{className:"w-3 h-3"}):c.jsx(fi,{className:"w-3 h-3"}),c.jsx($S,{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(eu,{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(eu,{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(eu,{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 VU=[{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 Gx(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function nS({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 GU({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 XU({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(gr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),c.jsx(nS,{status:t.status}),c.jsx("div",{className:"flex-1"}),c.jsx(GU,{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 KU({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(gr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),c.jsx(nS,{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(dc,{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(Fd,{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(Dt,{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(Dt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{h(!1),a("")},children:"Cancel"}),c.jsx(Dt,{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(Dt,{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 QU({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(Ls,{className:"w-3 h-3 text-muted-foreground"}):c.jsx(fi,{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(gr,{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 ZU(){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}=Cs(),[m,x]=k.useState(!1),[g,y]=k.useState(null),[C,b]=k.useState(null),[w,_]=k.useState(null),[S,N]=k.useState("cards"),L=k.useMemo(()=>{var et;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 V=((et=Object.entries(T).sort((D,G)=>G[1]-D[1])[0])==null?void 0:et[0])??null;return{newCount:O,untriaged:$,p0Count:B,topCluster:V}},[t]),A=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]),I=k.useMemo(()=>{const O=new Map,$=[];j.forEach(V=>{V.cluster?(O.has(V.cluster)||O.set(V.cluster,[]),O.get(V.cluster).push(V)):$.push(V)});const B=V=>[...V].sort((et,D)=>Gx(et.priority)-Gx(D.priority)),T=[];for(const[V,et]of O)T.push({cluster:V,ideas:B(et)});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)},[]),M=k.useCallback((O,$)=>{O.preventDefault(),O.dataTransfer.dropEffect="move",_($)},[]),F=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(mi,{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(Wo,{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(Wo,{className:"w-3 h-3"})}),c.jsxs(Dt,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:L.untriaged===0,children:["Triage (",L.untriaged,")"]})]}),c.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[L.newCount>0&&c.jsxs("span",{className:"text-emerald-400",children:[L.newCount," new"]}),c.jsxs("span",{children:[L.untriaged," untriaged"]}),L.p0Count>0&&c.jsxs("span",{className:"text-red-400",children:[L.p0Count," P0"]}),L.topCluster&&c.jsxs("span",{children:["top cluster: ",c.jsx("span",{className:"text-foreground",children:L.topCluster})]}),c.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),c.jsx(YU,{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(oT,{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"}),A.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(vn,{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:()=>Cs.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(UU,{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(mi,{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"&&I.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:VU.map(B=>{const T=$.filter(et=>et.priority===B.key),V=w===B.key&&C;return c.jsxs("div",{className:st("rounded-lg border p-2 min-h-[80px] transition-colors",B.bg,B.border,V&&"ring-1 ring-accent"),onDragOver:et=>M(et,B.key),onDrop:et=>F(et,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(et=>c.jsx(XU,{idea:et,selected:i===et.id,onClick:u,onDragStart:W,onDragEnd:P},et.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(QU,{killed:e,onResurrect:h})]})]}),z&&c.jsx(KU,{idea:z,onClose:()=>u(null),onPromote:O=>y(O),onKill:l,onSetPriority:a,onAddDiscussion:f}),m&&c.jsx(OU,{ideas:t.filter(O=>!O.priority||O.priority==="—"),onClose:()=>x(!1)}),g&&c.jsx(zU,{idea:g,onClose:()=>y(null)})]})}const iS=[["what_happened","What happened"],["what_we_built","What we built"],["what_we_learned","What we learned"],["open_threads","Open threads"]],Xx={summary:"",feature_code:"",what_happened:"",what_we_built:"",what_we_learned:"",open_threads:""};function JU(){const[t,e]=k.useState("journal"),[r,n]=k.useState(""),[i,s]=k.useState([]),[o,a]=k.useState(!0),[l,h]=k.useState(null),[u,d]=k.useState(!1),[f,p]=k.useState(Xx),[m,x]=k.useState(!1),g=k.useRef(0),y=k.useCallback(async()=>{const w=++g.current;a(!0),h(null);try{const _=new URLSearchParams;r.trim()&&_.set("feature",r.trim());const S=_.toString(),N=await Nt(`/api/${t}${S?`?${S}`:""}`);if(!N.ok)throw new Error(`fetch failed (${N.status})`);const L=await N.json();if(w!==g.current)return;s(L.entries||[])}catch(_){if(w!==g.current)return;h(_.message||String(_)),s([])}finally{w===g.current&&a(!1)}},[t,r]);k.useEffect(()=>{y()},[y]);const C=k.useRef(y);k.useEffect(()=>{C.current=y},[y]);const b=async()=>{x(!0);try{const w=await Nt("/api/journal",{method:"POST",headers:Pn({"Content-Type":"application/json"}),body:JSON.stringify({summary:f.summary,...f.feature_code.trim()?{feature_code:f.feature_code.trim()}:{},sections:{what_happened:f.what_happened,what_we_built:f.what_we_built,what_we_learned:f.what_we_learned,open_threads:f.open_threads}})});if(!w.ok){let _=`journal write failed (${w.status})`;try{const S=await w.json();S!=null&&S.error&&(_=S.error)}catch{}throw new Error(_)}oe("Journal entry written","info"),p(Xx),d(!1),C.current()}catch(w){oe(w.message||String(w),"error")}finally{x(!1)}};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("div",{className:"flex rounded overflow-hidden border border-border",role:"group","aria-label":"Source",children:["journal","changelog"].map(w=>c.jsx("button",{type:"button",onClick:()=>e(w),className:st("text-xs px-2 py-0.5 h-6 capitalize cursor-pointer",t===w?"bg-muted text-foreground":"bg-transparent text-muted-foreground hover:text-foreground"),children:w},w))}),c.jsx("input",{type:"text",placeholder:"Filter by feature code…","aria-label":"Feature filter",value:r,onChange:w=>n(w.target.value),className:"text-xs px-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border w-44 font-mono"}),c.jsx("button",{type:"button",onClick:y,title:"Refresh",className:"text-xs px-1.5 py-0.5 h-6 rounded bg-muted text-muted-foreground border border-border hover:text-foreground cursor-pointer",children:c.jsx(Wo,{className:"h-3 w-3"})}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i.length," entries"]}),t==="journal"&&c.jsxs("button",{type:"button",onClick:()=>d(w=>(w||p(_=>({..._,feature_code:_.feature_code||r.trim()})),!w)),className:"ml-auto flex items-center gap-1 text-xs px-2 py-0.5 h-6 rounded bg-muted text-foreground border border-border hover:bg-accent cursor-pointer",children:[c.jsx(xl,{className:"h-3 w-3"}),"New entry"]})]}),u&&t==="journal"&&c.jsxs("div",{className:"px-3 py-2 border-b border-border shrink-0 space-y-1.5","data-testid":"journal-write-form",children:[c.jsx("input",{type:"text",placeholder:"Summary (one line)","aria-label":"Summary",value:f.summary,onChange:w=>p(_=>({..._,summary:w.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full"}),c.jsx("input",{type:"text",placeholder:"Feature code (optional)","aria-label":"Feature code",value:f.feature_code,onChange:w=>p(_=>({..._,feature_code:w.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full font-mono"}),iS.map(([w,_])=>c.jsx("textarea",{placeholder:_,"aria-label":_,rows:2,value:f[w],onChange:S=>p(N=>({...N,[w]:S.target.value})),className:"text-xs px-2 py-1 rounded bg-muted text-foreground border border-border w-full resize-y"},w)),c.jsxs("div",{className:"flex gap-1.5",children:[c.jsx("button",{type:"button",disabled:m,onClick:b,className:"text-xs px-2 py-0.5 rounded bg-blue-600 text-white hover:bg-blue-500 disabled:opacity-50 cursor-pointer",children:m?"Writing…":"Write entry"}),c.jsx("button",{type:"button",onClick:()=>d(!1),className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground border border-border cursor-pointer",children:"Cancel"})]})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[o&&c.jsx("div",{className:"py-8 text-center text-[11px] text-muted-foreground",children:"Loading…"}),!o&&l&&c.jsx("div",{className:"py-8 text-center text-[11px] text-red-400",children:l}),!o&&!l&&i.length===0&&c.jsx(vc,{icon:o0,title:t==="journal"?"No journal entries":"No changelog entries",description:t==="journal"?"Journal entries appear as sessions are written up":"Changelog entries appear as features ship",className:"py-8"}),!o&&!l&&t==="journal"&&i.map(w=>c.jsx(tY,{entry:w},w.path||`${w.date}-${w.slug}`)),!o&&!l&&t==="changelog"&&i.map((w,_)=>c.jsx(eY,{entry:w},`${w.line_number??_}`))]})]})}function tY({entry:t}){return c.jsxs("div",{className:"px-3 py-2.5 border-b border-border/50",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:t.date}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Session ",t.session_number]}),t.feature_code&&c.jsx($s,{kind:"feature",id:t.feature_code})]}),t.summary&&c.jsx("div",{className:"text-xs text-foreground mt-0.5 font-medium",children:t.summary}),c.jsx("div",{className:"mt-1.5 space-y-1.5",children:iS.map(([e,r])=>{var n;return(n=t.sections)!=null&&n[e]?c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:r}),c.jsx(Wc,{content:t.sections[e],className:"prose prose-invert prose-sm max-w-none text-xs"})]},e):null})}),t.closing_line&&c.jsx("div",{className:"mt-1.5 text-[11px] italic text-muted-foreground",children:t.closing_line})]})}function eY({entry:t}){return c.jsxs("div",{className:"px-3 py-2.5 border-b border-border/50",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:t.date_or_version}),t.code&&c.jsx($s,{kind:"feature",id:t.code})]}),t.summary&&c.jsx("div",{className:"text-xs text-foreground mt-0.5 font-medium",children:t.summary}),t.body&&c.jsx("div",{className:"mt-1",children:c.jsx(Wc,{content:t.body,className:"prose prose-invert prose-sm max-w-none text-xs"})})]})}const rY=["A","B","C","D","E","F","G","H"];function nY({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)?rY[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(oa,{style:{width:14,height:14}}):c.jsx(qT,{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 iY(){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}=Rn(),[x,g]=k.useState(""),[y,C]=k.useState(null),[b,w]=k.useState(""),_=k.useRef(null),S=n0();k.useEffect(()=>(Rn.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]),L=k.useCallback((W,P)=>{C({messageIndex:P,cardId:W})},[]),A=k.useCallback(()=>{y&&(u(y.cardId,b||null,y.messageIndex),C(null),w(""))},[y,b,u]),j=n==="streaming"||n==="summarizing",I=e.reduce((W,P,M)=>P.role==="assistant"&&P.content&&K2(P.content).parts.some(F=>F.type==="decision")?M: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(gf,{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(Kx,{messageIndex:P,message:W,onCardSelect:L,selectedCard:y,isStreaming:j,cardsDisabled:j||P!==I},P)),s&&c.jsx(Kx,{message:s,onCardSelect:L,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"&&A(),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:A,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(Fd,{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(gf,{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(dc,{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 Kx({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,h;const o=t.role==="human",a=!o&&t.content?K2(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(nY,{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 sY=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),oY=new Set(["WebSearch","web_search"]);function aY({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 lY(){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 cY(){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 ru({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(aY,{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 Ja(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function Qx(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function hY({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>sY.has(o.tool)),n=t.filter(o=>oY.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return c.jsx(Wn,{className:"flex-1",children:c.jsxs("div",{children:[c.jsx(ru,{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(lY,{}):c.jsx(cY,{})}),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(ru,{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:Ja(Qx(o.tool,o.input),50)})]}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ja(o.summary,100)})]},a))})}),c.jsx(ru,{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:Ja(Qx(o.tool,o.input),80)}),o.summary&&c.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:Ja(o.summary,100)})]},a))})})]})})}function uY({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=k.useState("decisions"),o=t.filter(h=>!h.superseded).length,a=Rn(h=>h.researchItems)||[],l=Rn(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(Wn,{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(hY,{researchItems:a,topicOutline:l})]})}function dY(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function pY(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 fY(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 mY=320,gY=40,xY={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function sS(t){return t?`compose:${t}:openLoopsCollapsed`:null}function Zx(t){const e=sS(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function yY(t,e){const r=sS(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function bY({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 kY({loop:t,onResolve:e,nowMs:r}){const n=fY(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:xY[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.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:6},children:[t.parent_feature&&c.jsx($s,{kind:"feature",id:t.parent_feature,label:t.parent_feature,className:"text-[10px]"}),c.jsx("span",{style:{fontSize:10,color:"#6c7086"},children:pY(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 vY({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var y,C;const i=n0(),[s,o]=k.useState(()=>Zx(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(Zx(t))},[t]);const d=k.useCallback(()=>{o(b=>{const w=!b;return yY(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(()=>dY(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),oe(`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),oe(`Could not resolve loop: ${_.message}`,"error")}}},[t,n,i]);return t?s?c.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:gY,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:mY,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(kY,{loop:b,onResolve:g,nowMs:h},b.id))})]}),a&&c.jsx(bY,{onConfirm:x,onCancel:()=>l(!1)})]}):null}const Hi={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},wY=new Set(["blocks","informs"]);function Jx(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 SY(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function TY(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=Hi.error;else if(o==="running"){const h=a&&a.endsWith("_gate"),u=Jx(e,s);h&&u&&n.some(f=>f.itemId===u.id&&!f.resolvedAt)?i[s]=Hi.gate_pending:i[s]=Hi.building}const l=Jx(e,s);if(l&&(i[s]===Hi.building||i[s]===Hi.gate_pending)){const h=new Set([l.id]),u=_Y(h,r),d=new Map(e.map(f=>[f.id,SY(f)]));for(const f of u){const p=d.get(f);p&&!i[p]&&(i[p]=Hi.blocked_downstream)}}return i}function _Y(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)wY.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 jY(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=a_[h]||"#3b82f6";r.push({data:{id:`agent-${l.agentId}`,label:`${h}
|
|
696
|
+
${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 kr extends Wt.Component{constructor(){super(...arguments);re(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 NY extends Wt.Component{constructor(){super(...arguments);re(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(S0,{})})]}):this.props.children}}const wd="compose:fontSize",EY="compose:theme",zo=13,Sd=10,Td=20;function BY(){try{const t=parseInt(localStorage.getItem(wd),10);return t>=Sd&&t<=Td?t:zo}catch{return zo}}const t0=new URLSearchParams(window.location.search).get("popout");function LY(){return t0?c.jsx(dq,{path:t0}):c.jsx(NY,{children:c.jsx(MY,{})})}function AY({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:L,onSelect:A,onUpdate:j,onCreate:I,onCreateFeature:z,isEmptyProject:W,onDelete:P,onOpenGate:M,onCreateConnection:F,onDeleteConnection:O,onRefreshBuild:$,onSelectStep:B,onResolveGate:T,onUpdateSettings:V,onResetSettings:et,projectRoot:D,featureCode:G,focusActive:ht,onToggleFocus:xt,sessionState:$t,agentActivity:Ht,iterationStates:ct,focusedGateId:X,onFocusHandled:it}){switch(t){case"dashboard":return c.jsx(IU,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:y,featureCode:G,sessionState:$t,agentActivity:Ht,iterationStates:ct,onSelect:A,onResolveGate:T,onOpenGate:M,onCreateFeature:z,isEmptyProject:W});case"tree":return c.jsx(Ky,{items:r,connections:o,selectedItemId:m,onSelect:A,onCreate:I,onCreateFeature:z,isEmptyProject:W,featureCode:G,focusActive:ht,onToggleFocus:xt});case"graph":return c.jsx(Zy,{items:e,connections:s,selectedItemId:m,onSelect:A,onCreateFeature:z,isEmptyProject:W,visibleTracks:N,hiddenGroups:L,buildStateMap:x,resolveGate:T,gates:d,spawnedAgents:y,agentRelays:C,agentOverlay:g,featureCode:G,focusActive:ht,onToggleFocus:xt});case"pipeline":return c.jsx(B2,{activeBuild:l,pipelineDraft:h,onSelectStep:B,onRefresh:$});case"sessions":return c.jsx(P2,{sessions:a,items:e,onSelectItem:A,featureCode:G,focusActive:ht,onToggleFocus:xt});case"build-history":return c.jsx(rU,{builds:u,items:e,onSelectItem:A});case"gates":return c.jsx(_2,{gates:i,items:n,onResolve:T,onSelect:A,featureCode:G,focusActive:ht,onToggleFocus:xt,focusedGateId:X,onFocusHandled:it});case"docs":return c.jsx(S2,{items:n,selectedFile:b,onSelectedFileChange:w,previousView:_,onBack:S,featureCode:G,focusActive:ht,onToggleFocus:xt});case"design":return c.jsx(iY,{},D);case"ideabox":return c.jsx(ZU,{});case"journal":return c.jsx(JU,{});case"settings":return c.jsx(E2,{settings:f,onSettingsChange:V,onReset:et});case"stratum":return c.jsx(Cq,{});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 MY(){const{refresh:t}=_S(),e=Rn(U=>U.decisions),r=Rn(U=>U.status),[n,i]=k.useState(BY),[s,o]=k.useState(()=>document.documentElement.classList.contains("dark")),[a]=k.useState(XH),[l,h]=k.useState(()=>KH(a)),[u,d]=k.useState(Aq),[f,p]=k.useState(QH),[m,x]=k.useState(JH),[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:L,uiCommand:A,clearUICommand:j,recentChanges:I,createItem:z,updateItem:W,deleteItem:P,createConnection:M,deleteConnection:F,agentActivity:O,agentErrors:$,spawnedAgents:B,agentRelays:T,sessionState:V,registerSnapshotProvider:et,gates:D,gateEvent:G,resolveGate:ht,settings:xt,updateSettings:$t,resetSettings:Ht,activeBuild:ct,setActiveBuild:X,pipelineDraft:it,sessions:vt,iterationStates:gt,buildHistory:Jt,fetchBuildHistory:Pt,selectedPhase:Xt,setSelectedPhase:je,statusSnapshots:Kt,setStatusSnapshot:br}=mr(ji(U=>({items:U.items,connections:U.connections,connected:U.connected,uiCommand:U.uiCommand,clearUICommand:U.clearUICommand,recentChanges:U.recentChanges,createItem:U.createItem,updateItem:U.updateItem,deleteItem:U.deleteItem,createConnection:U.createConnection,deleteConnection:U.deleteConnection,agentActivity:U.agentActivity,agentErrors:U.agentErrors,spawnedAgents:U.spawnedAgents,agentRelays:U.agentRelays,sessionState:U.sessionState,registerSnapshotProvider:U.registerSnapshotProvider,gates:U.gates,gateEvent:U.gateEvent,resolveGate:U.resolveGate,settings:U.settings,updateSettings:U.updateSettings,resetSettings:U.resetSettings,activeBuild:U.activeBuild,setActiveBuild:U.setActiveBuild,pipelineDraft:U.pipelineDraft,sessions:U.sessions,iterationStates:U.iterationStates,buildHistory:U.buildHistory,fetchBuildHistory:U.fetchBuildHistory,selectedPhase:U.selectedPhase,setSelectedPhase:U.setSelectedPhase,statusSnapshots:U.statusSnapshots,setStatusSnapshot:U.setStatusSnapshot}))),ue=(V==null?void 0:V.featureCode)||null;k.useEffect(()=>{ue&&(Kt&&Kt[ue]||Nt(`/api/lifecycle/status?featureCode=${encodeURIComponent(ue)}`).then(U=>U.json()).then(U=>{U!=null&&U.snapshot&&br&&br(ue,U.snapshot)}).catch(()=>{}))},[ue,Kt,br]);const[Pe,We]=k.useState(null),de=k.useRef(!!localStorage.getItem("compose:activeView")),[q,Z]=k.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[H,rt]=k.useState(""),at=k.useCallback(U=>{b(U),localStorage.setItem("compose:contextWidthPx",String(Math.round(U)))},[]),pt=k.useRef(!1),Tt=k.useCallback(U=>{U.preventDefault(),pt.current=!0;const ut=ee=>{if(!pt.current)return;const cr=ee.clientX-16,Qs=Math.max(160,Math.min(window.innerWidth*.4,cr));_(Qs),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(Qs)))},dt=()=>{pt.current=!1,document.removeEventListener("mousemove",ut),document.removeEventListener("mouseup",dt)};document.addEventListener("mousemove",ut),document.addEventListener("mouseup",dt)},[]),[te,ge]=k.useState(null),[Ne,qe]=k.useState(null),[xe,ye]=k.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[he,Oe]=k.useState(()=>{try{const U=localStorage.getItem("compose:visibleTracks");if(U){const ut=JSON.parse(U);return new Set(ut)}}catch{}return null}),[Rs,ka]=k.useState(new Set),[zs,Ni]=k.useState(!1),Ei=k.useCallback(U=>{ka(ut=>{const dt=new Set(ut);return dt.has(U)?dt.delete(U):dt.add(U),dt})},[]),[Kn,_r]=k.useState(null),[jn,on]=k.useState(!1),[Ws,Bi]=k.useState(!1),[qs,Li]=k.useState("task"),[Hc,Nn]=k.useState(!1),[Uc,va]=k.useState(""),[pe,an]=k.useState("");k.useEffect(()=>{Nt("/api/project").then(U=>U.json()).then(U=>{va(U.name||""),an(U.targetRoot||"")}).catch(()=>{})},[]);const Yc=k.useCallback(async U=>{try{const dt=await(await Nt("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:U})})).json();return dt.ok?(await t(),va(dt.name),an(dt.targetRoot),!0):!1}catch{return!1}},[t]),Hs=u===Xe.MAXIMIZED,Us=k.useCallback(U=>{h(U),Ox(U),Z(U)},[]),Ae=k.useCallback(U=>{Z(U),h(U),Ox(U)},[]);k.useEffect(()=>{localStorage.setItem("compose:activeView",q),q!=="docs"&&(qe(null),ge(null))},[q]),k.useEffect(()=>{xe?localStorage.setItem("compose:selectedTrack",xe):localStorage.removeItem("compose:selectedTrack")},[xe]),k.useEffect(()=>{Pe?sessionStorage.setItem("vision-selectedItemId",Pe):sessionStorage.removeItem("vision-selectedItemId")},[Pe]),k.useEffect(()=>{try{he?localStorage.setItem("compose:visibleTracks",JSON.stringify([...he])):localStorage.removeItem("compose:visibleTracks")}catch{}},[he]);const Ys=k.useRef(!1);k.useEffect(()=>{var U;Ys.current||de.current||(U=xt==null?void 0:xt.ui)!=null&&U.defaultView&&(Ae(xt.ui.defaultView),Ys.current=!0)},[xt]),k.useEffect(()=>{A&&(A.view&&Ae(A.view),A.phase!==void 0&&je(A.phase),A.select!==void 0&&Ue(A.select),j())},[A,j]),k.useEffect(()=>{const U=()=>{var dt;return["INPUT","TEXTAREA","SELECT"].includes((dt=document.activeElement)==null?void 0:dt.tagName)},ut=dt=>{(dt.metaKey||dt.ctrlKey)&&dt.key==="k"&&(dt.preventDefault(),on(ee=>!ee)),(dt.metaKey||dt.ctrlKey)&&dt.key==="n"&&(dt.preventDefault(),Bi(!0)),dt.key===","&&!dt.metaKey&&!dt.ctrlKey&&!U()&&Nn(!0)};return window.addEventListener("keydown",ut),()=>window.removeEventListener("keydown",ut)},[]);const Qn=k.useMemo(()=>{let U=S;if(Xt&&(U=U.filter(ut=>ut.phase===Xt)),xe&&(U=U.filter(ut=>{const dt=(ut.description||"").match(/Track:\s*(\w+)/i);return dt&&dt[1].toLowerCase()===xe})),H){const ut=H.toLowerCase();U=U.filter(dt=>dt.title.toLowerCase().includes(ut)||(dt.description||"").toLowerCase().includes(ut))}return U},[S,Xt,xe,H]),tr=k.useMemo(()=>Xt?S.filter(U=>U.phase===Xt):S,[S,Xt]),Vs=k.useMemo(()=>new Set(tr.map(U=>U.id)),[tr]),ln=k.useMemo(()=>Xt?D.filter(U=>Vs.has(U.itemId)):D,[D,Vs,Xt]),Vc=k.useMemo(()=>{if(!Xt&&!xe&&!H)return N;const U=new Set(Qn.map(ut=>ut.id));return N.filter(ut=>U.has(ut.fromId)&&U.has(ut.toId))},[N,Qn,Xt,xe,H]),Gc=k.useMemo(()=>TY(ct,S,N,D),[ct,S,N,D]),wa=k.useMemo(()=>jY(B,T),[B,T]),He=k.useCallback(U=>{y(U)},[]),Ue=k.useCallback(U=>{We(ut=>ut===U?(He(null),null):(He({type:"item",id:U}),U))},[He]),Ai=k.useCallback(async U=>{try{const ut=await Nt(`/api/agent/${U}/stop`,{method:"POST",headers:Pn({"Content-Type":"application/json"})});ut.ok||oe(`Could not stop agent (${ut.status})`,"error")}catch(ut){console.error(`[App] Failed to stop agent ${U}:`,ut.message),oe(`Could not stop agent: ${ut.message}`,"error")}},[]),cn=k.useRef(ct);k.useEffect(()=>{!cn.current&&ct&&ct.featureItemId&&Ue(ct.featureItemId),cn.current=ct},[ct]);const hn=k.useCallback(U=>{if(!U)return;const ut=S.find(dt=>{var ee,cr;return((ee=dt.lifecycle)==null?void 0:ee.featureCode)===U||dt.featureCode===U||dt.feature_code===U||((cr=dt.title)==null?void 0:cr.includes(U))});ut&&Ue(ut.id)},[S,Ue]);k.useEffect(()=>{const U=ut=>{const{featureCode:dt}=ut.detail||{};dt&&hn(dt)};return window.addEventListener("compose:select-feature",U),()=>window.removeEventListener("compose:select-feature",U)},[hn]);const lr=k.useCallback(U=>S.find(ut=>{var dt;return((dt=ut.lifecycle)==null?void 0:dt.featureCode)===U})||null,[S]),Sa=k.useCallback(async(U,ut)=>{const dt=lr(U);if(!dt)throw new Error(`No item found for feature ${U}`);const ee=await Nt(`/api/vision/items/${dt.id}/loops`,{method:"POST",headers:Pn({"Content-Type":"application/json"}),body:JSON.stringify(ut)});if(!ee.ok)throw new Error(`Add loop failed: ${ee.status}`)},[lr]),Ta=k.useCallback(async(U,ut,{note:dt})=>{const ee=lr(U);if(!ee)throw new Error(`No item found for feature ${U}`);const cr=await Nt(`/api/vision/items/${ee.id}/loops/${ut}/resolve`,{method:"POST",headers:Pn({"Content-Type":"application/json"}),body:JSON.stringify({note:dt})});if(!cr.ok)throw new Error(`Resolve loop failed: ${cr.status}`)},[lr]);k.useEffect(()=>{et(()=>({activeView:q,selectedPhase:Xt,searchQuery:H,selectedItemId:Pe,totalItems:S.length,filteredCount:Qn.length,connected:L}))},[et,q,Xt,H,Pe,S.length,Qn.length,L]),k.useEffect(()=>{const U=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return U.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>U.disconnect()},[]),k.useEffect(()=>{g&&!m&&(x(!0),$x(!0))},[g]),k.useEffect(()=>{q==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[q]),k.useEffect(()=>{q==="build-history"&&Pt()},[q,Pt]);const Xc=k.useCallback(()=>{const U=s?"light":"dark";document.documentElement.classList.toggle("dark",U==="dark"),localStorage.setItem(EY,U),Nt("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:U}})}).catch(()=>{})},[s]),Gs=k.useCallback(U=>{i(ut=>{const dt=Math.min(Math.max(ut+U,Sd),Td);return localStorage.setItem(wd,dt),dt})},[]),_a=k.useCallback(()=>{i(zo),localStorage.setItem(wd,zo)},[]),Mi=k.useCallback(U=>{d(U),Mq(U)},[]),Xs=k.useCallback(()=>{p(U=>(ZH(!U),!U))},[]),ft=k.useCallback(()=>{x(U=>($x(!U),!U))},[]),R=k.useCallback((U,ut)=>{W(U,ut)},[W]),J=k.useCallback(async()=>{const ut=await z({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Xt||"vision"});ut&&ut.id&&Ue(ut.id)},[z,Xt]),lt=k.useCallback(()=>{Li("feature"),Bi(!0)},[]),Et=S.length===0,It=k.useCallback(async U=>{await P(U),Pe===U&&(We(null),He(null))},[P,Pe,He]),Ot=k.useCallback(U=>{const ut=D.find(dt=>dt.id===U);ut&&(We(ut.itemId),He({type:"item",id:ut.itemId}))},[D,He]),[we,ie]=k.useState(null),fe=k.useCallback(U=>{D.find(dt=>dt.id===U)&&(je(null),Ni(!1),ie(U),Ae("gates"))},[D,je,Ni,Ae]),Hr=k.useCallback(()=>ie(null),[]),Se=k.useCallback(U=>{if(!U)return;const ut=S.find(dt=>{var ee;return dt.featureCode===U||dt.feature_code===U||((ee=dt.lifecycle)==null?void 0:ee.featureCode)===U});ut&&Ue(ut.id)},[S,Ue]),Ks=k.useCallback((U,ut)=>{if(!ut)return!1;switch(U){case"gate":return D.some(dt=>dt.id===ut);case"item":return S.some(dt=>dt.id===ut);case"feature":return S.some(dt=>{var ee;return dt.featureCode===ut||dt.feature_code===ut||((ee=dt.lifecycle)==null?void 0:ee.featureCode)===ut});case"view":return!0;default:return!1}},[D,S]),ja=k.useMemo(()=>({openItem:Ue,openGate:fe,openView:Ae,openFeature:Se,canNavigate:Ks}),[Ue,fe,Ae,Se,Ks]),oS=k.useCallback(async U=>M(U),[M]),aS=k.useCallback(async U=>F(U),[F]),lS=k.useCallback(()=>{Nt("/api/build/state").then(U=>U.json()).then(U=>X(U.state??null)).catch(()=>{})},[X]),cS=k.useCallback(U=>{He({type:"step",id:U})},[He]),Na=k.useCallback(U=>{const ut=S.find(cr=>cr.id===U);if(!ut)return;const dt=(ut.description||"").match(/Track:\s*(\w+)/i),ee=dt?dt[1].toLowerCase():null;xe&&ee&&xe!==ee&&ye(null),ee&&he&&!he.has(ee)&&Oe(cr=>{const Qs=new Set(cr);return Qs.add(ee),Qs})},[S,xe,he]),hS=k.useCallback(U=>{Na(U),We(U),He({type:"item",id:U}),Ae("graph")},[Ae,He,Na]),uS=k.useCallback(U=>{Na(U),We(U),He({type:"item",id:U}),Ae("tree")},[Ae,He,Na]),dS=k.useCallback(U=>{qe(q),ge(U),Ae("docs")},[q,Ae]),pS=k.useCallback(()=>{Ne&&(Ae(Ne),qe(null),ge(null))},[Ne,Ae]);return c.jsx(V2.Provider,{value:ja,children:c.jsx(bc.Provider,{value:I,children:c.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[c.jsx(kr,{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(kq,{projectName:Uc,projectRoot:pe,onSwitch:Yc}),c.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:c.jsx(wq,{tabs:a,activeTab:l,onTabChange:Us,onOpenPalette:()=>on(U=>!U),badges:{gates:D.filter(U=>!U.resolvedAt).length}})}),c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!L&&c.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),c.jsx("button",{className:"compose-btn-icon",onClick:Xc,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:()=>Gs(-1),disabled:n<=Sd,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:()=>Gs(1),disabled:n>=Td,title:"Increase font size",children:"A+"})]}),c.jsx("button",{className:"compose-btn-icon",onClick:_a,disabled:n===zo,title:"Reset to default size",children:"100%"})]})]})}),c.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!Hs&&c.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[c.jsx(kr,{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:Xs,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:Tt}),f&&(q==="design"?c.jsx(uY,{decisions:e,sessionComplete:r==="complete",onReviseDecision:U=>Rn.getState().reviseDecision(U),widthPx:w}):c.jsx(Gy,{items:S,gates:D,activeBuild:ct,onViewChange:Ae,selectedPhase:Xt,onPhaseSelect:je,selectedTrack:xe,onTrackSelect:ye,visibleTracks:he,onToggleVisibleTrack:(U,ut)=>Oe(dt=>{if(!dt){const cr=new Set(ut);return cr.delete(U),cr}const ee=new Set(dt);return ee.has(U)?ee.delete(U):ee.add(U),ut&&ee.size>=ut.length?null:ee}),onShowAllTracks:()=>Oe(null),hiddenGroups:Rs,onToggleGroup:Ei,searchQuery:H,onSearchChange:rt,connected:L,agentActivity:O,agentErrors:$,spawnedAgents:B,agentRelays:T,sessionState:V,onSelectItem:Ue,onStopAgent:Ai,onThemeChange:$t,onNewItem:()=>Bi(!0),widthPx:w}))]})}),c.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[c.jsx(q2,{featureCode:ue,snapshot:ue?(Kt==null?void 0:Kt[ue])??null:null}),ue&&c.jsx(W2,{currentFeatureCode:ue}),c.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:c.jsx(kr,{children:c.jsx(AY,{activeView:q,items:S,filteredItems:Qn,phaseFilteredItems:tr,phaseFilteredGates:ln,connections:N,filteredConnections:Vc,sessions:vt,buildHistory:Jt,activeBuild:ct,pipelineDraft:it,gates:D,settings:xt,selectedPhase:Xt,selectedItemId:Pe,onSelect:Ue,onUpdate:R,onCreate:J,onCreateFeature:lt,isEmptyProject:Et,onDelete:It,onOpenGate:Ot,onCreateConnection:oS,onDeleteConnection:aS,onRefreshBuild:lS,onSelectStep:cS,onResolveGate:ht,onUpdateSettings:$t,onResetSettings:Ht,visibleTracks:he,hiddenGroups:Rs,buildStateMap:Gc,agentOverlay:wa,spawnedAgents:B,agentRelays:T,docsSelectedFile:te,onDocsSelectedFileChange:ge,docsPreviousView:Ne,onDocsBack:pS,projectRoot:pe,featureCode:ue,focusActive:zs,onToggleFocus:()=>Ni(U=>!U),sessionState:V,agentActivity:O,iterationStates:gt,focusedGateId:we,onFocusHandled:Hr})})})]}),q!=="docs"&&c.jsx(kr,{children:c.jsxs(zq,{isOpen:m,onToggle:ft,widthPx:C,onResizePx:at,activeBuild:ct,gates:D,agentErrors:$,items:S,children:[(g==null?void 0:g.type)==="item"&&c.jsx(NH,{itemId:g.id,onSelect:U=>{y({type:"item",id:U}),We(U)},onClose:()=>{y(null),We(null)},onOpenFile:dS,onViewInGraph:hS,onViewInTree:uS}),(g==null?void 0:g.type)==="step"&&c.jsx(PH,{stepId:g.id,tierEvents:ct==null?void 0:ct.tierEvents,healthEvents:(ct==null?void 0:ct.health_score)!=null?[{score:ct.health_score,breakdown:ct.health_breakdown,missing:ct.health_missing}]:void 0,capabilityEvents:ct==null?void 0:ct.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&c.jsx($H,{})]})}),ue&&q!=="docs"&&c.jsx(kr,{zone:"open loops panel",children:c.jsx(vY,{featureCode:ue,items:S,onAddLoop:Sa,onResolveLoop:Ta})})]}),c.jsx(kr,{zone:"ops strip",children:c.jsx(UH,{activeView:q,onSelectFeature:hn})}),c.jsx(kr,{zone:"agent bar",children:c.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",Hs?"flex-1 min-h-0":Lq(u)].join(" "),children:c.jsx(Dq,{barState:u,onStateChange:Mi})})})]}),c.jsx(kr,{zone:"notifications",children:c.jsx(CS,{})}),c.jsx(kr,{zone:"gate notifications",children:c.jsx(z2,{onOpenGate:Ot})}),c.jsx(kr,{zone:"challenge modal",children:Kn&&(()=>{const U=S.find(ut=>ut.id===Kn);return U?c.jsx(N2,{item:U,items:S,connections:N,onUpdate:R,onClose:()=>_r(null)}):null})()}),c.jsx(j2,{event:G,items:S,onNavigate:()=>Ae("gates")}),c.jsx(kr,{zone:"command palette",children:c.jsx(O2,{open:jn,onClose:()=>on(!1),onSelectItem:U=>{Ue(U),on(!1)},onSelectGate:U=>{Ot(U),on(!1)}})}),c.jsx(kr,{zone:"item form",children:c.jsx($2,{open:Ws,initialType:qs,onClose:()=>{Bi(!1),Li("task")}})}),c.jsx(kr,{zone:"settings",children:c.jsx(R2,{open:Hc,onClose:()=>Nn(!1),settings:xt,onSettingsChange:$t})})]})})})}const dV=Object.freeze(Object.defineProperty({__proto__:null,default:LY},Symbol.toStringTag,{value:"Module"}));export{vb as $,zY as A,On as B,m3 as C,Ce as D,eI as E,Yp as F,hb as G,BO as H,ID as I,RP as J,oM as K,Yo as L,$Y as M,Ac as N,FM as O,Cb as P,Um as Q,TD as R,Iu as S,EO as T,ua as U,Wr as V,K as W,Q as X,qM as Y,kO as Z,v as _,XM as a,sV as a$,kD as a0,Sp as a1,UY as a2,GY as a3,Oi as a4,ug as a5,hg as a6,KY as a7,XY as a8,VY as a9,QP as aA,VP as aB,tO as aC,ek as aD,KP as aE,lO as aF,aO as aG,oO as aH,hO as aI,cO as aJ,XP as aK,rk as aL,eO as aM,JP as aN,ZP as aO,nk as aP,WP as aQ,ar as aR,lo as aS,Vp as aT,hk as aU,ki as aV,fk as aW,eb as aX,C6 as aY,aV as aZ,cV as a_,qY as aa,HY as ab,YY as ac,ZY as ad,QY as ae,yR as af,gw as ag,lV as ah,Mt as ai,Zr as aj,Tn as ak,ya as al,U$ as am,H$ as an,Hp as ao,yt as ap,V$ as aq,$p as ar,Pp as as,hl as at,sO as au,iO as av,nO as aw,rO as ax,GP as ay,tk as az,GM as b,kt as b0,oV as b1,XR as b2,HR as b3,qR as b4,vD as b5,OY as b6,Cp as b7,In as b8,Xo as b9,ig as ba,e4 as bb,Ct as bc,mk as bd,fr as be,GF as bf,bp as bg,Db as bh,fa as bi,$b as bj,WY as bk,f3 as bl,dV as bm,Qt as c,qt as d,kb as e,Ie as f,QM as g,Cn as h,zr as i,UP as j,da as k,nt as l,dk as m,RY as n,uV as o,ZM as p,JM as q,hV as r,KM as s,zP as t,Pr as u,OR as v,MO as w,JY as x,ks as y,VM as z};
|