@smartmemory/compose 0.1.29-beta → 0.1.30-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +1 -0
  2. package/contracts/goal-result.json +128 -0
  3. package/contracts/judge-result.json +152 -0
  4. package/contracts/review-result.json +2 -2
  5. package/dist/assets/App-CB0U2nlm.js +768 -0
  6. package/dist/assets/arc-Ib57etRP.js +1 -0
  7. package/dist/assets/architectureDiagram-3BPJPVTR-3N4ul7Lp.js +36 -0
  8. package/dist/assets/blockDiagram-GPEHLZMM-iPkpmFIG.js +132 -0
  9. package/dist/assets/{c4Diagram-AHTNJAMY-Bo5yMBT9.js → c4Diagram-AAUBKEIU-BCKTL1Dk.js} +3 -3
  10. package/dist/assets/channel-Bd09RsPV.js +1 -0
  11. package/dist/assets/chunk-2J33WTMH-Daqe8HpE.js +1 -0
  12. package/dist/assets/{chunk-4BX2VUAB-BETV09jq.js → chunk-4BX2VUAB-BjnNKI2i.js} +1 -1
  13. package/dist/assets/chunk-55IACEB6-DRsniyrS.js +1 -0
  14. package/dist/assets/chunk-727SXJPM-BiShnVey.js +206 -0
  15. package/dist/assets/chunk-AQP2D5EJ-Dd9CkPhT.js +231 -0
  16. package/dist/assets/{chunk-FMBD7UC4-Dz2qczuu.js → chunk-FMBD7UC4-CrED-oPn.js} +1 -1
  17. package/dist/assets/chunk-ND2GUHAM-dk4lChMO.js +1 -0
  18. package/dist/assets/{chunk-QZHKN3VN-DPhBd22Q.js → chunk-QZHKN3VN-a1SBIOVJ.js} +1 -1
  19. package/dist/assets/classDiagram-4FO5ZUOK-D_vAH5lP.js +1 -0
  20. package/dist/assets/classDiagram-v2-Q7XG4LA2-D_vAH5lP.js +1 -0
  21. package/dist/assets/cose-bilkent-S5V4N54A-CXtbzn7R.js +1 -0
  22. package/dist/assets/dagre-BM42HDAG-By5-LlQC.js +4 -0
  23. package/dist/assets/{defaultLocale-DX6XiGOO.js → defaultLocale-CrowFXzY.js} +1 -1
  24. package/dist/assets/diagram-2AECGRRQ-BWFSnxuX.js +43 -0
  25. package/dist/assets/diagram-5GNKFQAL-DtyjjvQp.js +10 -0
  26. package/dist/assets/diagram-KO2AKTUF-D2Y15IJ0.js +3 -0
  27. package/dist/assets/diagram-LMA3HP47-CE-THjCD.js +24 -0
  28. package/dist/assets/diagram-OG6HWLK6-Blju-noD.js +24 -0
  29. package/dist/assets/{erDiagram-SMLLAGMA-DUT_laNT.js → erDiagram-TEJ5UH35-DI6ayS27.js} +1 -1
  30. package/dist/assets/{flowDiagram-DWJPFMVM-J9uyMWkp.js → flowDiagram-I6XJVG4X-BQf0uOzY.js} +4 -4
  31. package/dist/assets/ganttDiagram-6RSMTGT7-_upG_Ajl.js +292 -0
  32. package/dist/assets/gitGraphDiagram-PVQCEYII-5sVMQhO3.js +106 -0
  33. package/dist/assets/graph-BEmEBUp_.js +1 -0
  34. package/dist/assets/{graph-CfEl_ohV.js → graph-DPbJeZyN.js} +2 -2
  35. package/dist/assets/{index-D5Mh04yh.js → index-DLF-s4tP.js} +3 -3
  36. package/dist/assets/infoDiagram-5YYISTIA-4Hpw9ky_.js +2 -0
  37. package/dist/assets/{ishikawaDiagram-UXIWVN3A-BC7DwQNb.js → ishikawaDiagram-YF4QCWOH-CuHQNWRf.js} +5 -5
  38. package/dist/assets/{journeyDiagram-VCZTEJTY-BOCgv7m4.js → journeyDiagram-JHISSGLW-PFwOct4G.js} +1 -1
  39. package/dist/assets/{kanban-definition-6JOO6SKY-Fu0eFxr1.js → kanban-definition-UN3LZRKU-M70jtg2M.js} +7 -7
  40. package/dist/assets/katex-CQk2-UhE.js +257 -0
  41. package/dist/assets/layout-Bw0msyOw.js +1 -0
  42. package/dist/assets/linear-BkYLp90p.js +1 -0
  43. package/dist/assets/{mindmap-definition-QFDTVHPH-BPwx_SxA.js → mindmap-definition-RKZ34NQL-1KQv07E1.js} +10 -10
  44. package/dist/assets/{mobile-BOyZ87uL.js → mobile-CsuriFuT.js} +3 -3
  45. package/dist/assets/pieDiagram-4H26LBE5-B8lh9yMA.js +30 -0
  46. package/dist/assets/quadrantDiagram-W4KKPZXB-DUPV_-qJ.js +7 -0
  47. package/dist/assets/{requirementDiagram-MS252O5E-XlROD_VH.js → requirementDiagram-4Y6WPE33-ChYWhFld.js} +3 -3
  48. package/dist/assets/sankeyDiagram-5OEKKPKP-HsjvNkHR.js +40 -0
  49. package/dist/assets/sequenceDiagram-3UESZ5HK-CR5iTMTw.js +162 -0
  50. package/dist/assets/stateDiagram-AJRCARHV-BwMjQVHC.js +1 -0
  51. package/dist/assets/stateDiagram-v2-BHNVJYJU-X1hOVHVI.js +1 -0
  52. package/dist/assets/{timeline-definition-GMOUNBTQ-gdlx6TEB.js → timeline-definition-PNZ67QCA-BI88FufN.js} +3 -3
  53. package/dist/assets/vennDiagram-CIIHVFJN-BKg5ydB8.js +34 -0
  54. package/dist/assets/wardley-L42UT6IY-CtYx0E7z.js +173 -0
  55. package/dist/assets/wardleyDiagram-YWT4CUSO-CAColVNQ.js +78 -0
  56. package/dist/assets/{xychartDiagram-5P7HB3ND-CLgTTXkj.js → xychartDiagram-2RQKCTM6-CJqak-xY.js} +4 -4
  57. package/dist/index.html +2 -2
  58. package/package.json +1 -1
  59. package/dist/assets/App-DyRUFvbx.js +0 -768
  60. package/dist/assets/_baseUniq-6fxo8lI4.js +0 -1
  61. package/dist/assets/arc-ElMd2B94.js +0 -1
  62. package/dist/assets/architectureDiagram-Q4EWVU46-CYkxf4MU.js +0 -36
  63. package/dist/assets/blockDiagram-DXYQGD6D-BEbnyY6z.js +0 -132
  64. package/dist/assets/channel-BZuHuJYj.js +0 -1
  65. package/dist/assets/chunk-4TB4RGXK-Dbuohq0Y.js +0 -206
  66. package/dist/assets/chunk-55IACEB6-CDVuU3Ew.js +0 -1
  67. package/dist/assets/chunk-EDXVE4YY-DjkbltSG.js +0 -1
  68. package/dist/assets/chunk-OYMX7WX6-XJH4cbpv.js +0 -231
  69. package/dist/assets/chunk-YZCP3GAM-C-DPngtC.js +0 -1
  70. package/dist/assets/classDiagram-6PBFFD2Q-DTItsUL2.js +0 -1
  71. package/dist/assets/classDiagram-v2-HSJHXN6E-DTItsUL2.js +0 -1
  72. package/dist/assets/clone-BM9Hd7mq.js +0 -1
  73. package/dist/assets/cose-bilkent-S5V4N54A-CN-sdzRq.js +0 -1
  74. package/dist/assets/dagre-KV5264BT-HcBmaeC1.js +0 -4
  75. package/dist/assets/diagram-5BDNPKRD-DeMZN1_c.js +0 -10
  76. package/dist/assets/diagram-G4DWMVQ6-DAVSapDS.js +0 -24
  77. package/dist/assets/diagram-MMDJMWI5-WiLMNWTz.js +0 -43
  78. package/dist/assets/diagram-TYMM5635-CjfaWKT0.js +0 -24
  79. package/dist/assets/ganttDiagram-T4ZO3ILL-Cee_YjtS.js +0 -292
  80. package/dist/assets/gitGraphDiagram-UUTBAWPF-B1jNNoiW.js +0 -106
  81. package/dist/assets/graph-DV5DY72d.js +0 -1
  82. package/dist/assets/infoDiagram-42DDH7IO-m1jIMAlx.js +0 -2
  83. package/dist/assets/katex-DkKDou_j.js +0 -257
  84. package/dist/assets/layout-C-R3-tDf.js +0 -1
  85. package/dist/assets/linear-NOMW_E2I.js +0 -1
  86. package/dist/assets/min-B7SuZW29.js +0 -1
  87. package/dist/assets/pieDiagram-DEJITSTG-DdBjaXTu.js +0 -30
  88. package/dist/assets/quadrantDiagram-34T5L4WZ-D_K_ZMnx.js +0 -7
  89. package/dist/assets/sankeyDiagram-XADWPNL6-Sl0FllYQ.js +0 -10
  90. package/dist/assets/sequenceDiagram-FGHM5R23-D22asQ-_.js +0 -157
  91. package/dist/assets/stateDiagram-FHFEXIEX-BnCepkBg.js +0 -1
  92. package/dist/assets/stateDiagram-v2-QKLJ7IA2-DD_YjrTQ.js +0 -1
  93. package/dist/assets/vennDiagram-DHZGUBPP-wy4YzhrG.js +0 -34
  94. package/dist/assets/wardley-RL74JXVD-D0T_uQ79.js +0 -162
  95. package/dist/assets/wardleyDiagram-NUSXRM2D-Ds2dLjs8.js +0 -20
@@ -1,768 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-KV5264BT-HcBmaeC1.js","assets/graph-DV5DY72d.js","assets/_baseUniq-6fxo8lI4.js","assets/layout-C-R3-tDf.js","assets/min-B7SuZW29.js","assets/clone-BM9Hd7mq.js","assets/mobile-BOyZ87uL.js","assets/mobile-5PV1E6OC.css","assets/index-D5Mh04yh.js","assets/index-CHkeTiSt.css","assets/graph-CfEl_ohV.js","assets/cose-bilkent-S5V4N54A-CN-sdzRq.js","assets/c4Diagram-AHTNJAMY-Bo5yMBT9.js","assets/chunk-YZCP3GAM-C-DPngtC.js","assets/flowDiagram-DWJPFMVM-J9uyMWkp.js","assets/chunk-FMBD7UC4-Dz2qczuu.js","assets/chunk-55IACEB6-CDVuU3Ew.js","assets/chunk-EDXVE4YY-DjkbltSG.js","assets/channel-BZuHuJYj.js","assets/erDiagram-SMLLAGMA-DUT_laNT.js","assets/gitGraphDiagram-UUTBAWPF-B1jNNoiW.js","assets/chunk-4BX2VUAB-BETV09jq.js","assets/chunk-QZHKN3VN-DPhBd22Q.js","assets/wardley-RL74JXVD-D0T_uQ79.js","assets/ganttDiagram-T4ZO3ILL-Cee_YjtS.js","assets/linear-NOMW_E2I.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-m1jIMAlx.js","assets/pieDiagram-DEJITSTG-DdBjaXTu.js","assets/arc-ElMd2B94.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-34T5L4WZ-D_K_ZMnx.js","assets/xychartDiagram-5P7HB3ND-CLgTTXkj.js","assets/requirementDiagram-MS252O5E-XlROD_VH.js","assets/sequenceDiagram-FGHM5R23-D22asQ-_.js","assets/classDiagram-6PBFFD2Q-DTItsUL2.js","assets/chunk-4TB4RGXK-Dbuohq0Y.js","assets/classDiagram-v2-HSJHXN6E-DTItsUL2.js","assets/stateDiagram-FHFEXIEX-BnCepkBg.js","assets/chunk-OYMX7WX6-XJH4cbpv.js","assets/stateDiagram-v2-QKLJ7IA2-DD_YjrTQ.js","assets/journeyDiagram-VCZTEJTY-BOCgv7m4.js","assets/timeline-definition-GMOUNBTQ-gdlx6TEB.js","assets/mindmap-definition-QFDTVHPH-BPwx_SxA.js","assets/kanban-definition-6JOO6SKY-Fu0eFxr1.js","assets/sankeyDiagram-XADWPNL6-Sl0FllYQ.js","assets/diagram-TYMM5635-CjfaWKT0.js","assets/diagram-MMDJMWI5-WiLMNWTz.js","assets/blockDiagram-DXYQGD6D-BEbnyY6z.js","assets/diagram-5BDNPKRD-DeMZN1_c.js","assets/architectureDiagram-Q4EWVU46-CYkxf4MU.js","assets/ishikawaDiagram-UXIWVN3A-BC7DwQNb.js","assets/vennDiagram-DHZGUBPP-wy4YzhrG.js","assets/diagram-G4DWMVQ6-DAVSapDS.js","assets/wardleyDiagram-NUSXRM2D-Ds2dLjs8.js"])))=>i.map(i=>d[i]);
2
- var tE=Object.defineProperty;var eE=(t,e,r)=>e in t?tE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ne=(t,e,r)=>eE(t,typeof e!="symbol"?e+"":e,r);import{a as C,j as h,R as Vt,b as rE,g as Rc,w as $t,d as nE,e as wf,f as Do}from"./mobile-BOyZ87uL.js";import{r as iE,_ as Jt,u as sE}from"./index-D5Mh04yh.js";import{c as ma,b as $y,f as oE}from"./graph-CfEl_ohV.js";const mr={feature:"#3b82f6",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},qn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b"},aE=["planned","ready","in_progress","review","complete","blocked","parked","killed"],Ry=["vision","specification","planning","implementation","verification","release"],Rl={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},Sf=["Untested","Low","Moderate","High","Crystallized"],Se={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"},zy={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},Wy=["claude","codex","gemini","human","unassigned"],pm={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"},Mh=[{id:"explore_design",name:"Explore Design",agent:"claude",phase:"design",hasGate:!1},{id:"design_review",name:"Design Review",agent:"codex",phase:"design",hasGate:!1},{id:"design_gate",name:"Design Gate",agent:"human",phase:"design",hasGate:!0},{id:"prd",name:"PRD",agent:"claude",phase:"design",hasGate:!1},{id:"prd_review",name:"PRD Review",agent:"codex",phase:"design",hasGate:!1},{id:"prd_gate",name:"PRD Gate",agent:"human",phase:"design",hasGate:!0},{id:"architecture",name:"Architecture",agent:"claude",phase:"design",hasGate:!1},{id:"architecture_review",name:"Arch Review",agent:"codex",phase:"design",hasGate:!1},{id:"architecture_gate",name:"Arch Gate",agent:"human",phase:"design",hasGate:!0},{id:"blueprint",name:"Blueprint",agent:"claude",phase:"blueprint",hasGate:!1},{id:"verification",name:"Verification",agent:"claude",phase:"blueprint",hasGate:!1},{id:"blueprint_review",name:"BP Review",agent:"codex",phase:"blueprint",hasGate:!1},{id:"plan",name:"Plan",agent:"claude",phase:"implementation",hasGate:!1},{id:"plan_review",name:"Plan Review",agent:"codex",phase:"implementation",hasGate:!1},{id:"plan_gate",name:"Plan Gate",agent:"human",phase:"implementation",hasGate:!0},{id:"execute",name:"Execute",agent:"claude",phase:"implementation",hasGate:!1},{id:"review",name:"Review Loop",agent:"codex",phase:"implementation",hasGate:!1},{id:"coverage",name:"Coverage Sweep",agent:"claude",phase:"implementation",hasGate:!1},{id:"report",name:"Report",agent:"claude",phase:"ship",hasGate:!1},{id:"report_review",name:"Report Review",agent:"codex",phase:"ship",hasGate:!1},{id:"report_gate",name:"Report Gate",agent:"human",phase:"ship",hasGate:!0},{id:"docs",name:"Docs",agent:"claude",phase:"ship",hasGate:!1},{id:"ship",name:"Ship",agent:"claude",phase:"ship",hasGate:!1},{id:"ship_gate",name:"Ship Gate",agent:"human",phase:"ship",hasGate:!0}],kn={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 Zo(t,e){const r=kn[t.stepId]??(t.fromPhase&&t.toPhase?`${Se[t.fromPhase]??t.fromPhase} → ${Se[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const mm={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"}},lE={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%)"},gm={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},cE={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"},hE={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"}},uE={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},xm=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],dE={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},fE={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},pE={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},ym={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))"},qy={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 mE(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function gE(t){return`violations (${Array.isArray(t)?t.length:0})`}function xE(t){return t?"▾":"▸"}function yE({violations:t=[],expanded:e,onToggle:r}){const[n,i]=C.useState(!1),s=e!==void 0,o=s?e:n,a=mE(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const c=xE(o),u=gE(t);return h.jsxs("div",{style:{background:"hsl(38 90% 50% / 0.06)",borderLeft:"2px solid hsl(38 90% 50% / 0.3)",borderRadius:"3px",marginTop:"4px"},children:[h.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:[h.jsx("span",{style:{opacity:.7},children:c}),h.jsx("span",{children:u})]}),a==="expanded"&&h.jsx("ul",{style:{listStyle:"none",margin:0,padding:"0 8px 6px 16px"},children:t.map((d,p)=>h.jsx("li",{style:{color:"hsl(38 50% 60%)",fontSize:"10px",fontFamily:"monospace",lineHeight:"1.5"},children:d},p))})]})}function bE({msg:t,mode:e="stream"}){const[r,n]=C.useState(!1),i=t.retries??0,s=t.violations??[],o=s.length>0;return e==="strip"?i===0?null:h.jsx("span",{style:{background:"hsl(38 90% 50% / 0.2)",color:"hsl(38 90% 60%)",padding:"0 5px",borderRadius:"9999px",fontSize:"9px"},children:i}):h.jsxs("div",{className:"text-[10px] py-0.5",children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsxs("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.7},children:["step complete -- ",t.stepId]}),i>0&&h.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?h.jsxs("span",{onClick:()=>n(a=>!a),style:{color:"hsl(38 90% 60%)",fontSize:"10px",cursor:"pointer"},children:[s.length," ",s.length===1?"violation":"violations"]}):h.jsx("span",{style:{color:"hsl(var(--success, 142 60% 50%))",opacity:.4,fontSize:"10px"},children:"✓ checks passed"})]}),r&&o&&h.jsx(yE,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const CE=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,bm=20;function kE({summary:t,output:e}){const[r,n]=C.useState(!1),[i,s]=C.useState(!1),o=e?CE.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
3
- `):[],c=l.length>bm,u=r&&!i&&c?l.slice(0,bm):l,d=o?"hsl(var(--destructive, 0 84% 60%))":"hsl(215 20% 20%)";return a?h.jsxs("div",{style:{marginLeft:8,borderLeft:`1px solid ${d}`,paddingLeft:8,marginTop:2},children:[h.jsxs("div",{onClick:()=>n(p=>!p),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:[h.jsx("span",{style:{fontSize:9},children:r?"▾":"▸"}),t]}),r&&h.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(`
4
- `),!i&&c&&h.jsxs(h.Fragment,{children:[`
5
- `,h.jsxs("span",{onClick:p=>{p.stopPropagation(),s(!0)},style:{color:"hsl(var(--accent))",cursor:"pointer",textDecoration:"underline",fontSize:"10px"},children:["Show all (",l.length," lines)"]})]})]})]}):h.jsx("div",{style:{marginLeft:8,opacity:.6,fontSize:"10px",padding:"2px 0",color:"hsl(var(--muted-foreground))",fontFamily:"ui-monospace, monospace"},children:t})}const vE={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 wE(t){return lE[vE[t]||"thinking"]}function SE(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function TE(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function _E({input:t}){const[e,r]=C.useState(!1);if(!t||Object.keys(t).length===0)return null;const n=Object.keys(t)[0],i=String(t[n]??""),s=i.length>60?i.slice(0,57)+"…":i;return h.jsxs("div",{className:"mt-1",children:[h.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:[h.jsx("span",{style:{opacity:.6},children:e?"▾":"▸"}),!e&&h.jsxs("span",{style:{opacity:.6},children:[n,": ",s]}),e&&h.jsx("span",{style:{opacity:.6},children:"collapse"})]}),e&&h.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 EE({block:t}){const e=wE(t.name);return h.jsxs("div",{className:"rounded px-2 py-1.5 my-1",style:{background:"hsl(var(--muted) / 0.3)",borderLeft:`2px solid ${e}`},children:[h.jsx("div",{className:"flex items-center gap-1.5",children:h.jsx("span",{className:"text-[11px] font-semibold font-mono",style:{color:e},children:t.name})}),h.jsx(_E,{input:t.input})]})}function NE({msg:t}){var r;const e=((r=t.message)==null?void 0:r.content)??[];return h.jsx("div",{className:"flex flex-col gap-1 py-1",children:e.map((n,i)=>{if(n.type==="text")return h.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 h.jsxs(Vt.Fragment,{children:[h.jsx(EE,{block:n}),s&&t._toolResult&&h.jsx(kE,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function jE({msg:t}){const e=t.subtype!=="success",r=e?"hsl(var(--destructive))":"hsl(var(--success, 142 60% 50%))";return h.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:[h.jsx("span",{children:e?"✗ error":"✓ done"}),!e&&t.num_turns!=null&&h.jsxs("span",{style:{color:"hsl(var(--muted-foreground))"},children:[t.num_turns," turn",t.num_turns!==1?"s":""]}),t.duration_ms!=null&&h.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:SE(t.duration_ms)}),t.total_cost_usd!=null&&h.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:TE(t.total_cost_usd)}),e&&t.errors&&h.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function LE({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:h.jsx("div",{className:"flex justify-end py-1",children:h.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 BE({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 h.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:[h.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 h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-3 flex-wrap",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:[h.jsxs("span",{children:["session ",(e=t.session_id)==null?void 0:e.slice(0,8)]}),h.jsx("span",{children:t.model}),h.jsx("span",{children:t.permissionMode})]});if(t.type==="system"&&t.subtype==="connected")return h.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 h.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 h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1 flex gap-2",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsxs("span",{children:["step ",t.stepNum,"/",t.totalSteps]}),h.jsx("span",{className:"font-mono",children:t.stepId}),h.jsx("span",{style:{opacity:.5},children:t.agent})]});if(t.type==="system"&&t.subtype==="build_step_done")return h.jsx(bE,{msg:t,mode:"stream"});if(t.type==="system"&&t.subtype==="build_gate")return h.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 h.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 h.jsxs("div",{className:"text-[10px] uppercase tracking-wider py-1",style:{color:n},children:["build ",t.status," -- ",t.featureCode]})}return t.type==="assistant"?h.jsx(NE,{msg:t}):t.type==="user"?h.jsx(LE,{msg:t}):t.type==="result"?h.jsx(jE,{msg:t}):t.type==="error"?h.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 AE({onSend:t,disabled:e=!1,placeholder:r="Message Claude…"}){const n=C.useRef(null);C.useEffect(()=>{!e&&n.current&&n.current.focus()},[e]);function i(){const a=n.current;a&&(a.style.height="auto",a.style.height=`${Math.min(a.scrollHeight,160)}px`)}function s(a){a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())}function o(){const a=n.current;if(!a)return;const l=a.value.trim();l&&(t(l),a.value="",i())}return h.jsxs("div",{className:"flex items-end gap-2 px-3 py-2",style:{borderTop:"1px solid hsl(var(--border))"},children:[h.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"}}),h.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 Hy="compose:verboseStream",zl={verboseStream:!1};function Uy(){return zl.verboseStream}function ME(t,e){zl.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(Hy,String(zl.verboseStream))}catch{}}function IE(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(Hy);r!==null&&(zl.verboseStream=r==="true")}catch{}}function FE(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 PE(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(c=>c.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 Gy=parseInt("4002",10),DE="compose-agent-session",Cm=500,OE=8,$E=2e3,km={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"},RE={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};IE();const ht={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,onConnectedChange:null,onMessagesChange:null,onAgentStatusChange:null};function zE(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=km[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=km[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 Ih(t,e,r){const n=Date.now(),i=ht.agentStatus,s=ht.agentTool;if(ht._idleTimer&&(clearTimeout(ht._idleTimer),ht._idleTimer=null),i==="working"&&(t==="idle"||e!==s)){const a=ht.currentActivity;a&&(a.endTime=n,a.duration=n-a.startTime,ht.activityLog.push(a),ht.activityLog.length>OE&&ht.activityLog.shift())}t==="working"&&e!==s?ht.currentActivity={tool:e,category:r,startTime:n,endTime:null,duration:null}:t==="idle"&&(ht.currentActivity=null),ht.agentStatus=t,ht.agentTool=e,ht.agentCategory=r;const o={status:t,tool:e,category:r,activityLog:ht.activityLog,currentActivity:ht.currentActivity,parallelTasks:ht.parallelTasks};ht.onAgentStatusChange&&ht.onAgentStatusChange({...o}),window.dispatchEvent(new CustomEvent("compose:agent-status",{detail:o}))}function vm(){const t=ht.sourceStatus.build,e=ht.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?Ih(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?Ih(t.status,t.tool,t.category):ht._idleTimer=setTimeout(()=>{ht._idleTimer=null,Ih("idle",null,null)},$E)}function Xu(t){var i,s,o,a,l,c;t._source==="build"&&t.type==="system"&&t.parallel&&(t.subtype==="build_step"&&((i=t.stepNum)!=null&&i.toString().startsWith("∥"))?(ht.parallelTasks||(ht.parallelTasks={total:0,completed:0,failed:0,active:0,tasks:{}}),ht.parallelTasks.total++,ht.parallelTasks.active++,ht.parallelTasks.tasks[t.stepId]="working"):t.subtype==="build_step_done"&&((o=(s=ht.parallelTasks)==null?void 0:s.tasks)!=null&&o[t.stepId])?(ht.parallelTasks.active=Math.max(0,ht.parallelTasks.active-1),ht.parallelTasks.completed++,ht.parallelTasks.tasks[t.stepId]="complete"):t.subtype==="build_step_done"&&ht.parallelTasks&&!((a=t.stepNum)!=null&&a.toString().startsWith("∥"))&&(ht.parallelTasks=null)),t._source==="build"&&t.type==="error"&&((c=(l=ht.parallelTasks)==null?void 0:l.tasks)!=null&&c[t.stepId])&&(ht.parallelTasks.active=Math.max(0,ht.parallelTasks.active-1),ht.parallelTasks.failed++,ht.parallelTasks.tasks[t.stepId]="failed");const e=zE(t);if(e){const u=e._source==="build"?"build":"interactive";ht.sourceStatus[u]=e,e.status==="idle"?(ht.parallelTasks=null,vm()):(ht._idleTimer&&(clearTimeout(ht._idleTimer),ht._idleTimer=null),vm())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(ht.sessionId=t.session_id,sessionStorage.setItem(DE,t.session_id));const{include:r,msg:n}=FE(t,Uy());r&&(ht.messages=[...ht.messages,n],ht.messages.length>Cm&&(ht.messages=ht.messages.slice(-Cm)),ht.onMessagesChange&&ht.onMessagesChange(ht.messages))}function WE(){if(ht.es)return;const t=`${window.location.protocol}//${window.location.hostname}:${Gy}/api/agent/stream`,e=rE({url:t,namedEvents:["hydrate"],onOpen:()=>{ht.connected=!0,ht.sourceStatus.build=null,ht.onConnectedChange&&ht.onConnectedChange(!0)},onClose:()=>{ht.connected=!1,ht.onConnectedChange&&ht.onConnectedChange(!1)},onEvent:(r,n)=>{if(n==="hydrate"){if(Array.isArray(r))for(const i of r)Xu(i);return}Xu(r)},maxBackoffMs:8e3});ht.es=e}async function Fh(t,e){const r=await fetch(`${window.location.protocol}//${window.location.hostname}:${Gy}${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 wm(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 Vy(){var k;const[t,e]=C.useState(ht.connected),[r,n]=C.useState(ht.messages),[i,s]=C.useState({status:ht.agentStatus,tool:ht.agentTool,category:ht.agentCategory,activityLog:ht.activityLog,currentActivity:ht.currentActivity}),[o,a]=C.useState(!1),[l,c]=C.useState(null),u=C.useRef(null),d=r.length===0||r.every(S=>S.type==="system"&&(S.subtype==="init"||S.subtype==="connected"));C.useEffect(()=>(ht.onConnectedChange=e,ht.onMessagesChange=n,ht.onAgentStatusChange=s,()=>{ht.onConnectedChange=null,ht.onMessagesChange=null,ht.onAgentStatusChange=null}),[]),C.useEffect(()=>{WE()},[]),C.useEffect(()=>{var S;(S=u.current)==null||S.scrollIntoView({behavior:"smooth"})},[r.length]),C.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){c(null);return}const S=i.currentActivity.startTime,E=()=>c(Date.now()-S);E();const w=setInterval(E,1e3);return()=>clearInterval(w)},[i.status,(k=i.currentActivity)==null?void 0:k.startTime]);const p=C.useCallback(async S=>{a(!0);const E=S.match(/[A-Z]+-\d+/);E&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:E[0]}}));try{d||!ht.sessionId?await Fh("/api/agent/session",{prompt:S}):await Fh("/api/agent/message",{prompt:S})}catch(w){Xu({type:"error",message:`Failed to send: ${w.message}`})}finally{a(!1)}},[d]),f=C.useCallback(async()=>{try{await Fh("/api/agent/interrupt",{})}catch{}},[]),m=t&&(i.status==="working"||o),x=t?m?"#fbbf24":"hsl(var(--success, 142 60% 50%))":"hsl(var(--destructive))",g=i.category?RE[i.category]:null,y=t?m?g||"working":"idle":"offline",b=i.activityLog||[];return h.jsxs("div",{className:"relative w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[h.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:[h.jsx("div",{className:"flex items-center gap-0.5",children:t&&b.length>0&&b.slice(-5).map((S,E)=>h.jsx("div",{className:"h-1 rounded-full",title:`${S.tool||"thinking"} — ${wm(S.duration)}`,style:{width:Math.max(6,Math.min(20,(S.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+E/5*.5}},E))}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[m&&h.jsx("button",{onClick:f,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"}),h.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:x,animation:m?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"text-[10px] uppercase tracking-wider",style:{color:m?"#fbbf24":"hsl(var(--muted-foreground))"},children:y}),m&&i.tool&&h.jsx("span",{className:"text-[10px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:i.tool}),m&&l!=null&&h.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:wm(l)})]})]}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-2",style:{scrollBehavior:"smooth"},children:[r.length===0&&h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 opacity-40",children:[h.jsx("span",{className:"text-2xl",children:"⬡"}),h.jsx("span",{className:"text-xs uppercase tracking-widest",style:{color:"hsl(var(--muted-foreground))"},children:t?"ready":"connecting…"})]}),PE(r).map((S,E)=>h.jsx(BE,{msg:S},S.uuid||E)),h.jsx("div",{ref:u})]}),!t&&h.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:h.jsxs("div",{className:"flex flex-col items-center gap-3",children:[h.jsx("div",{className:"w-5 h-5 rounded-full animate-spin",style:{border:"2px solid hsl(var(--accent) / 0.2)",borderTopColor:"hsl(var(--accent))"}}),h.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:"connecting to agent server…"})]})}),h.jsx(AE,{onSend:p,disabled:m||!t,placeholder:m?"Working…":"Message Claude…"})]})}function qE(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const HE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,UE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GE={};function Sm(t,e){return(GE.jsx?UE:HE).test(t)}const VE=/[ \t\n\f\r]/g;function YE(t){return typeof t=="object"?t.type==="text"?Tm(t.value):!1:Tm(t)}function Tm(t){return t.replace(VE,"")===""}class ga{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}ga.prototype.normal={};ga.prototype.property={};ga.prototype.space=void 0;function Yy(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new ga(r,n,e)}function Ku(t){return t.toLowerCase()}class gr{constructor(e,r){this.attribute=r,this.property=e}}gr.prototype.attribute="";gr.prototype.booleanish=!1;gr.prototype.boolean=!1;gr.prototype.commaOrSpaceSeparated=!1;gr.prototype.commaSeparated=!1;gr.prototype.defined=!1;gr.prototype.mustUseProperty=!1;gr.prototype.number=!1;gr.prototype.overloadedBoolean=!1;gr.prototype.property="";gr.prototype.spaceSeparated=!1;gr.prototype.space=void 0;let XE=0;const Ht=Li(),je=Li(),Zu=Li(),ot=Li(),he=Li(),as=Li(),Tr=Li();function Li(){return 2**++XE}const Qu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ht,booleanish:je,commaOrSpaceSeparated:Tr,commaSeparated:as,number:ot,overloadedBoolean:Zu,spaceSeparated:he},Symbol.toStringTag,{value:"Module"})),Ph=Object.keys(Qu);class Tf extends gr{constructor(e,r,n,i){let s=-1;if(super(e,r),_m(this,"space",i),typeof n=="number")for(;++s<Ph.length;){const o=Ph[s];_m(this,Ph[s],(n&Qu[o])===Qu[o])}}}Tf.prototype.defined=!0;function _m(t,e,r){r&&(t[e]=r)}function zs(t){const e={},r={};for(const[n,i]of Object.entries(t.properties)){const s=new Tf(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Ku(n)]=n,r[Ku(s.attribute)]=n}return new ga(e,r,t.space)}const Xy=zs({properties:{ariaActiveDescendant:null,ariaAtomic:je,ariaAutoComplete:null,ariaBusy:je,ariaChecked:je,ariaColCount:ot,ariaColIndex:ot,ariaColSpan:ot,ariaControls:he,ariaCurrent:null,ariaDescribedBy:he,ariaDetails:null,ariaDisabled:je,ariaDropEffect:he,ariaErrorMessage:null,ariaExpanded:je,ariaFlowTo:he,ariaGrabbed:je,ariaHasPopup:null,ariaHidden:je,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:he,ariaLevel:ot,ariaLive:null,ariaModal:je,ariaMultiLine:je,ariaMultiSelectable:je,ariaOrientation:null,ariaOwns:he,ariaPlaceholder:null,ariaPosInSet:ot,ariaPressed:je,ariaReadOnly:je,ariaRelevant:null,ariaRequired:je,ariaRoleDescription:he,ariaRowCount:ot,ariaRowIndex:ot,ariaRowSpan:ot,ariaSelected:je,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 Ky(t,e){return e in t?t[e]:e}function Zy(t,e){return Ky(t,e.toLowerCase())}const KE=zs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:as,acceptCharset:he,accessKey:he,action:null,allow:null,allowFullScreen:Ht,allowPaymentRequest:Ht,allowUserMedia:Ht,alt:null,as:null,async:Ht,autoCapitalize:null,autoComplete:he,autoFocus:Ht,autoPlay:Ht,blocking:he,capture:null,charSet:null,checked:Ht,cite:null,className:he,cols:ot,colSpan:null,content:null,contentEditable:je,controls:Ht,controlsList:he,coords:ot|as,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ht,defer:Ht,dir:null,dirName:null,disabled:Ht,download:Zu,draggable:je,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ht,formTarget:null,headers:he,height:ot,hidden:Zu,high:ot,href:null,hrefLang:null,htmlFor:he,httpEquiv:he,id:null,imageSizes:null,imageSrcSet:null,inert:Ht,inputMode:null,integrity:null,is:null,isMap:Ht,itemId:null,itemProp:he,itemRef:he,itemScope:Ht,itemType:he,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ht,low:ot,manifest:null,max:null,maxLength:ot,media:null,method:null,min:null,minLength:ot,multiple:Ht,muted:Ht,name:null,nonce:null,noModule:Ht,noValidate:Ht,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:Ht,optimum:ot,pattern:null,ping:he,placeholder:null,playsInline:Ht,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ht,referrerPolicy:null,rel:he,required:Ht,reversed:Ht,rows:ot,rowSpan:ot,sandbox:he,scope:null,scoped:Ht,seamless:Ht,selected:Ht,shadowRootClonable:Ht,shadowRootDelegatesFocus:Ht,shadowRootMode:null,shape:null,size:ot,sizes:null,slot:null,span:ot,spellCheck:je,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:Ht,useMap:null,value:je,width:ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:he,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:Ht,declare:Ht,event:null,face:null,frame:null,frameBorder:null,hSpace:ot,leftMargin:ot,link:null,longDesc:null,lowSrc:null,marginHeight:ot,marginWidth:ot,noResize:Ht,noHref:Ht,noShade:Ht,noWrap:Ht,object:null,profile:null,prompt:null,rev:null,rightMargin:ot,rules:null,scheme:null,scrolling:je,standby:null,summary:null,text:null,topMargin:ot,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ot,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ht,disableRemotePlayback:Ht,prefix:null,property:null,results:ot,security:null,unselectable:null},space:"html",transform:Zy}),ZE=zs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Tr,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:he,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:Ht,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:as,g2:as,glyphName:as,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:Tr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ot,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ot,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ot,overlineThickness:ot,paintOrder:null,panose1:null,path:null,pathLength:ot,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:he,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ot,pointsAtY:ot,pointsAtZ:ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tr,rev:Tr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tr,requiredFeatures:Tr,requiredFonts:Tr,requiredFormats:Tr,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:Tr,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:Tr,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:Tr,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:Ky}),Qy=zs({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()}}),Jy=zs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zy}),tb=zs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),QE={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"},JE=/[A-Z]/g,Em=/-[a-z]/g,tN=/^data[-\w.:]+$/i;function eN(t,e){const r=Ku(e);let n=e,i=gr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&tN.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Em,nN);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Em.test(s)){let o=s.replace(JE,rN);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Tf}return new i(n,e)}function rN(t){return"-"+t.toLowerCase()}function nN(t){return t.charAt(1).toUpperCase()}const iN=Yy([Xy,KE,Qy,Jy,tb],"html"),_f=Yy([Xy,ZE,Qy,Jy,tb],"svg");function sN(t){return t.join(" ").trim()}var Ri={},Dh,Nm;function oN(){if(Nm)return Dh;Nm=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=`
6
- `,c="/",u="*",d="",p="comment",f="declaration";function m(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var b=1,k=1;function S(O){var I=O.match(e);I&&(b+=I.length);var M=O.lastIndexOf(l);k=~M?O.length-M:k+O.length}function E(){var O={line:b,column:k};return function(I){return I.position=new w(O),F(),I}}function w(O){this.start=O,this.end={line:b,column:k},this.source=y.source}w.prototype.content=g;function T(O){var I=new Error(y.source+":"+b+":"+k+": "+O);if(I.reason=O,I.filename=y.source,I.line=b,I.column=k,I.source=g,!y.silent)throw I}function N(O){var I=O.exec(g);if(I){var M=I[0];return S(M),g=g.slice(M.length),I}}function F(){N(r)}function L(O){var I;for(O=O||[];I=B();)I!==!1&&O.push(I);return O}function B(){var O=E();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var I=2;d!=g.charAt(I)&&(u!=g.charAt(I)||c!=g.charAt(I+1));)++I;if(I+=2,d===g.charAt(I-1))return T("End of comment missing");var M=g.slice(2,I-2);return k+=2,S(M),g=g.slice(I),k+=2,O({type:p,comment:M})}}function W(){var O=E(),I=N(n);if(I){if(B(),!N(i))return T("property missing ':'");var M=N(s),P=O({type:f,property:x(I[0].replace(t,d)),value:M?x(M[0].replace(t,d)):d});return N(o),P}}function G(){var O=[];L(O);for(var I;I=W();)I!==!1&&(O.push(I),L(O));return O}return F(),G()}function x(g){return g?g.replace(a,d):d}return Dh=m,Dh}var jm;function aN(){if(jm)return Ri;jm=1;var t=Ri&&Ri.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.default=r;const e=t(oN());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:c,value:u}=l;a?i(c,u,l):u&&(s=s||{},s[c]=u)}),s}return Ri}var no={},Lm;function lN(){if(Lm)return no;Lm=1,Object.defineProperty(no,"__esModule",{value:!0}),no.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||r.test(c)||t.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),s(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,a):c=c.replace(n,a),c.replace(e,o))};return no.camelCase=l,no}var io,Bm;function cN(){if(Bm)return io;Bm=1;var t=io&&io.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(aN()),r=lN();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,io=n,io}var hN=cN();const uN=Rc(hN),eb=rb("end"),Ef=rb("start");function rb(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 dN(t){const e=Ef(t),r=eb(t);if(e&&r)return{start:e,end:r}}function Oo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Am(t.position):"start"in t||"end"in t?Am(t):"line"in t||"column"in t?Ju(t):""}function Ju(t){return Mm(t&&t.line)+":"+Mm(t&&t.column)}function Am(t){return Ju(t&&t.start)+"-"+Ju(t&&t.end)}function Mm(t){return t&&typeof t=="number"?t:1}class Ye 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=Oo(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}}Ye.prototype.file="";Ye.prototype.name="";Ye.prototype.reason="";Ye.prototype.message="";Ye.prototype.stack="";Ye.prototype.column=void 0;Ye.prototype.line=void 0;Ye.prototype.ancestors=void 0;Ye.prototype.cause=void 0;Ye.prototype.fatal=void 0;Ye.prototype.place=void 0;Ye.prototype.ruleId=void 0;Ye.prototype.source=void 0;const Nf={}.hasOwnProperty,fN=new Map,pN=/[A-Z]/g,mN=new Set(["table","tbody","thead","tfoot","tr"]),gN=new Set(["td","th"]),nb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function xN(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=TN(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=SN(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"?_f:iN,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=ib(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function ib(t,e,r){if(e.type==="element")return yN(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return bN(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return kN(t,e,r);if(e.type==="mdxjsEsm")return CN(t,e);if(e.type==="root")return vN(t,e,r);if(e.type==="text")return wN(t,e)}function yN(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=_f,t.schema=i),t.ancestors.push(e);const s=ob(t,e.tagName,!1),o=_N(t,e);let a=Lf(t,e);return mN.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!YE(l):!0})),sb(t,o,s,e),jf(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function bN(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)}Qo(t,e.position)}function CN(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Qo(t,e.position)}function kN(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=_f,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:ob(t,e.name,!0),o=EN(t,e),a=Lf(t,e);return sb(t,o,s,e),jf(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function vN(t,e,r){const n={};return jf(n,Lf(t,e)),t.create(e,t.Fragment,n,r)}function wN(t,e){return e.value}function sb(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function jf(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function SN(t,e,r){return n;function n(i,s,o,a){const c=Array.isArray(o.children)?r:e;return a?c(s,o,a):c(s,o)}}function TN(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=Ef(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 _N(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&Nf.call(e.properties,i)){const s=NN(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&gN.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 EN(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 Qo(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 Qo(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function Lf(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:fN;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 c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=ib(t,s,o);a!==void 0&&r.push(a)}return r}function NN(t,e,r){const n=eN(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?qE(r):sN(r)),n.property==="style"){let i=typeof r=="object"?r:jN(t,String(r));return t.stylePropertyNameCase==="css"&&(i=LN(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?QE[n.property]||n.property:n.attribute,r]}}function jN(t,e){try{return uN(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Ye("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=nb+"#cannot-parse-style-attribute",i}}function ob(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=Sm(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=Sm(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return Nf.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Qo(t)}function Qo(t,e){const r=new Ye("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=nb+"#cannot-handle-mdx-estrees-without-createevaluater",r}function LN(t){const e={};let r;for(r in t)Nf.call(t,r)&&(e[BN(r)]=t[r]);return e}function BN(t){let e=t.replace(pN,AN);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function AN(t){return"-"+t.toLowerCase()}const Oh={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"]},MN={};function Bf(t,e){const r=MN,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return ab(t,n,i)}function ab(t,e,r){if(IN(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Im(t.children,e,r)}return Array.isArray(t)?Im(t,e,r):""}function Im(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=ab(t[i],e,r);return n.join("")}function IN(t){return!!(t&&typeof t=="object")}const Fm=document.createElement("i");function Af(t){const e="&"+t+";";Fm.innerHTML=e;const r=Fm.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function _r(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 Ar(t,e){return t.length>0?(_r(t,t.length,0,e),t):e}const Pm={}.hasOwnProperty;function lb(t){const e={};let r=-1;for(;++r<t.length;)FN(e,t[r]);return e}function FN(t,e){let r;for(r in e){const i=(Pm.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){Pm.call(i,o)||(i[o]=[]);const a=s[o];PN(i[o],Array.isArray(a)?a:a?[a]:[])}}}function PN(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);_r(t,0,0,n)}function cb(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 qr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Qe=Kn(/[A-Za-z]/),Ge=Kn(/[\dA-Za-z]/),DN=Kn(/[#-'*+\--9=?A-Z^-~]/);function Wl(t){return t!==null&&(t<32||t===127)}const td=Kn(/\d/),ON=Kn(/[\dA-Fa-f]/),$N=Kn(/[!-/:-@[-`{-~]/);function Bt(t){return t!==null&&t<-2}function ce(t){return t!==null&&(t<0||t===32)}function Xt(t){return t===-2||t===-1||t===32}const zc=Kn(new RegExp("\\p{P}|\\p{S}","u")),bi=Kn(/\s/);function Kn(t){return e;function e(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function Ws(t){const e=[];let r=-1,n=0,i=0;for(;++r<t.length;){const s=t.charCodeAt(r);let o="";if(s===37&&Ge(t.charCodeAt(r+1))&&Ge(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 Qt(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Xt(l)?(t.enter(r),a(l)):e(l)}function a(l){return Xt(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const RN={tokenize:zN};function zN(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"),Qt(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 Bt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const WN={tokenize:qN},Dm={tokenize:HN};function qN(t){const e=this,r=[];let n=0,i,s,o;return a;function a(k){if(n<r.length){const S=r[n];return e.containerState=S[1],t.attempt(S[0].continuation,l,c)(k)}return c(k)}function l(k){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();const S=e.events.length;let E=S,w;for(;E--;)if(e.events[E][0]==="exit"&&e.events[E][1].type==="chunkFlow"){w=e.events[E][1].end;break}y(n);let T=S;for(;T<e.events.length;)e.events[T][1].end={...w},T++;return _r(e.events,E+1,0,e.events.slice(S)),e.events.length=T,c(k)}return a(k)}function c(k){if(n===r.length){if(!i)return p(k);if(i.currentConstruct&&i.currentConstruct.concrete)return m(k);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Dm,u,d)(k)}function u(k){return i&&b(),y(n),p(k)}function d(k){return e.parser.lazy[e.now().line]=n!==r.length,o=e.now().offset,m(k)}function p(k){return e.containerState={},t.attempt(Dm,f,m)(k)}function f(k){return n++,r.push([e.currentConstruct,e.containerState]),p(k)}function m(k){if(k===null){i&&b(),y(0),t.consume(k);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(k)}function x(k){if(k===null){g(t.exit("chunkFlow"),!0),y(0),t.consume(k);return}return Bt(k)?(t.consume(k),g(t.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(t.consume(k),x)}function g(k,S){const E=e.sliceStream(k);if(S&&E.push(null),k.previous=s,s&&(s.next=k),s=k,i.defineSkip(k.start),i.write(E),e.parser.lazy[k.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<o&&(!i.events[w][1].end||i.events[w][1].end.offset>o))return;const T=e.events.length;let N=T,F,L;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){if(F){L=e.events[N][1].end;break}F=!0}for(y(n),w=T;w<e.events.length;)e.events[w][1].end={...L},w++;_r(e.events,N+1,0,e.events.slice(T)),e.events.length=w}}function y(k){let S=r.length;for(;S-- >k;){const E=r[S];e.containerState=E[1],E[0].exit.call(e,t)}r.length=k}function b(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function HN(t,e,r){return Qt(t,t.attempt(this.parser.constructs.document,e,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ns(t){if(t===null||ce(t)||bi(t))return 1;if(zc(t))return 2}function Wc(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 ed={name:"attention",resolveAll:UN,tokenize:GN};function UN(t,e){let r=-1,n,i,s,o,a,l,c,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},p={...t[r][1].start};Om(d,-l),Om(p,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:p},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},c=[],t[n][1].end.offset-t[n][1].start.offset&&(c=Ar(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Ar(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Ar(c,Wc(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=Ar(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[r][1].end.offset-t[r][1].start.offset?(u=2,c=Ar(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,_r(t,n-1,r-n+3,c),r=n+c.length-u-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function GN(t,e){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,i=Ns(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 c=t.exit("attentionSequence"),u=Ns(l),d=!u||u===2&&i||r.includes(l),p=!i||i===2&&u||r.includes(n);return c._open=!!(s===42?d:d&&(i||!p)),c._close=!!(s===42?p:p&&(u||!d)),e(l)}}function Om(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const VN={name:"autolink",tokenize:YN};function YN(t,e,r){let n=0;return i;function i(f){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(f){return Qe(f)?(t.consume(f),o):f===64?r(f):c(f)}function o(f){return f===43||f===45||f===46||Ge(f)?(n=1,a(f)):c(f)}function a(f){return f===58?(t.consume(f),n=0,l):(f===43||f===45||f===46||Ge(f))&&n++<32?(t.consume(f),a):(n=0,c(f))}function l(f){return f===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):f===null||f===32||f===60||Wl(f)?r(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):DN(f)?(t.consume(f),c):r(f)}function u(f){return Ge(f)?d(f):r(f)}function d(f){return f===46?(t.consume(f),n=0,u):f===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(f),t.exit("autolinkMarker"),t.exit("autolink"),e):p(f)}function p(f){if((f===45||Ge(f))&&n++<63){const m=f===45?p:d;return t.consume(f),m}return r(f)}}const xa={partial:!0,tokenize:XN};function XN(t,e,r){return n;function n(s){return Xt(s)?Qt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Bt(s)?e(s):r(s)}}const hb={continuation:{tokenize:ZN},exit:QN,name:"blockQuote",tokenize:KN};function KN(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 Xt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function ZN(t,e,r){const n=this;return i;function i(o){return Xt(o)?Qt(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(hb,e,r)(o)}}function QN(t){t.exit("blockQuote")}const ub={name:"characterEscape",tokenize:JN};function JN(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 $N(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const db={name:"characterReference",tokenize:tj};function tj(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"),c):(t.enter("characterReferenceValue"),s=31,o=Ge,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=ON,u):(t.enter("characterReferenceValue"),s=7,o=td,u(d))}function u(d){if(d===59&&i){const p=t.exit("characterReferenceValue");return o===Ge&&!Af(n.sliceSerialize(p))?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 $m={partial:!0,tokenize:rj},Rm={concrete:!0,name:"codeFenced",tokenize:ej};function ej(t,e,r){const n=this,i={partial:!0,tokenize:E};let s=0,o=0,a;return l;function l(w){return c(w)}function c(w){const T=n.events[n.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=w,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===a?(o++,t.consume(w),u):o<3?r(w):(t.exit("codeFencedFenceSequence"),Xt(w)?Qt(t,d,"whitespace")(w):d(w))}function d(w){return w===null||Bt(w)?(t.exit("codeFencedFence"),n.interrupt?e(w):t.check($m,x,S)(w)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||Bt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(w)):Xt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Qt(t,f,"whitespace")(w)):w===96&&w===a?r(w):(t.consume(w),p)}function f(w){return w===null||Bt(w)?d(w):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||Bt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(w)):w===96&&w===a?r(w):(t.consume(w),m)}function x(w){return t.attempt(i,S,g)(w)}function g(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),y}function y(w){return s>0&&Xt(w)?Qt(t,b,"linePrefix",s+1)(w):b(w)}function b(w){return w===null||Bt(w)?t.check($m,x,S)(w):(t.enter("codeFlowValue"),k(w))}function k(w){return w===null||Bt(w)?(t.exit("codeFlowValue"),b(w)):(t.consume(w),k)}function S(w){return t.exit("codeFenced"),e(w)}function E(w,T,N){let F=0;return L;function L(I){return w.enter("lineEnding"),w.consume(I),w.exit("lineEnding"),B}function B(I){return w.enter("codeFencedFence"),Xt(I)?Qt(w,W,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):W(I)}function W(I){return I===a?(w.enter("codeFencedFenceSequence"),G(I)):N(I)}function G(I){return I===a?(F++,w.consume(I),G):F>=o?(w.exit("codeFencedFenceSequence"),Xt(I)?Qt(w,O,"whitespace")(I):O(I)):N(I)}function O(I){return I===null||Bt(I)?(w.exit("codeFencedFence"),T(I)):N(I)}}}function rj(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 $h={name:"codeIndented",tokenize:ij},nj={partial:!0,tokenize:sj};function ij(t,e,r){const n=this;return i;function i(c){return t.enter("codeIndented"),Qt(t,s,"linePrefix",5)(c)}function s(c){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):r(c)}function o(c){return c===null?l(c):Bt(c)?t.attempt(nj,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Bt(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function sj(t,e,r){const n=this;return i;function i(o){return n.parser.lazy[n.now().line]?r(o):Bt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Qt(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):Bt(o)?i(o):r(o)}}const oj={name:"codeText",previous:lj,resolve:aj,tokenize:cj};function aj(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 lj(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function cj(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)):Bt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Bt(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),i++,u):i===n?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",c(d))}}class hj{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&&so(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),so(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),so(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);so(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);so(this.left,r.reverse())}}}function so(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 fb(t){const e={};let r=-1,n,i,s,o,a,l,c;const u=new hj(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,uj(u,r)),r=e[r],c=!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 _r(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function uj(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=[],c={};let u,d,p=-1,f=r,m=0,x=0;const g=[x];for(;f;){for(;t.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=n.sliceStream(f),f.next||u.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=r;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(x=p+1,g.push(x),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),p=g.length;p--;){const y=a.slice(g[p],g[p+1]),b=s.pop();l.push([b,b+y.length-1]),t.splice(b,2,y)}for(l.reverse(),p=-1;++p<l.length;)c[m+l[p][0]]=m+l[p][1],m+=l[p][1]-l[p][0]-1;return c}const dj={resolve:pj,tokenize:mj},fj={partial:!0,tokenize:gj};function pj(t){return fb(t),t}function mj(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):Bt(a)?t.check(fj,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 gj(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Qt(t,s,"linePrefix")}function s(o){if(o===null||Bt(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 pb(t,e,r,n,i,s,o,a,l){const c=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),p):y===null||y===32||y===41||Wl(y)?r(y):(t.enter(n),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),x(y))}function p(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"}),f(y))}function f(y){return y===62?(t.exit("chunkString"),t.exit(a),p(y)):y===null||y===60||Bt(y)?r(y):(t.consume(y),y===92?m:f)}function m(y){return y===60||y===62||y===92?(t.consume(y),f):f(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<c&&y===40?(t.consume(y),u++,x):y===41?(t.consume(y),u--,x):y===null||y===32||y===40||Wl(y)?r(y):(t.consume(y),y===92?g:x)}function g(y){return y===40||y===41||y===92?(t.consume(y),x):x(y)}}function mb(t,e,r,n,i,s){const o=this;let a=0,l;return c;function c(f){return t.enter(n),t.enter(i),t.consume(f),t.exit(i),t.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?r(f):f===93?(t.exit(s),t.enter(i),t.consume(f),t.exit(i),t.exit(n),e):Bt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Bt(f)||a++>999?(t.exit("chunkString"),u(f)):(t.consume(f),l||(l=!Xt(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function gb(t,e,r,n,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(t.enter(n),t.enter(i),t.consume(p),t.exit(i),o=p===40?41:p,l):r(p)}function l(p){return p===o?(t.enter(i),t.consume(p),t.exit(i),t.exit(n),e):(t.enter(s),c(p))}function c(p){return p===o?(t.exit(s),l(o)):p===null?r(p):Bt(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Qt(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===o||p===null||Bt(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?d:u)}function d(p){return p===o||p===92?(t.consume(p),u):u(p)}}function $o(t,e){let r;return n;function n(i){return Bt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Xt(i)?Qt(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const xj={name:"definition",tokenize:bj},yj={partial:!0,tokenize:Cj};function bj(t,e,r){const n=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return mb.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=qr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),f===58?(t.enter("definitionMarker"),t.consume(f),t.exit("definitionMarker"),l):r(f)}function l(f){return ce(f)?$o(t,c)(f):c(f)}function c(f){return pb(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(yj,d,d)(f)}function d(f){return Xt(f)?Qt(t,p,"whitespace")(f):p(f)}function p(f){return f===null||Bt(f)?(t.exit("definition"),n.parser.defined.push(i),e(f)):r(f)}}function Cj(t,e,r){return n;function n(a){return ce(a)?$o(t,i)(a):r(a)}function i(a){return gb(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Xt(a)?Qt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Bt(a)?e(a):r(a)}}const kj={name:"hardBreakEscape",tokenize:vj};function vj(t,e,r){return n;function n(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Bt(s)?(t.exit("hardBreakEscape"),e(s)):r(s)}}const wj={name:"headingAtx",resolve:Sj,tokenize:Tj};function Sj(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"},_r(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function Tj(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||Bt(u)?(t.exit("atxHeading"),e(u)):Xt(u)?Qt(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||ce(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const _j=["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"],zm=["pre","script","style","textarea"],Ej={concrete:!0,name:"htmlFlow",resolveTo:Lj,tokenize:Bj},Nj={partial:!0,tokenize:Mj},jj={partial:!0,tokenize:Aj};function Lj(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 Bj(t,e,r){const n=this;let i,s,o,a,l;return c;function c(A){return u(A)}function u(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),d}function d(A){return A===33?(t.consume(A),p):A===47?(t.consume(A),s=!0,x):A===63?(t.consume(A),i=3,n.interrupt?e:_):Qe(A)?(t.consume(A),o=String.fromCharCode(A),g):r(A)}function p(A){return A===45?(t.consume(A),i=2,f):A===91?(t.consume(A),i=5,a=0,m):Qe(A)?(t.consume(A),i=4,n.interrupt?e:_):r(A)}function f(A){return A===45?(t.consume(A),n.interrupt?e:_):r(A)}function m(A){const ct="CDATA[";return A===ct.charCodeAt(a++)?(t.consume(A),a===ct.length?n.interrupt?e:W:m):r(A)}function x(A){return Qe(A)?(t.consume(A),o=String.fromCharCode(A),g):r(A)}function g(A){if(A===null||A===47||A===62||ce(A)){const ct=A===47,st=o.toLowerCase();return!ct&&!s&&zm.includes(st)?(i=1,n.interrupt?e(A):W(A)):_j.includes(o.toLowerCase())?(i=6,ct?(t.consume(A),y):n.interrupt?e(A):W(A)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):s?b(A):k(A))}return A===45||Ge(A)?(t.consume(A),o+=String.fromCharCode(A),g):r(A)}function y(A){return A===62?(t.consume(A),n.interrupt?e:W):r(A)}function b(A){return Xt(A)?(t.consume(A),b):L(A)}function k(A){return A===47?(t.consume(A),L):A===58||A===95||Qe(A)?(t.consume(A),S):Xt(A)?(t.consume(A),k):L(A)}function S(A){return A===45||A===46||A===58||A===95||Ge(A)?(t.consume(A),S):E(A)}function E(A){return A===61?(t.consume(A),w):Xt(A)?(t.consume(A),E):k(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(t.consume(A),l=A,T):Xt(A)?(t.consume(A),w):N(A)}function T(A){return A===l?(t.consume(A),l=null,F):A===null||Bt(A)?r(A):(t.consume(A),T)}function N(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||ce(A)?E(A):(t.consume(A),N)}function F(A){return A===47||A===62||Xt(A)?k(A):r(A)}function L(A){return A===62?(t.consume(A),B):r(A)}function B(A){return A===null||Bt(A)?W(A):Xt(A)?(t.consume(A),B):r(A)}function W(A){return A===45&&i===2?(t.consume(A),M):A===60&&i===1?(t.consume(A),P):A===62&&i===4?(t.consume(A),R):A===63&&i===3?(t.consume(A),_):A===93&&i===5?(t.consume(A),D):Bt(A)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Nj,X,G)(A)):A===null||Bt(A)?(t.exit("htmlFlowData"),G(A)):(t.consume(A),W)}function G(A){return t.check(jj,O,X)(A)}function O(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),I}function I(A){return A===null||Bt(A)?G(A):(t.enter("htmlFlowData"),W(A))}function M(A){return A===45?(t.consume(A),_):W(A)}function P(A){return A===47?(t.consume(A),o="",$):W(A)}function $(A){if(A===62){const ct=o.toLowerCase();return zm.includes(ct)?(t.consume(A),R):W(A)}return Qe(A)&&o.length<8?(t.consume(A),o+=String.fromCharCode(A),$):W(A)}function D(A){return A===93?(t.consume(A),_):W(A)}function _(A){return A===62?(t.consume(A),R):A===45&&i===2?(t.consume(A),_):W(A)}function R(A){return A===null||Bt(A)?(t.exit("htmlFlowData"),X(A)):(t.consume(A),R)}function X(A){return t.exit("htmlFlow"),e(A)}}function Aj(t,e,r){const n=this;return i;function i(o){return Bt(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 Mj(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(xa,e,r)}}const Ij={name:"htmlText",tokenize:Fj};function Fj(t,e,r){const n=this;let i,s,o;return a;function a(_){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(_),l}function l(_){return _===33?(t.consume(_),c):_===47?(t.consume(_),E):_===63?(t.consume(_),k):Qe(_)?(t.consume(_),N):r(_)}function c(_){return _===45?(t.consume(_),u):_===91?(t.consume(_),s=0,m):Qe(_)?(t.consume(_),b):r(_)}function u(_){return _===45?(t.consume(_),f):r(_)}function d(_){return _===null?r(_):_===45?(t.consume(_),p):Bt(_)?(o=d,P(_)):(t.consume(_),d)}function p(_){return _===45?(t.consume(_),f):d(_)}function f(_){return _===62?M(_):_===45?p(_):d(_)}function m(_){const R="CDATA[";return _===R.charCodeAt(s++)?(t.consume(_),s===R.length?x:m):r(_)}function x(_){return _===null?r(_):_===93?(t.consume(_),g):Bt(_)?(o=x,P(_)):(t.consume(_),x)}function g(_){return _===93?(t.consume(_),y):x(_)}function y(_){return _===62?M(_):_===93?(t.consume(_),y):x(_)}function b(_){return _===null||_===62?M(_):Bt(_)?(o=b,P(_)):(t.consume(_),b)}function k(_){return _===null?r(_):_===63?(t.consume(_),S):Bt(_)?(o=k,P(_)):(t.consume(_),k)}function S(_){return _===62?M(_):k(_)}function E(_){return Qe(_)?(t.consume(_),w):r(_)}function w(_){return _===45||Ge(_)?(t.consume(_),w):T(_)}function T(_){return Bt(_)?(o=T,P(_)):Xt(_)?(t.consume(_),T):M(_)}function N(_){return _===45||Ge(_)?(t.consume(_),N):_===47||_===62||ce(_)?F(_):r(_)}function F(_){return _===47?(t.consume(_),M):_===58||_===95||Qe(_)?(t.consume(_),L):Bt(_)?(o=F,P(_)):Xt(_)?(t.consume(_),F):M(_)}function L(_){return _===45||_===46||_===58||_===95||Ge(_)?(t.consume(_),L):B(_)}function B(_){return _===61?(t.consume(_),W):Bt(_)?(o=B,P(_)):Xt(_)?(t.consume(_),B):F(_)}function W(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(t.consume(_),i=_,G):Bt(_)?(o=W,P(_)):Xt(_)?(t.consume(_),W):(t.consume(_),O)}function G(_){return _===i?(t.consume(_),i=void 0,I):_===null?r(_):Bt(_)?(o=G,P(_)):(t.consume(_),G)}function O(_){return _===null||_===34||_===39||_===60||_===61||_===96?r(_):_===47||_===62||ce(_)?F(_):(t.consume(_),O)}function I(_){return _===47||_===62||ce(_)?F(_):r(_)}function M(_){return _===62?(t.consume(_),t.exit("htmlTextData"),t.exit("htmlText"),e):r(_)}function P(_){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),$}function $(_){return Xt(_)?Qt(t,D,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):D(_)}function D(_){return t.enter("htmlTextData"),o(_)}}const Mf={name:"labelEnd",resolveAll:$j,resolveTo:Rj,tokenize:zj},Pj={tokenize:Wj},Dj={tokenize:qj},Oj={tokenize:Hj};function $j(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&&_r(t,0,t.length,r),t}function Rj(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}},c={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",c,e]],a=Ar(a,t.slice(s+1,s+n+3)),a=Ar(a,[["enter",u,e]]),a=Ar(a,Wc(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Ar(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=Ar(a,t.slice(o+1)),a=Ar(a,[["exit",l,e]]),_r(t,s,t.length,a),t}function zj(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(p){return s?s._inactive?d(p):(o=n.parser.defined.includes(qr(n.sliceSerialize({start:s.end,end:n.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),l):r(p)}function l(p){return p===40?t.attempt(Pj,u,o?u:d)(p):p===91?t.attempt(Dj,u,o?c:d)(p):o?u(p):d(p)}function c(p){return t.attempt(Oj,u,d)(p)}function u(p){return e(p)}function d(p){return s._balanced=!0,r(p)}}function Wj(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)?$o(t,s)(d):s(d)}function s(d){return d===41?u(d):pb(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ce(d)?$o(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?gb(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ce(d)?$o(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 qj(t,e,r){const n=this;return i;function i(a){return mb.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(qr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function Hj(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 Uj={name:"labelStartImage",resolveAll:Mf.resolveAll,tokenize:Gj};function Gj(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 Vj={name:"labelStartLink",resolveAll:Mf.resolveAll,tokenize:Yj};function Yj(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 Rh={name:"lineEnding",tokenize:Xj};function Xj(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),Qt(t,e,"linePrefix")}}const Sl={name:"thematicBreak",tokenize:Kj};function Kj(t,e,r){let n=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||Bt(c))?(t.exit("thematicBreak"),e(c)):r(c)}function l(c){return c===i?(t.consume(c),n++,l):(t.exit("thematicBreakSequence"),Xt(c)?Qt(t,a,"whitespace")(c):a(c))}}const cr={continuation:{tokenize:t5},exit:r5,name:"list",tokenize:Jj},Zj={partial:!0,tokenize:n5},Qj={partial:!0,tokenize:e5};function Jj(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(f){const m=n.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!n.containerState.marker||f===n.containerState.marker:td(f)){if(n.containerState.type||(n.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),f===42||f===45?t.check(Sl,r,c)(f):c(f);if(!n.interrupt||f===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(f)}return r(f)}function l(f){return td(f)&&++o<10?(t.consume(f),l):(!n.interrupt||o<2)&&(n.containerState.marker?f===n.containerState.marker:f===41||f===46)?(t.exit("listItemValue"),c(f)):r(f)}function c(f){return t.enter("listItemMarker"),t.consume(f),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||f,t.check(xa,n.interrupt?r:u,t.attempt(Zj,p,d))}function u(f){return n.containerState.initialBlankLine=!0,s++,p(f)}function d(f){return Xt(f)?(t.enter("listItemPrefixWhitespace"),t.consume(f),t.exit("listItemPrefixWhitespace"),p):r(f)}function p(f){return n.containerState.size=s+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(f)}}function t5(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(xa,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Qt(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Xt(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(Qj,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Qt(t,t.attempt(cr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function e5(t,e,r){const n=this;return Qt(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 r5(t){t.exit(this.containerState.type)}function n5(t,e,r){const n=this;return Qt(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!Xt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const Wm={name:"setextUnderline",resolveTo:i5,tokenize:s5};function i5(t,e){let r=t.length,n,i,s;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){n=r;break}t[r][1].type==="paragraph"&&(i=r)}else t[r][1].type==="content"&&t.splice(r,1),!s&&t[r][1].type==="definition"&&(s=r);const o={type:"setextHeading",start:{...t[n][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[n][1],e]),t[n][1].end={...t[s][1].end}):t[n][1]=o,t.push(["exit",o,e]),t}function s5(t,e,r){const n=this;let i;return s;function s(c){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=c,o(c)):r(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Xt(c)?Qt(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Bt(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}const o5={tokenize:a5};function a5(t){const e=this,r=t.attempt(xa,n,t.attempt(this.parser.constructs.flowInitial,i,Qt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(dj,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 l5={resolveAll:yb()},c5=xb("string"),h5=xb("text");function xb(t){return{resolveAll:yb(t==="text"?u5: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 c(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 c(u)?(r.exit("data"),s(u)):(r.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(n,n.previous))return!0}return!1}}}function yb(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 u5(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 c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&r===t.length&&(a=0),a){const c={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={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(t.splice(r,0,["enter",c,e],["exit",c,e]),r+=2)}r++}return t}const d5={42:cr,43:cr,45:cr,48:cr,49:cr,50:cr,51:cr,52:cr,53:cr,54:cr,55:cr,56:cr,57:cr,62:hb},f5={91:xj},p5={[-2]:$h,[-1]:$h,32:$h},m5={35:wj,42:Sl,45:[Wm,Sl],60:Ej,61:Wm,95:Sl,96:Rm,126:Rm},g5={38:db,92:ub},x5={[-5]:Rh,[-4]:Rh,[-3]:Rh,33:Uj,38:db,42:ed,60:[VN,Ij],91:Vj,92:[kj,ub],93:Mf,95:ed,96:oj},y5={null:[ed,l5]},b5={null:[42,95]},C5={null:[]},k5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:b5,contentInitial:f5,disable:C5,document:d5,flow:m5,flowInitial:p5,insideSpan:y5,string:g5,text:x5},Symbol.toStringTag,{value:"Module"}));function v5(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:T(E),check:T(w),consume:b,enter:k,exit:S,interrupt:T(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:t,previous:null,sliceSerialize:p,sliceStream:f,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function d(B){return o=Ar(o,B),g(),o[o.length-1]!==null?[]:(N(e,0),c.events=Wc(s,c.events,c),c.events)}function p(B,W){return S5(f(B),W)}function f(B){return w5(o,B)}function m(){const{_bufferIndex:B,_index:W,line:G,column:O,offset:I}=n;return{_bufferIndex:B,_index:W,line:G,column:O,offset:I}}function x(B){i[B.line]=B.column,L()}function g(){let B;for(;n._index<o.length;){const W=o[n._index];if(typeof W=="string")for(B=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===B&&n._bufferIndex<W.length;)y(W.charCodeAt(n._bufferIndex));else y(W)}}function y(B){u=u(B)}function b(B){Bt(B)?(n.line++,n.column=1,n.offset+=B===-3?2:1,L()):B!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=B}function k(B,W){const G=W||{};return G.type=B,G.start=m(),c.events.push(["enter",G,c]),a.push(G),G}function S(B){const W=a.pop();return W.end=m(),c.events.push(["exit",W,c]),W}function E(B,W){N(B,W.from)}function w(B,W){W.restore()}function T(B,W){return G;function G(O,I,M){let P,$,D,_;return Array.isArray(O)?X(O):"tokenize"in O?X([O]):R(O);function R(J){return yt;function yt(Ot){const lt=Ot!==null&&J[Ot],Z=Ot!==null&&J.null,at=[...Array.isArray(lt)?lt:lt?[lt]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return X(at)(Ot)}}function X(J){return P=J,$=0,J.length===0?M:A(J[$])}function A(J){return yt;function yt(Ot){return _=F(),D=J,J.partial||(c.currentConstruct=J),J.name&&c.parser.constructs.disable.null.includes(J.name)?st():J.tokenize.call(W?Object.assign(Object.create(c),W):c,l,ct,st)(Ot)}}function ct(J){return B(D,_),I}function st(J){return _.restore(),++$<P.length?A(P[$]):M}}}function N(B,W){B.resolveAll&&!s.includes(B)&&s.push(B),B.resolve&&_r(c.events,W,c.events.length-W,B.resolve(c.events.slice(W),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function F(){const B=m(),W=c.previous,G=c.currentConstruct,O=c.events.length,I=Array.from(a);return{from:O,restore:M};function M(){n=B,c.previous=W,c.currentConstruct=G,c.events.length=O,a=I,L()}}function L(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function w5(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 S5(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=`
7
- `;break}case-3:{o=`\r
8
- `;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 T5(t){const n={constructs:lb([k5,...(t||{}).extensions||[]]),content:i(RN),defined:[],document:i(WN),flow:i(o5),lazy:{},string:i(c5),text:i(h5)};return n;function i(s){return o;function o(a){return v5(n,s,a)}}}function _5(t){for(;!fb(t););return t}const qm=/[\0\t\n\r]/g;function E5(){let t=1,e="",r=!0,n;return i;function i(s,o,a){const l=[];let c,u,d,p,f;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(qm.lastIndex=d,c=qm.exec(s),p=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(p),!c){e=s.slice(d);break}if(f===10&&d===p&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<p&&(l.push(s.slice(d,p)),t+=p-d),f){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=p+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const N5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function j5(t){return t.replace(N5,L5)}function L5(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return cb(r.slice(s?2:1),s?16:10)}return Af(r)||t}const bb={}.hasOwnProperty;function B5(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),A5(r)(_5(T5(r).document().write(E5()(t,e,!0))))}function A5(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(_e),autolinkProtocol:F,autolinkEmail:F,atxHeading:s(re),blockQuote:s(Z),characterEscape:F,characterReference:F,codeFenced:s(at),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(at,o),codeText:s(vt,o),codeTextData:F,data:F,codeFlowValue:F,definition:s(Et),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Mt),hardBreakEscape:s(xe),hardBreakTrailing:s(xe),htmlFlow:s(Re,o),htmlFlowData:F,htmlText:s(Re,o),htmlTextData:F,image:s(Kt),label:o,link:s(_e),listItem:s(it),listItemValue:p,listOrdered:s(V,d),listUnordered:s(V),paragraph:s(ut),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(re),strong:s(jt),thematicBreak:s(mt)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:lt,autolinkProtocol:Ot,blockQuote:l(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:st,characterReferenceMarkerNumeric:st,characterReferenceValue:J,characterReference:yt,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:L,codeIndented:l(y),codeText:l(I),codeTextData:L,data:L,definition:l(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(W),hardBreakTrailing:l(W),htmlFlow:l(G),htmlFlowData:L,htmlText:l(O),htmlTextData:L,image:l(P),label:D,labelText:$,lineEnding:B,link:l(M),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ct,resourceDestinationString:_,resourceTitleString:R,resource:X,setextHeading:l(N),setextHeadingLineSequence:T,setextHeadingText:w,strong:l(),thematicBreak:l()}};Cb(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(U){let et={type:"root",children:[]};const Tt={stack:[et],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:r},zt=[];let Yt=-1;for(;++Yt<U.length;)if(U[Yt][1].type==="listOrdered"||U[Yt][1].type==="listUnordered")if(U[Yt][0]==="enter")zt.push(Yt);else{const ve=zt.pop();Yt=i(U,ve,Yt)}for(Yt=-1;++Yt<U.length;){const ve=e[U[Yt][0]];bb.call(ve,U[Yt][1].type)&&ve[U[Yt][1].type].call(Object.assign({sliceSerialize:U[Yt][2].sliceSerialize},Tt),U[Yt][1])}if(Tt.tokenStack.length>0){const ve=Tt.tokenStack[Tt.tokenStack.length-1];(ve[1]||Hm).call(Tt,void 0,ve[0])}for(et.position={start:Ln(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Ln(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},Yt=-1;++Yt<e.transforms.length;)et=e.transforms[Yt](et)||et;return et}function i(U,et,Tt){let zt=et-1,Yt=-1,ve=!1,sr,ae,yr,ue;for(;++zt<=Tt;){const pe=U[zt];switch(pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pe[0]==="enter"?Yt++:Yt--,ue=void 0;break}case"lineEndingBlank":{pe[0]==="enter"&&(sr&&!ue&&!Yt&&!yr&&(yr=zt),ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!Yt&&pe[0]==="enter"&&pe[1].type==="listItemPrefix"||Yt===-1&&pe[0]==="exit"&&(pe[1].type==="listUnordered"||pe[1].type==="listOrdered")){if(sr){let br=zt;for(ae=void 0;br--;){const Ke=U[br];if(Ke[1].type==="lineEnding"||Ke[1].type==="lineEndingBlank"){if(Ke[0]==="exit")continue;ae&&(U[ae][1].type="lineEndingBlank",ve=!0),Ke[1].type="lineEnding",ae=br}else if(!(Ke[1].type==="linePrefix"||Ke[1].type==="blockQuotePrefix"||Ke[1].type==="blockQuotePrefixWhitespace"||Ke[1].type==="blockQuoteMarker"||Ke[1].type==="listItemIndent"))break}yr&&(!ae||yr<ae)&&(sr._spread=!0),sr.end=Object.assign({},ae?U[ae][1].start:pe[1].end),U.splice(ae||zt,0,["exit",sr,pe[2]]),zt++,Tt++}if(pe[1].type==="listItemPrefix"){const br={type:"listItem",_spread:!1,start:Object.assign({},pe[1].start),end:void 0};sr=br,U.splice(zt,0,["enter",br,pe[2]]),zt++,Tt++,yr=void 0,ue=!0}}}return U[et][1]._spread=ve,Tt}function s(U,et){return Tt;function Tt(zt){a.call(this,U(zt),zt),et&&et.call(this,zt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(U,et,Tt){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([et,Tt||void 0]),U.position={start:Ln(et.start),end:void 0}}function l(U){return et;function et(Tt){U&&U.call(this,Tt),c.call(this,Tt)}}function c(U,et){const Tt=this.stack.pop(),zt=this.tokenStack.pop();if(zt)zt[0].type!==U.type&&(et?et.call(this,U,zt[0]):(zt[1]||Hm).call(this,U,zt[0]));else throw new Error("Cannot close `"+U.type+"` ("+Oo({start:U.start,end:U.end})+"): it’s not open");Tt.position.end=Ln(U.end)}function u(){return Bf(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(U){if(this.data.expectingFirstListItemValue){const et=this.stack[this.stack.length-2];et.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function f(){const U=this.resume(),et=this.stack[this.stack.length-1];et.lang=U}function m(){const U=this.resume(),et=this.stack[this.stack.length-1];et.meta=U}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const U=this.resume(),et=this.stack[this.stack.length-1];et.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const U=this.resume(),et=this.stack[this.stack.length-1];et.value=U.replace(/(\r?\n|\r)$/g,"")}function b(U){const et=this.resume(),Tt=this.stack[this.stack.length-1];Tt.label=et,Tt.identifier=qr(this.sliceSerialize(U)).toLowerCase()}function k(){const U=this.resume(),et=this.stack[this.stack.length-1];et.title=U}function S(){const U=this.resume(),et=this.stack[this.stack.length-1];et.url=U}function E(U){const et=this.stack[this.stack.length-1];if(!et.depth){const Tt=this.sliceSerialize(U).length;et.depth=Tt}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function T(U){const et=this.stack[this.stack.length-1];et.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function N(){this.data.setextHeadingSlurpLineEnding=void 0}function F(U){const Tt=this.stack[this.stack.length-1].children;let zt=Tt[Tt.length-1];(!zt||zt.type!=="text")&&(zt=tt(),zt.position={start:Ln(U.start),end:void 0},Tt.push(zt)),this.stack.push(zt)}function L(U){const et=this.stack.pop();et.value+=this.sliceSerialize(U),et.position.end=Ln(U.end)}function B(U){const et=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Tt=et.children[et.children.length-1];Tt.position.end=Ln(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(et.type)&&(F.call(this,U),L.call(this,U))}function W(){this.data.atHardBreak=!0}function G(){const U=this.resume(),et=this.stack[this.stack.length-1];et.value=U}function O(){const U=this.resume(),et=this.stack[this.stack.length-1];et.value=U}function I(){const U=this.resume(),et=this.stack[this.stack.length-1];et.value=U}function M(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const et=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=et,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function P(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const et=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=et,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function $(U){const et=this.sliceSerialize(U),Tt=this.stack[this.stack.length-2];Tt.label=j5(et),Tt.identifier=qr(et).toLowerCase()}function D(){const U=this.stack[this.stack.length-1],et=this.resume(),Tt=this.stack[this.stack.length-1];if(this.data.inReference=!0,Tt.type==="link"){const zt=U.children;Tt.children=zt}else Tt.alt=et}function _(){const U=this.resume(),et=this.stack[this.stack.length-1];et.url=U}function R(){const U=this.resume(),et=this.stack[this.stack.length-1];et.title=U}function X(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ct(U){const et=this.resume(),Tt=this.stack[this.stack.length-1];Tt.label=et,Tt.identifier=qr(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function st(U){this.data.characterReferenceType=U.type}function J(U){const et=this.sliceSerialize(U),Tt=this.data.characterReferenceType;let zt;Tt?(zt=cb(et,Tt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):zt=Af(et);const Yt=this.stack[this.stack.length-1];Yt.value+=zt}function yt(U){const et=this.stack.pop();et.position.end=Ln(U.end)}function Ot(U){L.call(this,U);const et=this.stack[this.stack.length-1];et.url=this.sliceSerialize(U)}function lt(U){L.call(this,U);const et=this.stack[this.stack.length-1];et.url="mailto:"+this.sliceSerialize(U)}function Z(){return{type:"blockquote",children:[]}}function at(){return{type:"code",lang:null,meta:null,value:""}}function vt(){return{type:"inlineCode",value:""}}function Et(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Mt(){return{type:"emphasis",children:[]}}function re(){return{type:"heading",depth:0,children:[]}}function xe(){return{type:"break"}}function Re(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function _e(){return{type:"link",title:null,url:"",children:[]}}function V(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function it(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function ut(){return{type:"paragraph",children:[]}}function jt(){return{type:"strong",children:[]}}function tt(){return{type:"text",value:""}}function mt(){return{type:"thematicBreak"}}}function Ln(t){return{line:t.line,column:t.column,offset:t.offset}}function Cb(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?Cb(t,n):M5(t,n)}}function M5(t,e){let r;for(r in e)if(bb.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 Hm(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Oo({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Oo({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Oo({start:e.start,end:e.end})+") is still open")}function I5(t){const e=this;e.parser=r;function r(n){return B5(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function F5(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 P5(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
9
- `}]}function D5(t,e){const r=e.value?e.value+`
10
- `:"",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 O5(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function $5(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function R5(t,e){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=String(e.identifier).toUpperCase(),i=Ws(n.toLowerCase()),s=t.footnoteOrder.indexOf(n);let o,a=t.footnoteCounts.get(n);a===void 0?(a=0,t.footnoteOrder.push(n),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(n,a);const 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 c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function z5(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 W5(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function kb(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 q5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return kb(t,e);const i={src:Ws(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function H5(t,e){const r={src:Ws(e.url)};e.alt!==null&&e.alt!==void 0&&(r.alt=e.alt),e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,n),t.applyData(e,n)}function U5(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 G5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return kb(t,e);const i={href:Ws(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function V5(t,e){const r={href:Ws(e.url)};e.title!==null&&e.title!==void 0&&(r.title=e.title);const n={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Y5(t,e,r){const n=t.all(e),i=r?X5(r):vb(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:`
11
- `}),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:`
12
- `});const c={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,c),t.applyData(e,c)}function X5(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=vb(r[n])}return e}function vb(t){const e=t.spread;return e??t.children.length>1}function K5(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 Z5(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Q5(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function J5(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function tL(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=Ef(e.children[1]),l=eb(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 eL(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 c=[];for(;++l<a;){const d=e.children[l],p={},f=o?o[l]:void 0;f&&(p.align=f);let m={type:"element",tagName:s,properties:p,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function rL(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Um=9,Gm=32;function nL(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Vm(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Vm(e.slice(i),i>0,!1)),s.join("")}function Vm(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===Um||s===Gm;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===Um||s===Gm;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function iL(t,e){const r={type:"text",value:nL(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function sL(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const oL={blockquote:F5,break:P5,code:D5,delete:O5,emphasis:$5,footnoteReference:R5,heading:z5,html:W5,imageReference:q5,image:H5,inlineCode:U5,linkReference:G5,link:V5,listItem:Y5,list:K5,paragraph:Z5,root:Q5,strong:J5,table:tL,tableCell:rL,tableRow:eL,text:iL,thematicBreak:sL,toml:Ha,yaml:Ha,definition:Ha,footnoteDefinition:Ha};function Ha(){}const wb=-1,qc=0,Ro=1,ql=2,If=3,Ff=4,Pf=5,Df=6,Sb=7,Tb=8,aL=typeof self=="object"?self:globalThis,Ym=(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 aL[t](e)},lL=(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 qc:case wb:return r(o,i);case Ro:{const a=r([],i);for(const l of o)a.push(n(l));return a}case ql:{const a=r({},i);for(const[l,c]of o)a[n(l)]=n(c);return a}case If:return r(new Date(o),i);case Ff:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case Pf:{const a=r(new Map,i);for(const[l,c]of o)a.set(n(l),n(c));return a}case Df:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case Sb:{const{name:a,message:l}=o;return r(Ym(a,l),i)}case Tb: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(Ym(s,o),i)};return n},Xm=t=>lL(new Map,t)(0),zi="",{toString:cL}={},{keys:hL}=Object,oo=t=>{const e=typeof t;if(e!=="object"||!t)return[qc,e];const r=cL.call(t).slice(8,-1);switch(r){case"Array":return[Ro,zi];case"Object":return[ql,zi];case"Date":return[If,zi];case"RegExp":return[Ff,zi];case"Map":return[Pf,zi];case"Set":return[Df,zi];case"DataView":return[Ro,r]}return r.includes("Array")?[Ro,r]:r.includes("Error")?[Sb,r]:[ql,r]},Ua=([t,e])=>t===qc&&(e==="function"||e==="symbol"),uL=(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]=oo(o);switch(a){case qc:{let u=o;switch(l){case"bigint":a=Tb,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([wb],o)}return i([a,u],o)}case Ro:{if(l){let p=o;return l==="DataView"?p=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(o)),i([l,[...p]],o)}const u=[],d=i([a,u],o);for(const p of o)u.push(s(p));return d}case ql:{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 p of hL(o))(t||!Ua(oo(o[p])))&&u.push([s(p),s(o[p])]);return d}case If:return i([a,o.toISOString()],o);case Ff:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case Pf:{const u=[],d=i([a,u],o);for(const[p,f]of o)(t||!(Ua(oo(p))||Ua(oo(f))))&&u.push([s(p),s(f)]);return d}case Df:{const u=[],d=i([a,u],o);for(const p of o)(t||!Ua(oo(p)))&&u.push(s(p));return d}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},Km=(t,{json:e,lossy:r}={})=>{const n=[];return uL(!(e||r),!!e,new Map,n)(t),n},Hl=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Xm(Km(t,e)):structuredClone(t):(t,e)=>Xm(Km(t,e));function dL(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 fL(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function pL(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||dL,n=t.options.footnoteBackLabel||fL,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 c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const u=t.all(c),d=String(c.identifier).toUpperCase(),p=Ws(d.toLowerCase());let f=0;const m=[],x=t.footnoteCounts.get(d);for(;x!==void 0&&++f<=x;){m.length>0&&m.push({type:"text",value:" "});let b=typeof r=="string"?r:r(l,f);typeof b=="string"&&(b={type:"text",value:b}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const b=g.children[g.children.length-1];b&&b.type==="text"?b.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-"+p},children:t.wrap(u,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Hl(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
13
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
14
- `}]}}const Hc=(function(t){if(t==null)return yL;if(typeof t=="function")return Uc(t);if(typeof t=="object")return Array.isArray(t)?mL(t):gL(t);if(typeof t=="string")return xL(t);throw new Error("Expected function, string, or object as test")});function mL(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=Hc(t[r]);return Uc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function gL(t){const e=t;return Uc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function xL(t){return Uc(e);function e(r){return r&&r.type===t}}function Uc(t){return e;function e(r,n,i){return!!(bL(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function yL(){return!0}function bL(t){return t!==null&&typeof t=="object"&&"type"in t}const _b=[],CL=!0,rd=!1,kL="skip";function Eb(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=Hc(i),o=n?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=_b,m,x,g;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=vL(r(l,u)),f[0]===rd))return f;if("children"in l&&l.children){const y=l;if(y.children&&f[0]!==kL)for(x=(n?y.children.length:-1)+o,g=u.concat(y);x>-1&&x<y.children.length;){const b=y.children[x];if(m=a(b,x,g)(),m[0]===rd)return m;x=typeof m[1]=="number"?m[1]:x+o}}return f}}}function vL(t){return Array.isArray(t)?t:typeof t=="number"?[CL,t]:t==null?_b:[t]}function Of(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),Eb(t,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const nd={}.hasOwnProperty,wL={};function SL(t,e){const r=e||wL,n=new Map,i=new Map,s=new Map,o={...oL,...r.handlers},a={all:c,applyData:_L,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:TL,wrap:NL};return Of(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?n:i,p=String(u.identifier).toUpperCase();d.has(p)||d.set(p,u)}}),a;function l(u,d){const p=u.type,f=a.handlers[p];if(nd.call(a.handlers,p)&&f)return f(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in u){const{children:x,...g}=u,y=Hl(g);return y.children=a.all(u),y}return Hl(u)}return(a.options.unknownHandler||EL)(a,u,d)}function c(u){const d=[];if("children"in u){const p=u.children;let f=-1;for(;++f<p.length;){const m=a.one(p[f],u);if(m){if(f&&p[f-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=Zm(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=Zm(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function TL(t,e){t.position&&(e.position=dN(t))}function _L(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,Hl(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function EL(t,e){const r=e.data||{},n="value"in e&&!(nd.call(r,"hProperties")||nd.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 NL(t,e){const r=[];let n=-1;for(e&&r.push({type:"text",value:`
15
- `});++n<t.length;)n&&r.push({type:"text",value:`
16
- `}),r.push(t[n]);return e&&t.length>0&&r.push({type:"text",value:`
17
- `}),r}function Zm(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Qm(t,e){const r=SL(t,e),n=r.one(t,void 0),i=pL(r),s=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
18
- `},i),s}function jL(t,e){return t&&"run"in t?async function(r,n){const i=Qm(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Qm(r,{file:n,...t||e})}}function Jm(t){if(t)throw t}var zh,tg;function LL(){if(tg)return zh;tg=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var p;for(p in c);return typeof p>"u"||t.call(c,p)},o=function(c,u){r&&u.name==="__proto__"?r(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(n)return n(c,u).value}else return;return c[u]};return zh=function l(){var c,u,d,p,f,m,x=arguments[0],g=1,y=arguments.length,b=!1;for(typeof x=="boolean"&&(b=x,x=arguments[1]||{},g=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});g<y;++g)if(c=arguments[g],c!=null)for(u in c)d=a(x,u),p=a(c,u),x!==p&&(b&&p&&(s(p)||(f=i(p)))?(f?(f=!1,m=d&&i(d)?d:[]):m=d&&s(d)?d:{},o(x,{name:u,newValue:l(b,m,p)})):typeof p<"u"&&o(x,{name:u,newValue:p}));return x},zh}var BL=LL();const Wh=Rc(BL);function id(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 AL(){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,...c){const u=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?ML(u,a)(...c):o(null,...c)}}function n(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function ML(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(c){const u=c;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 tn={basename:IL,dirname:FL,extname:PL,join:DL,sep:"/"};function IL(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ya(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 FL(t){if(ya(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 PL(t){ya(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 DL(...t){let e=-1,r;for(;++e<t.length;)ya(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":OL(r)}function OL(t){ya(t);const e=t.codePointAt(0)===47;let r=$L(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function $L(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 ya(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const RL={cwd:zL};function zL(){return"/"}function sd(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function WL(t){if(typeof t=="string")t=new URL(t);else if(!sd(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 qL(t)}function qL(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 qh=["history","path","basename","stem","extname","dirname"];class Nb{constructor(e){let r;e?sd(e)?r={path:e}:typeof e=="string"||HL(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":RL.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<qh.length;){const s=qh[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)qh.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?tn.basename(this.path):void 0}set basename(e){Uh(e,"basename"),Hh(e,"basename"),this.path=tn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?tn.dirname(this.path):void 0}set dirname(e){eg(this.basename,"dirname"),this.path=tn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?tn.extname(this.path):void 0}set extname(e){if(Hh(e,"extname"),eg(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=tn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){sd(e)&&(e=WL(e)),Uh(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?tn.basename(this.path,this.extname):void 0}set stem(e){Uh(e,"stem"),Hh(e,"stem"),this.path=tn.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 Ye(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 Hh(t,e){if(t&&t.includes(tn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+tn.sep+"`")}function Uh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function eg(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function HL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const UL=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),GL={}.hasOwnProperty;class $f extends UL{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=AL()}copy(){const e=new $f;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Wh(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Yh("data",this.frozen),this.namespace[e]=r,this):GL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Yh("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=Ga(e),n=this.parser||this.Parser;return Gh("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),Gh("process",this.parser||this.Parser),Vh("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=Ga(e),l=n.parse(a);n.run(l,a,function(u,d,p){if(u||!d||!p)return c(u);const f=d,m=n.stringify(f,p);XL(m)?p.value=m:p.result=m,c(u,p)});function c(u,d){u||!d?o(u):s?s(d):r(void 0,d)}}}processSync(e){let r=!1,n;return this.freeze(),Gh("processSync",this.parser||this.Parser),Vh("processSync",this.compiler||this.Compiler),this.process(e,i),ng("processSync","process",r),n;function i(s,o){r=!0,Jm(s),n=o}}run(e,r,n){rg(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=Ga(r);i.run(e,l,c);function c(u,d,p){const f=d||e;u?a(u):o?o(f):n(void 0,f,p)}}}runSync(e,r){let n=!1,i;return this.run(e,r,s),ng("runSync","run",n),i;function s(o,a){Jm(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=Ga(r),i=this.compiler||this.Compiler;return Vh("stringify",i),rg(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(Yh("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(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))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(c.plugins),c.settings&&(i.settings=Wh(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===c){p=d;break}if(p===-1)n.push([c,...u]);else if(u.length>0){let[f,...m]=u;const x=n[p][1];id(x)&&id(f)&&(f=Wh(!0,x,f)),n[p]=[c,f,...m]}}}}const VL=new $f().freeze();function Gh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Vh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Yh(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 rg(t){if(!id(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function ng(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ga(t){return YL(t)?t:new Nb(t)}function YL(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function XL(t){return typeof t=="string"||KL(t)}function KL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const ZL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ig=[],sg={allowDangerousHtml:!0},QL=/^(https?|ircs?|mailto|xmpp)$/i,JL=[{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 Rf(t){const e=tB(t),r=eB(t);return rB(e.runSync(e.parse(r),r),t)}function tB(t){const e=t.rehypePlugins||ig,r=t.remarkPlugins||ig,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...sg}:sg;return VL().use(I5).use(r).use(jL,n).use(e)}function eB(t){const e=t.children||"",r=new Nb;return typeof e=="string"&&(r.value=e),r}function rB(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||nB;for(const u of JL)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+ZL+u.id,void 0);return Of(t,c),xN(t,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,p){if(u.type==="raw"&&p&&typeof d=="number")return o?p.children.splice(d,1):p.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let f;for(f in Oh)if(Object.hasOwn(Oh,f)&&Object.hasOwn(u.properties,f)){const m=u.properties[f],x=Oh[f];(x===null||x.includes(u.tagName))&&(u.properties[f]=l(String(m||""),f,u))}}if(u.type==="element"){let f=r?!r.includes(u.tagName):s?s.includes(u.tagName):!1;if(!f&&n&&typeof d=="number"&&(f=!n(u,d,p)),f&&p&&typeof d=="number")return a&&u.children?p.children.splice(d,1,...u.children):p.children.splice(d,1),d}}}function nB(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||QL.test(t.slice(0,e))?t:""}function og(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 iB(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function sB(t,e,r){const i=Hc((r||{}).ignore||[]),s=oB(e);let o=-1;for(;++o<s.length;)Eb(t,"text",a);function a(c,u){let d=-1,p;for(;++d<u.length;){const f=u[d],m=p?p.children:void 0;if(i(f,m?m.indexOf(f):void 0,p))return;p=f}if(p)return l(c,u)}function l(c,u){const d=u[u.length-1],p=s[o][0],f=s[o][1];let m=0;const g=d.children.indexOf(c);let y=!1,b=[];p.lastIndex=0;let k=p.exec(c.value);for(;k;){const S=k.index,E={index:k.index,input:k.input,stack:[...u,c]};let w=f(...k,E);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=S+1:(m!==S&&b.push({type:"text",value:c.value.slice(m,S)}),Array.isArray(w)?b.push(...w):w&&b.push(w),m=S+k[0].length,y=!0),!p.global)break;k=p.exec(c.value)}return y?(m<c.value.length&&b.push({type:"text",value:c.value.slice(m)}),d.children.splice(g,1,...b)):b=[c],g+b.length}}function oB(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([aB(i[0]),lB(i[1])])}return e}function aB(t){return typeof t=="string"?new RegExp(iB(t),"g"):t}function lB(t){return typeof t=="function"?t:function(){return t}}const Xh="phrasing",Kh=["autolink","link","image","label"];function cB(){return{transforms:[gB],enter:{literalAutolink:uB,literalAutolinkEmail:Zh,literalAutolinkHttp:Zh,literalAutolinkWww:Zh},exit:{literalAutolink:mB,literalAutolinkEmail:pB,literalAutolinkHttp:dB,literalAutolinkWww:fB}}}function hB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Xh,notInConstruct:Kh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Xh,notInConstruct:Kh},{character:":",before:"[ps]",after:"\\/",inConstruct:Xh,notInConstruct:Kh}]}}function uB(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Zh(t){this.config.enter.autolinkProtocol.call(this,t)}function dB(t){this.config.exit.autolinkProtocol.call(this,t)}function fB(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 pB(t){this.config.exit.autolinkEmail.call(this,t)}function mB(t){this.exit(t)}function gB(t){sB(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xB],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),yB]],{ignore:["link","linkReference"]})}function xB(t,e,r,n,i){let s="";if(!jb(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!bB(r)))return!1;const o=CB(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 yB(t,e,r,n){return!jb(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function bB(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 CB(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=og(t,"(");let s=og(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 jb(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||bi(r)||zc(r))&&(!e||r!==47)}Lb.peek=jB;function kB(){this.buffer()}function vB(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function wB(){this.buffer()}function SB(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function TB(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=qr(this.sliceSerialize(t)).toLowerCase(),r.label=e}function _B(t){this.exit(t)}function EB(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=qr(this.sliceSerialize(t)).toLowerCase(),r.label=e}function NB(t){this.exit(t)}function jB(){return"["}function Lb(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 LB(){return{enter:{gfmFootnoteCallString:kB,gfmFootnoteCall:vB,gfmFootnoteDefinitionLabelString:wB,gfmFootnoteDefinition:SB},exit:{gfmFootnoteCallString:TB,gfmFootnoteCall:_B,gfmFootnoteDefinitionLabelString:EB,gfmFootnoteDefinition:NB}}}function BB(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:Lb},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const c=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?`
19
- `:" ")+s.indentLines(s.containerFlow(n,a.current()),e?Bb:AB))),c(),l}}function AB(t,e,r){return e===0?t:Bb(t,e,r)}function Bb(t,e,r){return(r?"":" ")+t}const MB=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ab.peek=OB;function IB(){return{canContainEols:["delete"],enter:{strikethrough:PB},exit:{strikethrough:DB}}}function FB(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:MB}],handlers:{delete:Ab}}}function PB(t){this.enter({type:"delete",children:[]},t)}function DB(t){this.exit(t)}function Ab(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 OB(){return"~"}function $B(t){return t.length}function RB(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||$B,s=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const x=[],g=[];let y=-1;for(t[u].length>c&&(c=t[u].length);++y<t[u].length;){const b=zB(t[u][y]);if(r.alignDelimiters!==!1){const k=i(b);g[y]=k,(l[y]===void 0||k>l[y])&&(l[y]=k)}x.push(b)}o[u]=x,a[u]=g}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<c;)s[d]=ag(n[d]);else{const x=ag(n);for(;++d<c;)s[d]=x}d=-1;const p=[],f=[];for(;++d<c;){const x=s[d];let g="",y="";x===99?(g=":",y=":"):x===108?g=":":x===114&&(y=":");let b=r.alignDelimiters===!1?1:Math.max(1,l[d]-g.length-y.length);const k=g+"-".repeat(b)+y;r.alignDelimiters!==!1&&(b=g.length+b+y.length,b>l[d]&&(l[d]=b),f[d]=b),p[d]=k}o.splice(1,0,p),a.splice(1,0,f),u=-1;const m=[];for(;++u<o.length;){const x=o[u],g=a[u];d=-1;const y=[];for(;++d<c;){const b=x[d]||"";let k="",S="";if(r.alignDelimiters!==!1){const E=l[d]-(g[d]||0),w=s[d];w===114?k=" ".repeat(E):w===99?E%2?(k=" ".repeat(E/2+.5),S=" ".repeat(E/2-.5)):(k=" ".repeat(E/2),S=k):S=" ".repeat(E)}r.delimiterStart!==!1&&!d&&y.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&b==="")&&(r.delimiterStart!==!1||d)&&y.push(" "),r.alignDelimiters!==!1&&y.push(k),y.push(b),r.alignDelimiters!==!1&&y.push(S),r.padding!==!1&&y.push(" "),(r.delimiterEnd!==!1||d!==c-1)&&y.push("|")}m.push(r.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
20
- `)}function zB(t){return t==null?"":String(t)}function ag(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 WB(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()),qB);return i(),o}function qB(t,e,r){return">"+(r?"":" ")+t}function HB(t,e){return lg(t,e.inConstruct,!0)&&!lg(t,e.notInConstruct,!1)}function lg(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 cg(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
21
- `&&HB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
22
- `}function UB(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 GB(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 VB(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 YB(t,e,r,n){const i=VB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(GB(t,r)){const d=r.enter("codeIndented"),p=r.indentLines(s,XB);return d(),p}const a=r.createTracker(n),l=i.repeat(Math.max(UB(s,i)+1,3)),c=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:`
23
- `,encode:["`"],...a.current()})),d()}return u+=a.move(`
24
- `),s&&(u+=a.move(s+`
25
- `)),u+=a.move(l),c(),u}function XB(t,e,r){return(r?"":" ")+t}function zf(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 KB(t,e,r,n){const i=zf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("definition");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("[");return c+=l.move(r.safe(r.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":`
26
- `,...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}function ZB(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 Jo(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ul(t,e,r){const n=Ns(t),i=Ns(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}}Mb.peek=QB;function Mb(t,e,r,n){const i=ZB(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 c=l.charCodeAt(0),u=Ul(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=Jo(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Ul(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+Jo(d));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function QB(t,e,r){return r.options.emphasis||"*"}function JB(t,e){let r=!1;return Of(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,rd}),!!((!t.depth||t.depth<3)&&Bf(t)&&(e.options.setext||r))}function tA(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(JB(t,r)){const u=r.enter("headingSetext"),d=r.enter("phrasing"),p=r.containerPhrasing(t,{...s.current(),before:`
27
- `,after:`
28
- `});return d(),u(),p+`
29
- `+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
30
- `))+1))}const o="#".repeat(i),a=r.enter("headingAtx"),l=r.enter("phrasing");s.move(o+" ");let c=r.containerPhrasing(t,{before:"# ",after:`
31
- `,...s.current()});return/^[\t ]/.test(c)&&(c=Jo(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),l(),a(),c}Ib.peek=eA;function Ib(t){return t.value||""}function eA(){return"<"}Fb.peek=rA;function Fb(t,e,r,n){const i=zf(r),s=i==='"'?"Quote":"Apostrophe",o=r.enter("image");let a=r.enter("label");const l=r.createTracker(n);let c=l.move("![");return c+=l.move(r.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=r.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(r.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=r.enter("destinationRaw"),c+=l.move(r.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=r.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(r.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function rA(){return"!"}Pb.peek=nA;function Pb(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 c=r.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),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"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function nA(){return"!"}Db.peek=iA;function Db(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 c=l.index;n.charCodeAt(c)===10&&n.charCodeAt(c-1)===13&&c--,n=n.slice(0,c)+" "+n.slice(l.index+1)}}return i+n+i}function iA(){return"`"}function Ob(t,e){const r=Bf(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))}$b.peek=sA;function $b(t,e,r,n){const i=zf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(Ob(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 c=o.move("[");return c+=o.move(r.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=r.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(r.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=r.enter("destinationRaw"),c+=o.move(r.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=r.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(r.safe(t.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function sA(t,e,r){return Ob(t,r)?"<":"["}Rb.peek=oA;function Rb(t,e,r,n){const i=t.referenceType,s=r.enter("linkReference");let o=r.enter("label");const a=r.createTracker(n);let l=a.move("[");const c=r.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),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"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function oA(){return"["}function Wf(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 aA(t){const e=Wf(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 lA(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 zb(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 cA(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?lA(r):Wf(r);const a=t.ordered?o==="."?")":".":aA(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),zb(r)===o&&u){let d=-1;for(;++d<t.children.length;){const p=t.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),r.bulletCurrent=o;const c=r.containerFlow(t,n);return r.bulletLastUsed=o,r.bulletCurrent=s,i(),c}function hA(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 uA(t,e,r,n){const i=hA(r);let s=r.bulletCurrent||Wf(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"),c=r.indentLines(r.containerFlow(t,a.current()),u);return l(),c;function u(d,p,f){return p?(f?"":" ".repeat(o))+d:(f?s:s+" ".repeat(o-s.length))+d}}function dA(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const fA=Hc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function pA(t,e,r,n){return(t.children.some(function(o){return fA(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function mA(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Wb.peek=gA;function Wb(t,e,r,n){const i=mA(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 c=l.charCodeAt(0),u=Ul(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=Jo(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Ul(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+Jo(d));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function gA(t,e,r){return r.options.strong||"*"}function xA(t,e,r,n){return r.safe(t.value,n)}function yA(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 bA(t,e,r){const n=(zb(r)+(r.options.ruleSpaces?" ":"")).repeat(yA(r));return r.options.ruleSpaces?n.slice(0,-1):n}const qb={blockquote:WB,break:cg,code:YB,definition:KB,emphasis:Mb,hardBreak:cg,heading:tA,html:Ib,image:Fb,imageReference:Pb,inlineCode:Db,link:$b,linkReference:Rb,list:cA,listItem:uA,paragraph:dA,root:pA,strong:Wb,text:xA,thematicBreak:bA};function CA(){return{enter:{table:kA,tableData:hg,tableHeader:hg,tableRow:wA},exit:{codeText:SA,table:vA,tableData:Qh,tableHeader:Qh,tableRow:Qh}}}function kA(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 vA(t){this.exit(t),this.data.inTable=void 0}function wA(t){this.enter({type:"tableRow",children:[]},t)}function Qh(t){this.exit(t)}function hg(t){this.enter({type:"tableCell",children:[]},t)}function SA(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,TA));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function TA(t,e){return e==="|"?e:t}function _A(t){const e=t||{},r=e.tableCellPadding,n=e.tablePipeAlign,i=e.stringLength,s=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
32
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:l,tableRow:a}};function o(f,m,x,g){return c(u(f,x,g),f.align)}function a(f,m,x,g){const y=d(f,x,g),b=c([y]);return b.slice(0,b.indexOf(`
33
- `))}function l(f,m,x,g){const y=x.enter("tableCell"),b=x.enter("phrasing"),k=x.containerPhrasing(f,{...g,before:s,after:s});return b(),y(),k}function c(f,m){return RB(f,{align:m,alignDelimiters:n,padding:r,stringLength:i})}function u(f,m,x){const g=f.children;let y=-1;const b=[],k=m.enter("table");for(;++y<g.length;)b[y]=d(g[y],m,x);return k(),b}function d(f,m,x){const g=f.children;let y=-1;const b=[],k=m.enter("tableRow");for(;++y<g.length;)b[y]=l(g[y],f,m,x);return k(),b}function p(f,m,x){let g=qb.inlineCode(f,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function EA(){return{exit:{taskListCheckValueChecked:ug,taskListCheckValueUnchecked:ug,paragraph:jA}}}function NA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:LA}}}function ug(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function jA(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 LA(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=qb.listItem(t,e,r,{...n,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function BA(){return[cB(),LB(),IB(),CA(),EA()]}function AA(t){return{extensions:[hB(),BB(t),FB(),_A(t),NA()]}}const MA={tokenize:$A,partial:!0},Hb={tokenize:RA,partial:!0},Ub={tokenize:zA,partial:!0},Gb={tokenize:WA,partial:!0},IA={tokenize:qA,partial:!0},Vb={name:"wwwAutolink",tokenize:DA,previous:Xb},Yb={name:"protocolAutolink",tokenize:OA,previous:Kb},Sn={name:"emailAutolink",tokenize:PA,previous:Zb},an={};function FA(){return{text:an}}let si=48;for(;si<123;)an[si]=Sn,si++,si===58?si=65:si===91&&(si=97);an[43]=Sn;an[45]=Sn;an[46]=Sn;an[95]=Sn;an[72]=[Sn,Yb];an[104]=[Sn,Yb];an[87]=[Sn,Vb];an[119]=[Sn,Vb];function PA(t,e,r){const n=this;let i,s;return o;function o(d){return!od(d)||!Zb.call(n,n.previous)||qf(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return od(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(IA,u,c)(d):d===45||d===95||Ge(d)?(s=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),i=!0,l}function u(d){return s&&i&&Qe(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function DA(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!Xb.call(n,n.previous)||qf(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(MA,t.attempt(Hb,t.attempt(Ub,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function OA(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&Kb.call(n,n.previous)&&!qf(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(Qe(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),l}return r(d)}function l(d){return d===47?(t.consume(d),s?c:(s=!0,l)):r(d)}function c(d){return d===null||Wl(d)||ce(d)||bi(d)||zc(d)?r(d):t.attempt(Hb,t.attempt(Ub,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function $A(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 RA(t,e,r){let n,i,s;return o;function o(c){return c===46||c===95?t.check(Gb,l,a)(c):c===null||ce(c)||bi(c)||c!==45&&zc(c)?l(c):(s=!0,t.consume(c),o)}function a(c){return c===95?n=!0:(i=n,n=void 0),t.consume(c),o}function l(c){return i||n||!s?r(c):e(c)}}function zA(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(Gb,e,s)(o):o===null||ce(o)||bi(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function WA(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)||bi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||ce(a)||bi(a)?e(a):n(a)}function s(a){return Qe(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):Qe(a)?(t.consume(a),o):r(a)}}function qA(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ge(s)?r(s):e(s)}}function Xb(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||ce(t)}function Kb(t){return!Qe(t)}function Zb(t){return!(t===47||od(t))}function od(t){return t===43||t===45||t===46||t===95||Ge(t)}function qf(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 HA={tokenize:QA,partial:!0};function UA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:XA,continuation:{tokenize:KA},exit:ZA}},text:{91:{name:"gfmFootnoteCall",tokenize:YA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:GA,resolveTo:VA}}}}function GA(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 c=qr(n.sliceSerialize({start:o.end,end:n.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?r(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function VA(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 YA(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",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||ce(d))return r(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(qr(n.sliceSerialize(p)))?(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:c}function u(d){return d===91||d===92||d===93?(t.consume(d),s++,c):c(d)}}function XA(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"),c}function c(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=qr(n.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}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 p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(s)||i.push(s),Qt(t,f,"gfmFootnoteDefinitionWhitespace")):r(m)}function f(m){return e(m)}}function KA(t,e,r){return t.check(xa,e,t.attempt(HA,e,r))}function ZA(t){t.exit("gfmFootnoteDefinition")}function QA(t,e,r){const n=this;return Qt(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 JA(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 c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},p=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],f=a.parser.constructs.insideSpan.null;f&&_r(p,p.length,0,Wc(f,o.slice(c+1,l),a)),_r(p,p.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),_r(o,c-1,l-c+3,p),l=c+p.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 c=this.previous,u=this.events;let d=0;return p;function p(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),f(m))}function f(m){const x=Ns(c);if(m===126)return d>1?l(m):(o.consume(m),d++,f);if(d<2&&!r)return l(m);const g=o.exit("strikethroughSequenceTemporary"),y=Ns(m);return g._open=!y||y===2&&!!x,g._close=!x||x===2&&!!y,a(m)}}}class tM{constructor(){this.map=[]}add(e,r,n){eM(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 eM(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 rM(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 nM(){return{flow:{null:{name:"table",tokenize:iM,resolveAll:sM}}}}function iM(t,e,r){const n=this;let i=0,s=0,o;return a;function a(L){let B=n.events.length-1;for(;B>-1;){const O=n.events[B][1].type;if(O==="lineEnding"||O==="linePrefix")B--;else break}const W=B>-1?n.events[B][1].type:null,G=W==="tableHead"||W==="tableRow"?w:l;return G===w&&n.parser.lazy[n.now().line]?r(L):G(L)}function l(L){return t.enter("tableHead"),t.enter("tableRow"),c(L)}function c(L){return L===124||(o=!0,s+=1),u(L)}function u(L){return L===null?r(L):Bt(L)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(L),t.exit("lineEnding"),f):r(L):Xt(L)?Qt(t,u,"whitespace")(L):(s+=1,o&&(o=!1,i+=1),L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(L)))}function d(L){return L===null||L===124||ce(L)?(t.exit("data"),u(L)):(t.consume(L),L===92?p:d)}function p(L){return L===92||L===124?(t.consume(L),d):d(L)}function f(L){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(L):(t.enter("tableDelimiterRow"),o=!1,Xt(L)?Qt(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):m(L))}function m(L){return L===45||L===58?g(L):L===124?(o=!0,t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),x):E(L)}function x(L){return Xt(L)?Qt(t,g,"whitespace")(L):g(L)}function g(L){return L===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),y):L===45?(s+=1,y(L)):L===null||Bt(L)?S(L):E(L)}function y(L){return L===45?(t.enter("tableDelimiterFiller"),b(L)):E(L)}function b(L){return L===45?(t.consume(L),b):L===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(L),t.exit("tableDelimiterMarker"),k):(t.exit("tableDelimiterFiller"),k(L))}function k(L){return Xt(L)?Qt(t,S,"whitespace")(L):S(L)}function S(L){return L===124?m(L):L===null||Bt(L)?!o||i!==s?E(L):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(L)):E(L)}function E(L){return r(L)}function w(L){return t.enter("tableRow"),T(L)}function T(L){return L===124?(t.enter("tableCellDivider"),t.consume(L),t.exit("tableCellDivider"),T):L===null||Bt(L)?(t.exit("tableRow"),e(L)):Xt(L)?Qt(t,T,"whitespace")(L):(t.enter("data"),N(L))}function N(L){return L===null||L===124||ce(L)?(t.exit("data"),T(L)):(t.consume(L),L===92?F:N)}function F(L){return L===92||L===124?(t.consume(L),N):N(L)}}function sM(t,e){let r=-1,n=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const p=new tM;for(;++r<t.length;){const f=t[r],m=f[1];f[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(dg(p,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(r,0,[["enter",c,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)},p.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=Va(p,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=Va(p,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=Va(p,e,s,i,r,d)):o[1]!==0&&(d=Va(p,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&dg(p,e,l,c,u),p.consume(e.events),r=-1;++r<e.events.length;){const f=e.events[r];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=rM(e.events,r))}return t}function Va(t,e,r,n,i,s){const o=n===1?"tableHeader":n===2?"tableDelimiter":"tableData",a="tableContent";r[0]!==0&&(s.end=Object.assign({},Ji(e.events,r[0])),t.add(r[0],0,[["exit",s,e]]));const l=Ji(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 c=Ji(e.events,r[2]),u=Ji(e.events,r[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(r[2],0,[["enter",d,e]]),n!==2){const p=e.events[r[2]],f=e.events[r[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[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({},Ji(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function dg(t,e,r,n,i){const s=[],o=Ji(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 Ji(t,e){const r=t[e],n=r[0]==="enter"?"start":"end";return r[1][n]}const oM={name:"tasklistCheck",tokenize:lM};function aM(){return{text:{91:oM}}}function lM(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 Bt(l)?e(l):Xt(l)?t.check({tokenize:cM},e,r)(l):r(l)}}function cM(t,e,r){return Qt(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function hM(t){return lb([FA(),UA(),JA(t),nM(),aM()])}const uM={};function Hf(t){const e=this,r=t||uM,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(hM(r)),s.push(BA()),o.push(AA(r))}/**
34
- * @license lucide-react v0.563.0 - ISC
35
- *
36
- * This source code is licensed under the ISC license.
37
- * See the LICENSE file in the root directory of this source tree.
38
- */const Qb=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
39
- * @license lucide-react v0.563.0 - ISC
40
- *
41
- * This source code is licensed under the ISC license.
42
- * See the LICENSE file in the root directory of this source tree.
43
- */const dM=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
44
- * @license lucide-react v0.563.0 - ISC
45
- *
46
- * This source code is licensed under the ISC license.
47
- * See the LICENSE file in the root directory of this source tree.
48
- */const fM=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase());/**
49
- * @license lucide-react v0.563.0 - ISC
50
- *
51
- * This source code is licensed under the ISC license.
52
- * See the LICENSE file in the root directory of this source tree.
53
- */const fg=t=>{const e=fM(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
54
- * @license lucide-react v0.563.0 - ISC
55
- *
56
- * This source code is licensed under the ISC license.
57
- * See the LICENSE file in the root directory of this source tree.
58
- */var pM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
59
- * @license lucide-react v0.563.0 - ISC
60
- *
61
- * This source code is licensed under the ISC license.
62
- * See the LICENSE file in the root directory of this source tree.
63
- */const mM=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
64
- * @license lucide-react v0.563.0 - ISC
65
- *
66
- * This source code is licensed under the ISC license.
67
- * See the LICENSE file in the root directory of this source tree.
68
- */const gM=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:s,iconNode:o,...a},l)=>C.createElement("svg",{ref:l,...pM,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Qb("lucide",i),...!s&&!mM(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,u])=>C.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
69
- * @license lucide-react v0.563.0 - ISC
70
- *
71
- * This source code is licensed under the ISC license.
72
- * See the LICENSE file in the root directory of this source tree.
73
- */const Lt=(t,e)=>{const r=C.forwardRef(({className:n,...i},s)=>C.createElement(gM,{ref:s,iconNode:e,className:Qb(`lucide-${dM(fg(t))}`,`lucide-${t}`,n),...i}));return r.displayName=fg(t),r};/**
74
- * @license lucide-react v0.563.0 - ISC
75
- *
76
- * This source code is licensed under the ISC license.
77
- * See the LICENSE file in the root directory of this source tree.
78
- */const xM=[["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"}]],Uf=Lt("activity",xM);/**
79
- * @license lucide-react v0.563.0 - ISC
80
- *
81
- * This source code is licensed under the ISC license.
82
- * See the LICENSE file in the root directory of this source tree.
83
- */const yM=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],bM=Lt("arrow-down-to-line",yM);/**
84
- * @license lucide-react v0.563.0 - ISC
85
- *
86
- * This source code is licensed under the ISC license.
87
- * See the LICENSE file in the root directory of this source tree.
88
- */const CM=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],kM=Lt("arrow-left",CM);/**
89
- * @license lucide-react v0.563.0 - ISC
90
- *
91
- * This source code is licensed under the ISC license.
92
- * See the LICENSE file in the root directory of this source tree.
93
- */const vM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Jb=Lt("arrow-right",vM);/**
94
- * @license lucide-react v0.563.0 - ISC
95
- *
96
- * This source code is licensed under the ISC license.
97
- * See the LICENSE file in the root directory of this source tree.
98
- */const wM=[["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"}]],SM=Lt("bell",wM);/**
99
- * @license lucide-react v0.563.0 - ISC
100
- *
101
- * This source code is licensed under the ISC license.
102
- * See the LICENSE file in the root directory of this source tree.
103
- */const TM=[["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"}]],ls=Lt("bot",TM);/**
104
- * @license lucide-react v0.563.0 - ISC
105
- *
106
- * This source code is licensed under the ISC license.
107
- * See the LICENSE file in the root directory of this source tree.
108
- */const _M=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],EM=Lt("chart-no-axes-column",_M);/**
109
- * @license lucide-react v0.563.0 - ISC
110
- *
111
- * This source code is licensed under the ISC license.
112
- * See the LICENSE file in the root directory of this source tree.
113
- */const NM=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ba=Lt("check",NM);/**
114
- * @license lucide-react v0.563.0 - ISC
115
- *
116
- * This source code is licensed under the ISC license.
117
- * See the LICENSE file in the root directory of this source tree.
118
- */const jM=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ca=Lt("chevron-down",jM);/**
119
- * @license lucide-react v0.563.0 - ISC
120
- *
121
- * This source code is licensed under the ISC license.
122
- * See the LICENSE file in the root directory of this source tree.
123
- */const LM=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],t1=Lt("chevron-left",LM);/**
124
- * @license lucide-react v0.563.0 - ISC
125
- *
126
- * This source code is licensed under the ISC license.
127
- * See the LICENSE file in the root directory of this source tree.
128
- */const BM=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],js=Lt("chevron-right",BM);/**
129
- * @license lucide-react v0.563.0 - ISC
130
- *
131
- * This source code is licensed under the ISC license.
132
- * See the LICENSE file in the root directory of this source tree.
133
- */const AM=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],e1=Lt("chevron-up",AM);/**
134
- * @license lucide-react v0.563.0 - ISC
135
- *
136
- * This source code is licensed under the ISC license.
137
- * See the LICENSE file in the root directory of this source tree.
138
- */const MM=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],IM=Lt("circle-check-big",MM);/**
139
- * @license lucide-react v0.563.0 - ISC
140
- *
141
- * This source code is licensed under the ISC license.
142
- * See the LICENSE file in the root directory of this source tree.
143
- */const FM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],r1=Lt("circle-check",FM);/**
144
- * @license lucide-react v0.563.0 - ISC
145
- *
146
- * This source code is licensed under the ISC license.
147
- * See the LICENSE file in the root directory of this source tree.
148
- */const PM=[["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"}]],DM=Lt("circle-x",PM);/**
149
- * @license lucide-react v0.563.0 - ISC
150
- *
151
- * This source code is licensed under the ISC license.
152
- * See the LICENSE file in the root directory of this source tree.
153
- */const OM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$M=Lt("circle",OM);/**
154
- * @license lucide-react v0.563.0 - ISC
155
- *
156
- * This source code is licensed under the ISC license.
157
- * See the LICENSE file in the root directory of this source tree.
158
- */const RM=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],n1=Lt("clock",RM);/**
159
- * @license lucide-react v0.563.0 - ISC
160
- *
161
- * This source code is licensed under the ISC license.
162
- * See the LICENSE file in the root directory of this source tree.
163
- */const zM=[["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"}]],Gf=Lt("cpu",zM);/**
164
- * @license lucide-react v0.563.0 - ISC
165
- *
166
- * This source code is licensed under the ISC license.
167
- * See the LICENSE file in the root directory of this source tree.
168
- */const WM=[["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"}]],i1=Lt("eye",WM);/**
169
- * @license lucide-react v0.563.0 - ISC
170
- *
171
- * This source code is licensed under the ISC license.
172
- * See the LICENSE file in the root directory of this source tree.
173
- */const qM=[["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"}]],Bi=Lt("file-text",qM);/**
174
- * @license lucide-react v0.563.0 - ISC
175
- *
176
- * This source code is licensed under the ISC license.
177
- * See the LICENSE file in the root directory of this source tree.
178
- */const HM=[["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"}]],UM=Lt("folder-open",HM);/**
179
- * @license lucide-react v0.563.0 - ISC
180
- *
181
- * This source code is licensed under the ISC license.
182
- * See the LICENSE file in the root directory of this source tree.
183
- */const GM=[["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"}]],Vf=Lt("folder",GM);/**
184
- * @license lucide-react v0.563.0 - ISC
185
- *
186
- * This source code is licensed under the ISC license.
187
- * See the LICENSE file in the root directory of this source tree.
188
- */const VM=[["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"}]],YM=Lt("funnel",VM);/**
189
- * @license lucide-react v0.563.0 - ISC
190
- *
191
- * This source code is licensed under the ISC license.
192
- * See the LICENSE file in the root directory of this source tree.
193
- */const XM=[["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"}]],s1=Lt("git-branch",XM);/**
194
- * @license lucide-react v0.563.0 - ISC
195
- *
196
- * This source code is licensed under the ISC license.
197
- * See the LICENSE file in the root directory of this source tree.
198
- */const KM=[["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"}]],ZM=Lt("inbox",KM);/**
199
- * @license lucide-react v0.563.0 - ISC
200
- *
201
- * This source code is licensed under the ISC license.
202
- * See the LICENSE file in the root directory of this source tree.
203
- */const QM=[["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"}]],JM=Lt("layers",QM);/**
204
- * @license lucide-react v0.563.0 - ISC
205
- *
206
- * This source code is licensed under the ISC license.
207
- * See the LICENSE file in the root directory of this source tree.
208
- */const tI=[["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"}]],eI=Lt("layout-dashboard",tI);/**
209
- * @license lucide-react v0.563.0 - ISC
210
- *
211
- * This source code is licensed under the ISC license.
212
- * See the LICENSE file in the root directory of this source tree.
213
- */const rI=[["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"}]],Ci=Lt("lightbulb",rI);/**
214
- * @license lucide-react v0.563.0 - ISC
215
- *
216
- * This source code is licensed under the ISC license.
217
- * See the LICENSE file in the root directory of this source tree.
218
- */const nI=[["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"}]],iI=Lt("link-2",nI);/**
219
- * @license lucide-react v0.563.0 - ISC
220
- *
221
- * This source code is licensed under the ISC license.
222
- * See the LICENSE file in the root directory of this source tree.
223
- */const sI=[["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"}]],oI=Lt("list",sI);/**
224
- * @license lucide-react v0.563.0 - ISC
225
- *
226
- * This source code is licensed under the ISC license.
227
- * See the LICENSE file in the root directory of this source tree.
228
- */const aI=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],o1=Lt("loader-circle",aI);/**
229
- * @license lucide-react v0.563.0 - ISC
230
- *
231
- * This source code is licensed under the ISC license.
232
- * See the LICENSE file in the root directory of this source tree.
233
- */const lI=[["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"}]],Gc=Lt("message-square",lI);/**
234
- * @license lucide-react v0.563.0 - ISC
235
- *
236
- * This source code is licensed under the ISC license.
237
- * See the LICENSE file in the root directory of this source tree.
238
- */const cI=[["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"}]],hI=Lt("moon",cI);/**
239
- * @license lucide-react v0.563.0 - ISC
240
- *
241
- * This source code is licensed under the ISC license.
242
- * See the LICENSE file in the root directory of this source tree.
243
- */const uI=[["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"}]],dI=Lt("network",uI);/**
244
- * @license lucide-react v0.563.0 - ISC
245
- *
246
- * This source code is licensed under the ISC license.
247
- * See the LICENSE file in the root directory of this source tree.
248
- */const fI=[["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"}]],a1=Lt("pencil",fI);/**
249
- * @license lucide-react v0.563.0 - ISC
250
- *
251
- * This source code is licensed under the ISC license.
252
- * See the LICENSE file in the root directory of this source tree.
253
- */const pI=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],l1=Lt("plus",pI);/**
254
- * @license lucide-react v0.563.0 - ISC
255
- *
256
- * This source code is licensed under the ISC license.
257
- * See the LICENSE file in the root directory of this source tree.
258
- */const mI=[["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"}]],Gl=Lt("refresh-cw",mI);/**
259
- * @license lucide-react v0.563.0 - ISC
260
- *
261
- * This source code is licensed under the ISC license.
262
- * See the LICENSE file in the root directory of this source tree.
263
- */const gI=[["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"}]],xI=Lt("save",gI);/**
264
- * @license lucide-react v0.563.0 - ISC
265
- *
266
- * This source code is licensed under the ISC license.
267
- * See the LICENSE file in the root directory of this source tree.
268
- */const yI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Zn=Lt("search",yI);/**
269
- * @license lucide-react v0.563.0 - ISC
270
- *
271
- * This source code is licensed under the ISC license.
272
- * See the LICENSE file in the root directory of this source tree.
273
- */const bI=[["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"}]],Yf=Lt("send",bI);/**
274
- * @license lucide-react v0.563.0 - ISC
275
- *
276
- * This source code is licensed under the ISC license.
277
- * See the LICENSE file in the root directory of this source tree.
278
- */const CI=[["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"}]],qs=Lt("shield-check",CI);/**
279
- * @license lucide-react v0.563.0 - ISC
280
- *
281
- * This source code is licensed under the ISC license.
282
- * See the LICENSE file in the root directory of this source tree.
283
- */const kI=[["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"}]],vI=Lt("shield",kI);/**
284
- * @license lucide-react v0.563.0 - ISC
285
- *
286
- * This source code is licensed under the ISC license.
287
- * See the LICENSE file in the root directory of this source tree.
288
- */const wI=[["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"}]],c1=Lt("skip-forward",wI);/**
289
- * @license lucide-react v0.563.0 - ISC
290
- *
291
- * This source code is licensed under the ISC license.
292
- * See the LICENSE file in the root directory of this source tree.
293
- */const SI=[["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"}]],pg=Lt("sparkles",SI);/**
294
- * @license lucide-react v0.563.0 - ISC
295
- *
296
- * This source code is licensed under the ISC license.
297
- * See the LICENSE file in the root directory of this source tree.
298
- */const TI=[["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"}]],_I=Lt("star",TI);/**
299
- * @license lucide-react v0.563.0 - ISC
300
- *
301
- * This source code is licensed under the ISC license.
302
- * See the LICENSE file in the root directory of this source tree.
303
- */const EI=[["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"}]],NI=Lt("sun",EI);/**
304
- * @license lucide-react v0.563.0 - ISC
305
- *
306
- * This source code is licensed under the ISC license.
307
- * See the LICENSE file in the root directory of this source tree.
308
- */const jI=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],LI=Lt("terminal",jI);/**
309
- * @license lucide-react v0.563.0 - ISC
310
- *
311
- * This source code is licensed under the ISC license.
312
- * See the LICENSE file in the root directory of this source tree.
313
- */const BI=[["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"}]],mg=Lt("trash-2",BI);/**
314
- * @license lucide-react v0.563.0 - ISC
315
- *
316
- * This source code is licensed under the ISC license.
317
- * See the LICENSE file in the root directory of this source tree.
318
- */const AI=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Vc=Lt("triangle-alert",AI);/**
319
- * @license lucide-react v0.563.0 - ISC
320
- *
321
- * This source code is licensed under the ISC license.
322
- * See the LICENSE file in the root directory of this source tree.
323
- */const MI=[["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"}]],Xf=Lt("user",MI);/**
324
- * @license lucide-react v0.563.0 - ISC
325
- *
326
- * This source code is licensed under the ISC license.
327
- * See the LICENSE file in the root directory of this source tree.
328
- */const II=[["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"}]],FI=Lt("workflow",II);/**
329
- * @license lucide-react v0.563.0 - ISC
330
- *
331
- * This source code is licensed under the ISC license.
332
- * See the LICENSE file in the root directory of this source tree.
333
- */const PI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ln=Lt("x",PI);/**
334
- * @license lucide-react v0.563.0 - ISC
335
- *
336
- * This source code is licensed under the ISC license.
337
- * See the LICENSE file in the root directory of this source tree.
338
- */const DI=[["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"}]],Vl=Lt("zap",DI),Yc=C.createContext({newIds:new Set,changedIds:new Set}),gg=t=>{let e;const r=new Set,n=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const p=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),r.forEach(f=>f(e,p))}},i=()=>e,a={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c))},l=e=t(n,i,a);return a},OI=(t=>t?gg(t):gg),$I=t=>t;function RI(t,e=$I){const r=Vt.useSyncExternalStore(t.subscribe,Vt.useCallback(()=>e(t.getState()),[t,e]),Vt.useCallback(()=>e(t.getInitialState()),[t,e]));return Vt.useDebugValue(r),r}const xg=t=>{const e=OI(t),r=n=>RI(e,n);return Object.assign(r,e),r},Kf=(t=>t?xg(t):xg),ao=new Map;function zI(t,e,r){var P,$;const{prevItemMapRef:n,snapshotProviderRef:i,gatesRef:s,pendingResolveIdsRef:o,changeTimerRef:a,sessionEndTimerRef:l,wsRef:c}=e,{setItems:u,setConnections:d,setGates:p,setGateEvent:f,setRecentChanges:m,setUICommand:x,setAgentActivity:g,setAgentErrors:y,setSessionState:b,setSpawnedAgents:k,setAgentRelays:S,setSettings:E,setPipelineDraft:w,setActiveBuild:T,setSessions:N,setIterationStates:F,setFeatureTimeline:L,EMPTY_CHANGES:B,appendDecisionEvent:W,setDecisionEventsSnapshot:G,setStatusSnapshot:O,clearStatusSnapshots:I}=r,M=L?D=>{L(_=>_.some(R=>R.id===D.id)?_:[..._,D])}:null;if(t.type==="visionState"||t.type==="hydrate"){const D=t.items||[];if(n.current){const _=n.current,R=new Set,X=new Set;for(const A of D){const ct=_.get(A.id);ct?(ct.status!==A.status||ct.confidence!==A.confidence||ct.title!==A.title)&&X.add(A.id):R.add(A.id)}(R.size>0||X.size>0)&&(m({newIds:R,changedIds:X}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(B),800))}n.current=new Map(D.map(_=>[_.id,_])),u(D),d(t.connections||[]),p(t.gates||[]),N&&N(t.sessions||[]),G&&Array.isArray(t.decisionEventsSnapshot)&&G(t.decisionEventsSnapshot),I&&I()}else if(t.type==="decisionEvent")W&&t.event&&W(t.event);else if(t.type==="decisionEventsSnapshot")G&&Array.isArray(t.events)&&G(t.events);else if(t.type==="statusSnapshot")O&&t.featureCode&&t.snapshot&&O(t.featureCode,t.snapshot);else if(t.type==="visionUI")x(t);else if(t.type==="agentActivity")g(D=>{const _=[...D,{tool:t.tool,category:t.category||null,detail:t.detail,items:t.items||[],error:t.error||null,timestamp:t.timestamp}];return _.length>20?_.slice(-20):_}),b(D=>D!=null&&D.active?{...D,toolCount:(D.toolCount||0)+1}:D);else if(t.type==="agentSpawned")k(D=>[...D,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")k(D=>D.map(_=>_.agentId===t.agentId?{..._,silent:!0,silentSinceMs:t.silentSinceMs}:_));else if(t.type==="agentKilled")k(D=>D.map(_=>_.agentId===t.agentId?{..._,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:_));else if(t.type==="agentGC")((P=t.removed)==null?void 0:P.length)>0&&g(D=>{const _=[...D,{tool:"gc",category:"executing",detail:`Cleaned ${t.removed.length} orphan worktree(s)`,items:[],timestamp:t.timestamp}];return _.length>20?_.slice(-20):_});else if(t.type==="agentComplete")k(D=>D.map(_=>_.agentId===t.agentId?_.status==="killed"?_:{..._,status:t.status,completedAt:new Date().toISOString()}:_));else if(t.type==="agentRelay")S(D=>[...D,t].slice(-50));else if(t.type==="sessionStart")l.current&&(clearTimeout(l.current),l.current=null),k(()=>[]),S(()=>[]),b(D=>D&&D.id===t.sessionId?{...D,active:!0}:{id:t.sessionId,active:!0,startedAt:t.timestamp,source:t.source,toolCount:0,errorCount:0,summaries:[],featureCode:null,featureItemId:null,phaseAtBind:null,boundAt:null}),M&&M({id:`session-start-${t.sessionId}`,timestamp:t.timestamp,category:"session",title:"Session started",detail:t.source?`Source: ${t.source}`:null,severity:"info",sessionId:t.sessionId,meta:{source:t.source}});else if(t.type==="sessionEnd")l.current&&(clearTimeout(l.current),l.current=null),b(D=>D?{...D,active:!1,endedAt:t.timestamp,toolCount:t.toolCount,duration:t.duration,journalSpawned:t.journalSpawned,featureCode:t.featureCode||(D==null?void 0:D.featureCode)||null,phaseAtEnd:t.phaseAtEnd||null}:null),l.current=setTimeout(()=>{b(null),l.current=null},3e3),M&&M({id:`session-end-${t.sessionId||Date.now()}`,timestamp:t.timestamp,category:"session",title:`Session ended (${t.toolCount??0} tools)`,detail:null,severity:"info",sessionId:t.sessionId||null,meta:{toolCount:t.toolCount,duration:t.duration}});else if(t.type==="sessionSummary")b(D=>D&&{...D,summaries:[...D.summaries||[],{summary:t.summary,intent:t.intent,component:t.component,timestamp:t.timestamp}].slice(-5)});else if(t.type==="sessionBound")b(D=>D&&{...D,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(D=>{const _=[...D,{errorType:t.errorType,severity:t.severity,message:t.message,tool:t.tool,detail:t.detail,items:t.items||[],timestamp:t.timestamp||new Date().toISOString()}];return _.length>10?_.slice(-10):_}),b(D=>D!=null&&D.active?{...D,errorCount:(D.errorCount||0)+1}:D),M&&M({id:`error-${t.timestamp}-${Math.random().toString(36).slice(2,6)}`,timestamp:t.timestamp||new Date().toISOString(),category:"error",title:t.message||`${t.errorType} error`,detail:t.tool?`Tool: ${t.tool}`:null,severity:t.severity==="error"?"error":"warning",sessionId:null,meta:{type:t.errorType,tool:t.tool}});else if(t.type==="gateCreated"||t.type==="gatePending")f({type:"pending",gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}),M&&M({id:`gate-created-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:t.fromPhase&&t.toPhase?`Gate: ${t.fromPhase} → ${t.toPhase}`:"Gate created",detail:null,severity:"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,fromPhase:t.fromPhase,toPhase:t.toPhase}});else if(t.type==="gateResolved"){if(p(R=>R.map(X=>X.id===t.gateId?{...X,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:X)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const R=t.itemId??(($=s.current.find(X=>X.id===t.gateId))==null?void 0:$.itemId)??t.gateId;f({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:R})}const D=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,_={approve:"success",revise:"warning",kill:"error"};M&&M({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${D}`,detail:null,severity:_[t.outcome]||"info",sessionId:null,meta:{gateId:t.gateId,itemId:t.itemId,outcome:t.outcome}})}else if(t.type==="iterationStarted"||t.type==="iterationUpdate"||t.type==="iterationComplete"){if(g(D=>{let _;t.type==="iterationStarted"?_=`${t.loopType} loop started (0/${t.maxIterations})`:t.type==="iterationComplete"?_=`${t.loopType??"loop"} loop complete (${t.outcome} after ${t.finalCount} iterations)`:_=`${t.loopType??"loop"} iteration ${t.count}/${t.maxIterations}`;const R=[...D,{tool:"iteration",category:t.loopType||"iteration",detail:_,items:[],timestamp:t.timestamp}];return R.length>20?R.slice(-20):R}),t.type==="iterationStarted")ao.has(t.loopId)&&(clearTimeout(ao.get(t.loopId)),ao.delete(t.loopId)),F(D=>{const _=new Map(D);return _.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}),_});else if(t.type==="iterationUpdate")F(D=>{const _=D.get(t.loopId);if(!_)return D;const R=new Map(D);return R.set(t.loopId,{..._,count:t.count,maxIterations:t.maxIterations}),R});else if(t.type==="iterationComplete"){F(_=>{const R=_.get(t.loopId);if(!R)return _;const X=new Map(_);return X.set(t.loopId,{...R,status:"complete",outcome:t.outcome,count:t.finalCount??R.count}),X});const D=setTimeout(()=>{F(_=>{const R=new Map(_);return R.delete(t.loopId),R}),ao.delete(t.loopId)},5e3);ao.set(t.loopId,D)}if(t.type==="iterationComplete"&&(t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit")){const D={max_reached:`${t.loopType??"Loop"} hit max iterations (${t.finalCount}) — problem may be in the spec`,timeout:`${t.loopType??"Loop"} timed out after ${t.elapsedMinutes??"?"} minutes (${t.finalCount} iterations)`,action_limit:`${t.loopType??"Loop"} hit action count ceiling (${t.finalCount} iterations)`};y(_=>{const R=[..._,{errorType:"iteration_limit",severity:"warning",message:D[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return R.length>10?R.slice(-10):R}),b(_=>_!=null&&_.active?{..._,errorCount:(_.errorCount||0)+1}:_)}if(M&&(t.type==="iterationStarted"||t.type==="iterationComplete")){const D=t.type==="iterationStarted"?`${t.loopType} loop started (0/${t.maxIterations})`:`${t.loopType??"loop"} loop ${t.outcome} (${t.finalCount} iterations)`;M({id:`iteration-${t.loopId}-${t.type}`,timestamp:t.timestamp,category:"iteration",title:D,detail:null,severity:t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit"?"warning":t.type==="iterationComplete"?"success":"info",sessionId:null,meta:{loopId:t.loopId,loopType:t.loopType}})}}else if(t.type==="lifecycleStarted")M&&M({id:`lifecycle-started-${t.itemId}`,timestamp:t.timestamp,category:"phase",title:`Lifecycle started: ${t.phase}`,detail:t.featureCode?`Feature: ${t.featureCode}`:null,severity:"success",sessionId:null,meta:{itemId:t.itemId,phase:t.phase,featureCode:t.featureCode}});else if(t.type==="lifecycleTransition"){const D=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",_=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";M&&M({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${D}`,detail:null,severity:_,sessionId:null,meta:{itemId:t.itemId,from:t.from,to:t.to,outcome:t.outcome}})}else if(t.type==="openLoopsUpdate")u&&t.itemId&&Array.isArray(t.loops)&&u(D=>D.map(_=>{if(_.id!==t.itemId)return _;const R=_.lifecycle?{..._.lifecycle}:{};return R.lifecycle_ext={...R.lifecycle_ext||{},open_loops:t.loops},{..._,lifecycle:R}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(D=>D.map(_=>{if(_.id!==t.itemId)return _;const R=_.lifecycle?{..._.lifecycle}:{};return R.lifecycle_ext={...R.lifecycle_ext||{},drift_axes:t.drift_axes},{..._,lifecycle:R}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:D,itemId:_,...R}=t;u(X=>X.map(A=>{if(A.id!==_)return A;const ct=A.lifecycle?{...A.lifecycle}:{};return ct.lifecycle_ext={...ct.lifecycle_ext||{},branch_lineage:R},{...A,lifecycle:ct}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")E&&E(t.settings||null);else if(t.type==="buildState")T&&T(D=>{const _=(D==null?void 0:D.flowId)&&t.flowId&&D.flowId===t.flowId;return{...t,tierEvents:_?D.tierEvents??[]:[],capabilityEvents:_?D.capabilityEvents??[]:[],..._&&(D==null?void 0:D.health_score)!=null?{health_score:D.health_score,health_breakdown:D.health_breakdown,health_missing:D.health_missing}:{}}});else if(t.type==="pipelineDraft")w&&w(t);else if(t.type==="pipelineDraftResolved")w&&w(null);else if(t.type==="system"&&t.subtype==="health_score")T&&T(D=>D&&{...D,health_score:t.score,health_breakdown:t.breakdown,health_missing:t.missing});else if(t.type==="system"&&(t.subtype==="gate_tier_result"||t.subtype==="gate_tier_failed"||t.subtype==="gate_tier_summary"))T&&T(D=>D&&{...D,tierEvents:[...D.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")T&&T(D=>D&&{...D,capabilityEvents:[...D.capabilityEvents||[],t].slice(-200)});else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:D}=e,_=i.current?i.current():{},R=D?D():{},X=c.current;X&&X.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{..._,dom:R,timestamp:new Date().toISOString()}}))}}function WI(){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 p=s.textContent.trim();return p?p.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={},c=s.getAttribute("role")||s.getAttribute("aria-label"),u=s.tagName.toLowerCase();if(c?l.role=c:l.tag=u,s.className&&typeof s.className=="string"){const p=s.className.trim();p.length<80&&(l.class=p)}const d=[];for(const p of s.childNodes){const f=n(p,o+1);f&&d.push(f)}return d.length===1&&typeof d[0]=="string"?l.text=d[0]:d.length>0&&(l.children=d),!c&&(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 ye={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},yg={newIds:new Set,changedIds:new Set},pr=Kf((t,e)=>{async function r(o,a){const l=await $t(o,a),c=await l.json();return l.ok?c:(console.error(`[vision] API error ${l.status}:`,c.error||c),{error:c.error||`HTTP ${l.status}`})}function n(){t({connected:!0}),$t("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),$t("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),$t("/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);zI(a,{prevItemMapRef:{get current(){return ye.prevItemMap},set current(l){ye.prevItemMap=l}},snapshotProviderRef:{get current(){return ye.snapshotProvider},set current(l){ye.snapshotProvider=l}},gatesRef:{get current(){return ye.gates},set current(l){ye.gates=l}},pendingResolveIdsRef:{get current(){return ye.pendingResolveIds},set current(l){ye.pendingResolveIds=l}},changeTimerRef:{get current(){return ye.changeTimer},set current(l){ye.changeTimer=l}},sessionEndTimerRef:{get current(){return ye.sessionEndTimer},set current(l){ye.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=ye.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:WI},{setItems:l=>t(c=>({items:typeof l=="function"?l(c.items):l})),setConnections:l=>t(c=>({connections:typeof l=="function"?l(c.connections):l})),setGates:l=>{t(c=>{const u=typeof l=="function"?l(c.gates):l;return ye.gates=u,{gates:u}})},setGateEvent:l=>t({gateEvent:l}),setRecentChanges:l=>t(c=>({recentChanges:typeof l=="function"?l(c.recentChanges):l})),setUICommand:l=>t({uiCommand:l}),setAgentActivity:l=>t(c=>({agentActivity:typeof l=="function"?l(c.agentActivity):l})),setAgentErrors:l=>{t(c=>{const u=typeof l=="function"?l(c.agentErrors):l,d=Date.now()-6e4,p=u.filter(f=>new Date(f.timestamp).getTime()>d).slice(-5);return{agentErrors:u,recentErrors:p}})},setSessionState:l=>t(c=>({sessionState:typeof l=="function"?l(c.sessionState):l})),setSpawnedAgents:l=>t(c=>({spawnedAgents:typeof l=="function"?l(c.spawnedAgents):l})),setAgentRelays:l=>t(c=>({agentRelays:typeof l=="function"?l(c.agentRelays):l})),setSettings:l=>t({settings:l}),setPipelineDraft:l=>t({pipelineDraft:l}),setActiveBuild:l=>t(c=>({activeBuild:typeof l=="function"?l(c.activeBuild):l})),setSessions:l=>t(c=>({sessions:typeof l=="function"?l(c.sessions):l})),setFeatureTimeline:l=>t(c=>({featureTimeline:typeof l=="function"?l(c.featureTimeline):l})),setIterationStates:l=>t(c=>({iterationStates:typeof l=="function"?l(c.iterationStates):l})),appendDecisionEvent:l=>t(c=>!(l!=null&&l.id)||c.decisionEvents.some(u=>u.id===l.id)?c:{decisionEvents:[...c.decisionEvents,l]}),setDecisionEventsSnapshot:l=>t({decisionEvents:Array.isArray(l)?l:[]}),setStatusSnapshot:(l,c)=>t(u=>({statusSnapshots:{...u.statusSnapshots,[l]:c}})),clearStatusSnapshots:()=>t({statusSnapshots:{}}),EMPTY_CHANGES:yg})}catch{}}function s(){if(ye.disposed||ye.ws)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/vision`;ye.ws=nE({url:a,onOpen:n,onMessage:i,onClose:()=>t({connected:!1})})}return $t("/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")),ye.buildPollInterval=setInterval(()=>{$t("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),ye.recentErrorsInterval=setInterval(()=>{const{agentErrors:o}=e(),a=Date.now()-6e4,l=o.filter(c=>new Date(c.timestamp).getTime()>a).slice(-5);t({recentErrors:l})},1e4),s(),{items:[],connections:[],connected:!1,uiCommand:null,recentChanges:yg,agentActivity:[],agentErrors:[],recentErrors:[],spawnedAgents:[],agentRelays:[],sessionState:null,gates:[],gateEvent:null,settings:null,pipelineDraft:null,activeBuild:null,iterationStates:new Map,sessions:[],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=>{ye.snapshotProvider=o},setActiveBuild:o=>t({activeBuild:o}),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(c=>c.id===o?{...c,position:a}:c)}))},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)=>{ye.pendingResolveIds.add(o);try{const c=await r(`/api/vision/gates/${o}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({outcome:a,comment:l})});return c.error&&ye.pendingResolveIds.delete(o),c}catch{return ye.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}:{})})}});function h1(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=h1(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function u1(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=h1(t))&&(n&&(n+=" "),n+=e);return n}const bg=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Cg=u1,d1=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return Cg(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(c=>{const u=r==null?void 0:r[c],d=s==null?void 0:s[c];if(u===null)return null;const p=bg(u)||bg(d);return i[c][p]}),a=r&&Object.entries(r).reduce((c,u)=>{let[d,p]=u;return p===void 0||(c[d]=p),c},{}),l=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:d,className:p,...f}=u;return Object.entries(f).every(m=>{let[x,g]=m;return Array.isArray(g)?g.includes({...s,...a}[x]):{...s,...a}[x]===g})?[...c,d,p]:c},[]);return Cg(t,o,l,r==null?void 0:r.class,r==null?void 0:r.className)},qI=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},HI=(t,e)=>({classGroupId:t,validator:e}),f1=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),Yl="-",kg=[],UI="arbitrary..",GI=t=>{const e=YI(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return VI(o);const a=o.split(Yl),l=a[0]===""&&a.length>1?1:0;return p1(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=r[o];return l?c?qI(c,l):l:c||kg}return r[o]||kg}}},p1=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],s=r.nextPart.get(i);if(s){const c=p1(t,e+1,s);if(c)return c}const o=r.validators;if(o===null)return;const a=e===0?t.join(Yl):t.slice(e).join(Yl),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},VI=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?UI+n:void 0})(),YI=t=>{const{theme:e,classGroups:r}=t;return XI(r,e)},XI=(t,e)=>{const r=f1();for(const n in t){const i=t[n];Zf(i,r,n,e)}return r},Zf=(t,e,r,n)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];KI(o,e,r,n)}},KI=(t,e,r,n)=>{if(typeof t=="string"){ZI(t,e,r);return}if(typeof t=="function"){QI(t,e,r,n);return}JI(t,e,r,n)},ZI=(t,e,r)=>{const n=t===""?e:m1(e,t);n.classGroupId=r},QI=(t,e,r,n)=>{if(t3(t)){Zf(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(HI(r,t))},JI=(t,e,r,n)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];Zf(l,m1(e,a),r,n)}},m1=(t,e)=>{let r=t;const n=e.split(Yl),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=r.nextPart.get(o);a||(a=f1(),r.nextPart.set(o,a)),r=a}return r},t3=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,e3=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},ad="!",vg=":",r3=[],wg=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),n3=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let x=0;x<u;x++){const g=i[x];if(o===0&&a===0){if(g===vg){s.push(i.slice(l,x)),l=x+1;continue}if(g==="/"){c=x;continue}}g==="["?o++:g==="]"?o--:g==="("?a++:g===")"&&a--}const d=s.length===0?i:i.slice(l);let p=d,f=!1;d.endsWith(ad)?(p=d.slice(0,-1),f=!0):d.startsWith(ad)&&(p=d.slice(1),f=!0);const m=c&&c>l?c-l:void 0;return wg(s,f,p,m)};if(e){const i=e+vg,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):wg(r3,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},i3=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},s3=t=>({cache:e3(t.cacheSize),parseClassName:n3(t),sortModifiers:i3(t),postfixLookupClassGroupIds:o3(t),...GI(t)}),o3=t=>{const e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)e[r[n]]=!0;return e},a3=/\s+/,l3=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s,postfixLookupClassGroupIds:o}=e,a=[],l=t.trim().split(a3);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:f,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:g}=r(d);if(p){c=d+(c.length>0?" "+c:c);continue}let y=!!g,b;if(y){const T=x.substring(0,g);b=n(T);const N=b&&o[b]?n(x):void 0;N&&N!==b&&(b=N,y=!1)}else b=n(x);if(!b){if(!y){c=d+(c.length>0?" "+c:c);continue}if(b=n(x),!b){c=d+(c.length>0?" "+c:c);continue}y=!1}const k=f.length===0?"":f.length===1?f[0]:s(f).join(":"),S=m?k+ad:k,E=S+b;if(a.indexOf(E)>-1)continue;a.push(E);const w=i(b,y);for(let T=0;T<w.length;++T){const N=w[T];a.push(S+N)}c=d+(c.length>0?" "+c:c)}return c},c3=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=g1(r))&&(i&&(i+=" "),i+=n);return i},g1=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=g1(t[n]))&&(r&&(r+=" "),r+=e);return r},h3=(t,...e)=>{let r,n,i,s;const o=l=>{const c=e.reduce((u,d)=>d(u),t());return r=s3(c),n=r.cache.get,i=r.cache.set,s=a,a(l)},a=l=>{const c=n(l);if(c)return c;const u=l3(l,r);return i(l,u),u};return s=o,(...l)=>s(c3(...l))},u3=[],Ae=t=>{const e=r=>r[t]||u3;return e.isThemeGetter=!0,e},x1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,y1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,d3=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,f3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,p3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,m3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,g3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,x3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bn=t=>d3.test(t),Gt=t=>!!t&&!Number.isNaN(Number(t)),Zr=t=>!!t&&Number.isInteger(Number(t)),Jh=t=>t.endsWith("%")&&Gt(t.slice(0,-1)),pn=t=>f3.test(t),b1=()=>!0,y3=t=>p3.test(t)&&!m3.test(t),Qf=()=>!1,b3=t=>g3.test(t),C3=t=>x3.test(t),k3=t=>!ft(t)&&!pt(t),v3=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),w3=t=>Qn(t,v1,Qf),ft=t=>x1.test(t),oi=t=>Qn(t,w1,y3),Sg=t=>Qn(t,B3,Gt),S3=t=>Qn(t,T1,b1),T3=t=>Qn(t,S1,Qf),Tg=t=>Qn(t,C1,Qf),_3=t=>Qn(t,k1,C3),Ya=t=>Qn(t,_1,b3),pt=t=>y1.test(t),lo=t=>Ai(t,w1),E3=t=>Ai(t,S1),_g=t=>Ai(t,C1),N3=t=>Ai(t,v1),j3=t=>Ai(t,k1),Xa=t=>Ai(t,_1,!0),L3=t=>Ai(t,T1,!0),Qn=(t,e,r)=>{const n=x1.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},Ai=(t,e,r=!1)=>{const n=y1.exec(t);return n?n[1]?e(n[1]):r:!1},C1=t=>t==="position"||t==="percentage",k1=t=>t==="image"||t==="url",v1=t=>t==="length"||t==="size"||t==="bg-size",w1=t=>t==="length",B3=t=>t==="number",S1=t=>t==="family-name",T1=t=>t==="number"||t==="weight",_1=t=>t==="shadow",A3=()=>{const t=Ae("color"),e=Ae("font"),r=Ae("text"),n=Ae("font-weight"),i=Ae("tracking"),s=Ae("leading"),o=Ae("breakpoint"),a=Ae("container"),l=Ae("spacing"),c=Ae("radius"),u=Ae("shadow"),d=Ae("inset-shadow"),p=Ae("text-shadow"),f=Ae("drop-shadow"),m=Ae("blur"),x=Ae("perspective"),g=Ae("aspect"),y=Ae("ease"),b=Ae("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),pt,ft],w=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],N=()=>[pt,ft,l],F=()=>[Bn,"full","auto",...N()],L=()=>[Zr,"none","subgrid",pt,ft],B=()=>["auto",{span:["full",Zr,pt,ft]},Zr,pt,ft],W=()=>[Zr,"auto",pt,ft],G=()=>["auto","min","max","fr",pt,ft],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...N()],P=()=>[Bn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],$=()=>[Bn,"screen","full","dvw","lvw","svw","min","max","fit",...N()],D=()=>[Bn,"screen","full","lh","dvh","lvh","svh","min","max","fit",...N()],_=()=>[t,pt,ft],R=()=>[...S(),_g,Tg,{position:[pt,ft]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",N3,w3,{size:[pt,ft]}],ct=()=>[Jh,lo,oi],st=()=>["","none","full",c,pt,ft],J=()=>["",Gt,lo,oi],yt=()=>["solid","dashed","dotted","double"],Ot=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],lt=()=>[Gt,Jh,_g,Tg],Z=()=>["","none",m,pt,ft],at=()=>["none",Gt,pt,ft],vt=()=>["none",Gt,pt,ft],Et=()=>[Gt,pt,ft],Mt=()=>[Bn,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pn],breakpoint:[pn],color:[b1],container:[pn],"drop-shadow":[pn],ease:["in","out","in-out"],font:[k3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pn],shadow:[pn],spacing:["px",Gt],text:[pn],"text-shadow":[pn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Bn,ft,pt,g]}],container:["container"],"container-type":[{"@container":["","normal","size",pt,ft]}],"container-named":[v3],columns:[{columns:[Gt,ft,pt,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{"inset-s":F(),start:F()}],end:[{"inset-e":F(),end:F()}],"inset-bs":[{"inset-bs":F()}],"inset-be":[{"inset-be":F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",pt,ft]}],basis:[{basis:[Bn,"full","auto",a,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Gt,Bn,"auto","initial","none",ft]}],grow:[{grow:["",Gt,pt,ft]}],shrink:[{shrink:["",Gt,pt,ft]}],order:[{order:[Zr,"first","last","none",pt,ft]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pbs:[{pbs:N()}],pbe:[{pbe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...D()]}],"min-block-size":[{"min-block":["auto",...D()]}],"max-block-size":[{"max-block":["none",...D()]}],w:[{w:[a,"screen",...P()]}],"min-w":[{"min-w":[a,"screen","none",...P()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",r,lo,oi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,L3,S3]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jh,ft]}],"font-family":[{font:[E3,T3,e]}],"font-features":[{"font-features":[ft]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,pt,ft]}],"line-clamp":[{"line-clamp":[Gt,"none",pt,Sg]}],leading:[{leading:[s,...N()]}],"list-image":[{"list-image":["none",pt,ft]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pt,ft]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...yt(),"wavy"]}],"text-decoration-thickness":[{decoration:[Gt,"from-font","auto",pt,oi]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[Gt,"auto",pt,ft]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"tab-size":[{tab:[Zr,pt,ft]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pt,ft]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pt,ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,pt,ft],radial:["",pt,ft],conic:[Zr,pt,ft]},j3,_3]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:ct()}],"gradient-via-pos":[{via:ct()}],"gradient-to-pos":[{to:ct()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:st()}],"rounded-s":[{"rounded-s":st()}],"rounded-e":[{"rounded-e":st()}],"rounded-t":[{"rounded-t":st()}],"rounded-r":[{"rounded-r":st()}],"rounded-b":[{"rounded-b":st()}],"rounded-l":[{"rounded-l":st()}],"rounded-ss":[{"rounded-ss":st()}],"rounded-se":[{"rounded-se":st()}],"rounded-ee":[{"rounded-ee":st()}],"rounded-es":[{"rounded-es":st()}],"rounded-tl":[{"rounded-tl":st()}],"rounded-tr":[{"rounded-tr":st()}],"rounded-br":[{"rounded-br":st()}],"rounded-bl":[{"rounded-bl":st()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...yt(),"hidden","none"]}],"divide-style":[{divide:[...yt(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-bs":[{"border-bs":_()}],"border-color-be":[{"border-be":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...yt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Gt,pt,ft]}],"outline-w":[{outline:["",Gt,lo,oi]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",u,Xa,Ya]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",d,Xa,Ya]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[Gt,oi]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",p,Xa,Ya]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[Gt,pt,ft]}],"mix-blend":[{"mix-blend":[...Ot(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ot()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Gt]}],"mask-image-linear-from-pos":[{"mask-linear-from":lt()}],"mask-image-linear-to-pos":[{"mask-linear-to":lt()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":lt()}],"mask-image-t-to-pos":[{"mask-t-to":lt()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":lt()}],"mask-image-r-to-pos":[{"mask-r-to":lt()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":lt()}],"mask-image-b-to-pos":[{"mask-b-to":lt()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":lt()}],"mask-image-l-to-pos":[{"mask-l-to":lt()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":lt()}],"mask-image-x-to-pos":[{"mask-x-to":lt()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":lt()}],"mask-image-y-to-pos":[{"mask-y-to":lt()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[pt,ft]}],"mask-image-radial-from-pos":[{"mask-radial-from":lt()}],"mask-image-radial-to-pos":[{"mask-radial-to":lt()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Gt]}],"mask-image-conic-from-pos":[{"mask-conic-from":lt()}],"mask-image-conic-to-pos":[{"mask-conic-to":lt()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pt,ft]}],filter:[{filter:["","none",pt,ft]}],blur:[{blur:Z()}],brightness:[{brightness:[Gt,pt,ft]}],contrast:[{contrast:[Gt,pt,ft]}],"drop-shadow":[{"drop-shadow":["","none",f,Xa,Ya]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",Gt,pt,ft]}],"hue-rotate":[{"hue-rotate":[Gt,pt,ft]}],invert:[{invert:["",Gt,pt,ft]}],saturate:[{saturate:[Gt,pt,ft]}],sepia:[{sepia:["",Gt,pt,ft]}],"backdrop-filter":[{"backdrop-filter":["","none",pt,ft]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[Gt,pt,ft]}],"backdrop-contrast":[{"backdrop-contrast":[Gt,pt,ft]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Gt,pt,ft]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Gt,pt,ft]}],"backdrop-invert":[{"backdrop-invert":["",Gt,pt,ft]}],"backdrop-opacity":[{"backdrop-opacity":[Gt,pt,ft]}],"backdrop-saturate":[{"backdrop-saturate":[Gt,pt,ft]}],"backdrop-sepia":[{"backdrop-sepia":["",Gt,pt,ft]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",pt,ft]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Gt,"initial",pt,ft]}],ease:[{ease:["linear","initial",y,pt,ft]}],delay:[{delay:[Gt,pt,ft]}],animate:[{animate:["none",b,pt,ft]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,pt,ft]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:at()}],"rotate-x":[{"rotate-x":at()}],"rotate-y":[{"rotate-y":at()}],"rotate-z":[{"rotate-z":at()}],scale:[{scale:vt()}],"scale-x":[{"scale-x":vt()}],"scale-y":[{"scale-y":vt()}],"scale-z":[{"scale-z":vt()}],"scale-3d":["scale-3d"],skew:[{skew:Et()}],"skew-x":[{"skew-x":Et()}],"skew-y":[{"skew-y":Et()}],transform:[{transform:[pt,ft,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Mt()}],"translate-x":[{"translate-x":Mt()}],"translate-y":[{"translate-y":Mt()}],"translate-z":[{"translate-z":Mt()}],"translate-none":["translate-none"],zoom:[{zoom:[Zr,pt,ft]}],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pt,ft]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":_()}],"scrollbar-track-color":[{"scrollbar-track":_()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mbs":[{"scroll-mbs":N()}],"scroll-mbe":[{"scroll-mbe":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pbs":[{"scroll-pbs":N()}],"scroll-pbe":[{"scroll-pbe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pt,ft]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[Gt,lo,oi,Sg]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},M3=h3(A3);function nt(...t){return M3(u1(t))}const I3=d1("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 er({className:t,variant:e,...r}){return h.jsx("div",{className:nt(I3({variant:e}),t),...r})}const Xc=C.forwardRef(({className:t,type:e,...r},n)=>h.jsx("input",{type:e,className:nt("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));Xc.displayName="Input";var Jf=iE();const F3=Rc(Jf);function Eg(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Kc(...t){return e=>{let r=!1;const n=t.map(i=>{const s=Eg(i,e);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let i=0;i<n.length;i++){const s=n[i];typeof s=="function"?s():Eg(t[i],null)}}}}function jr(...t){return C.useCallback(Kc(...t),t)}function P3(t){const e=D3(t),r=C.forwardRef((n,i)=>{const{children:s,...o}=n,a=C.Children.toArray(s),l=a.find($3);if(l){const c=l.props.children,u=a.map(d=>d===l?C.Children.count(c)>1?C.Children.only(null):C.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:i,children:C.isValidElement(c)?C.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function D3(t){const e=C.forwardRef((r,n)=>{const{children:i,...s}=r;if(C.isValidElement(i)){const o=z3(i),a=R3(s,i.props);return i.type!==C.Fragment&&(a.ref=n?Kc(n,o):o),C.cloneElement(i,a)}return C.Children.count(i)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var O3=Symbol("radix.slottable");function $3(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===O3}function R3(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function z3(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var W3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xr=W3.reduce((t,e)=>{const r=P3(`Primitive.${e}`),n=C.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function q3(t,e){t&&Jf.flushSync(()=>t.dispatchEvent(e))}var Ls=globalThis!=null&&globalThis.document?C.useLayoutEffect:()=>{};function H3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var Jn=t=>{const{present:e,children:r}=t,n=U3(e),i=typeof r=="function"?r({present:n.isPresent}):C.Children.only(r),s=jr(n.ref,G3(i));return typeof r=="function"||n.isPresent?C.cloneElement(i,{ref:s}):null};Jn.displayName="Presence";function U3(t){const[e,r]=C.useState(),n=C.useRef(null),i=C.useRef(t),s=C.useRef("none"),o=t?"mounted":"unmounted",[a,l]=H3(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{const c=Ka(n.current);s.current=a==="mounted"?c:"none"},[a]),Ls(()=>{const c=n.current,u=i.current;if(u!==t){const p=s.current,f=Ka(c);t?l("MOUNT"):f==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Ls(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const x=Ka(n.current).includes(CSS.escape(f.animationName));if(f.target===e&&x&&(l("ANIMATION_END"),!i.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},p=f=>{f.target===e&&(s.current=Ka(n.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:C.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function Ka(t){return(t==null?void 0:t.animationName)||"none"}function G3(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function V3(t,e){const r=C.createContext(e),n=s=>{const{children:o,...a}=s,l=C.useMemo(()=>a,Object.values(a));return h.jsx(r.Provider,{value:l,children:o})};n.displayName=t+"Provider";function i(s){const o=C.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[n,i]}function E1(t,e=[]){let r=[];function n(s,o){const a=C.createContext(o),l=r.length;r=[...r,o];const c=d=>{var y;const{scope:p,children:f,...m}=d,x=((y=p==null?void 0:p[t])==null?void 0:y[l])||a,g=C.useMemo(()=>m,Object.values(m));return h.jsx(x.Provider,{value:g,children:f})};c.displayName=s+"Provider";function u(d,p){var x;const f=((x=p==null?void 0:p[t])==null?void 0:x[l])||a,m=C.useContext(f);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=r.map(o=>C.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return C.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[n,Y3(i,...e)]}function Y3(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Mr(t){const e=C.useRef(t);return C.useEffect(()=>{e.current=t}),C.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}var X3=C.createContext(void 0);function K3(t){const e=C.useContext(X3);return t||e||"ltr"}function Z3(t,[e,r]){return Math.min(r,Math.max(e,t))}function rr(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Q3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var tp="ScrollArea",[N1]=E1(tp),[J3,Pr]=N1(tp),j1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=C.useState(null),[c,u]=C.useState(null),[d,p]=C.useState(null),[f,m]=C.useState(null),[x,g]=C.useState(null),[y,b]=C.useState(0),[k,S]=C.useState(0),[E,w]=C.useState(!1),[T,N]=C.useState(!1),F=jr(e,B=>l(B)),L=K3(i);return h.jsx(J3,{scope:r,type:n,dir:L,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:p,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:E,onScrollbarXEnabledChange:w,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:T,onScrollbarYEnabledChange:N,onCornerWidthChange:b,onCornerHeightChange:S,children:h.jsx(xr.div,{dir:L,...o,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...t.style}})})});j1.displayName=tp;var L1="ScrollAreaViewport",B1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Pr(L1,r),a=C.useRef(null),l=jr(e,a,o.onViewportChange);return h.jsxs(h.Fragment,{children:[h.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}),h.jsx(xr.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:h.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});B1.displayName=L1;var cn="ScrollAreaScrollbar",ep=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Pr(cn,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return C.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?h.jsx(tF,{...n,ref:e,forceMount:r}):i.type==="scroll"?h.jsx(eF,{...n,ref:e,forceMount:r}):i.type==="auto"?h.jsx(A1,{...n,ref:e,forceMount:r}):i.type==="always"?h.jsx(rp,{...n,ref:e}):null});ep.displayName=cn;var tF=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Pr(cn,t.__scopeScrollArea),[s,o]=C.useState(!1);return C.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),h.jsx(Jn,{present:r||s,children:h.jsx(A1,{"data-state":s?"visible":"hidden",...n,ref:e})})}),eF=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Pr(cn,t.__scopeScrollArea),s=t.orientation==="horizontal",o=Qc(()=>l("SCROLL_END"),100),[a,l]=Q3("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),C.useEffect(()=>{const c=i.viewport,u=s?"scrollLeft":"scrollTop";if(c){let d=c[u];const p=()=>{const f=c[u];d!==f&&(l("SCROLL"),o()),d=f};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[i.viewport,s,l,o]),h.jsx(Jn,{present:r||a!=="hidden",children:h.jsx(rp,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:rr(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:rr(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),A1=C.forwardRef((t,e)=>{const r=Pr(cn,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=C.useState(!1),a=t.orientation==="horizontal",l=Qc(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?c:u)}},10);return Bs(r.viewport,l),Bs(r.content,l),h.jsx(Jn,{present:n||s,children:h.jsx(rp,{"data-state":s?"visible":"hidden",...i,ref:e})})}),rp=C.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Pr(cn,t.__scopeScrollArea),s=C.useRef(null),o=C.useRef(0),[a,l]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=D1(a.viewport,a.content),u={...n,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function d(p,f){return aF(p,o.current,a,f)}return r==="horizontal"?h.jsx(rF,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,f=Ng(p,a,i.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=d(p,i.dir))}}):r==="vertical"?h.jsx(nF,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,f=Ng(p,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=d(p))}}):null}),rF=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Pr(cn,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=jr(e,l,s.onScrollbarXChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(I1,{"data-orientation":"horizontal",...i,ref:c,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":Zc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;t.onWheelScroll(p),$1(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Kl(o.paddingLeft),paddingEnd:Kl(o.paddingRight)}})}})}),nF=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Pr(cn,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=jr(e,l,s.onScrollbarYChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(I1,{"data-orientation":"vertical",...i,ref:c,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":Zc(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;t.onWheelScroll(p),$1(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Kl(o.paddingTop),paddingEnd:Kl(o.paddingBottom)}})}})}),[iF,M1]=N1(cn),I1=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...p}=t,f=Pr(cn,r),[m,x]=C.useState(null),g=jr(e,F=>x(F)),y=C.useRef(null),b=C.useRef(""),k=f.viewport,S=n.content-n.viewport,E=Mr(u),w=Mr(l),T=Qc(d,10);function N(F){if(y.current){const L=F.clientX-y.current.left,B=F.clientY-y.current.top;c({x:L,y:B})}}return C.useEffect(()=>{const F=L=>{const B=L.target;(m==null?void 0:m.contains(B))&&E(L,S)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[k,m,S,E]),C.useEffect(w,[n,w]),Bs(m,T),Bs(f.content,T),h.jsx(iF,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:Mr(s),onThumbPointerUp:Mr(o),onThumbPositionChange:w,onThumbPointerDown:Mr(a),children:h.jsx(xr.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:rr(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),y.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),N(F))}),onPointerMove:rr(t.onPointerMove,N),onPointerUp:rr(t.onPointerUp,F=>{const L=F.target;L.hasPointerCapture(F.pointerId)&&L.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),Xl="ScrollAreaThumb",F1=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=M1(Xl,t.__scopeScrollArea);return h.jsx(Jn,{present:r||i.hasThumb,children:h.jsx(sF,{ref:e,...n})})}),sF=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Pr(Xl,r),o=M1(Xl,r),{onThumbPositionChange:a}=o,l=jr(e,d=>o.onThumbChange(d)),c=C.useRef(void 0),u=Qc(()=>{c.current&&(c.current(),c.current=void 0)},100);return C.useEffect(()=>{const d=s.viewport;if(d){const p=()=>{if(u(),!c.current){const f=lF(d,a);c.current=f,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[s.viewport,u,a]),h.jsx(xr.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:rr(t.onPointerDownCapture,d=>{const f=d.target.getBoundingClientRect(),m=d.clientX-f.left,x=d.clientY-f.top;o.onThumbPointerDown({x:m,y:x})}),onPointerUp:rr(t.onPointerUp,o.onThumbPointerUp)})});F1.displayName=Xl;var np="ScrollAreaCorner",P1=C.forwardRef((t,e)=>{const r=Pr(np,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?h.jsx(oF,{...t,ref:e}):null});P1.displayName=np;var oF=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Pr(np,r),[s,o]=C.useState(0),[a,l]=C.useState(0),c=!!(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)}),c?h.jsx(xr.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 Kl(t){return t?parseInt(t,10):0}function D1(t,e){const r=t/e;return isNaN(r)?0:r}function Zc(t){const e=D1(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function aF(t,e,r,n="ltr"){const i=Zc(r),s=i/2,o=e||s,a=i-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-a,u=r.content-r.viewport,d=n==="ltr"?[0,u]:[u*-1,0];return O1([l,c],d)(t)}function Ng(t,e,r="ltr"){const n=Zc(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],c=Z3(t,l);return O1([0,o],[0,a])(c)}function O1(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 $1(t,e){return t>0&&t<e}var lF=(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 Qc(t,e){const r=Mr(t),n=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(n.current),[]),C.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Bs(t,e){const r=Mr(e);Ls(()=>{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 R1=j1,cF=B1,hF=P1;const Hn=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(R1,{ref:n,className:nt("relative overflow-hidden",t),...r,children:[h.jsx(cF,{className:"h-full w-full rounded-[inherit]",children:e}),h.jsx(z1,{}),h.jsx(hF,{})]}));Hn.displayName=R1.displayName;const z1=C.forwardRef(({className:t,orientation:e="vertical",...r},n)=>h.jsx(ep,{ref:n,orientation:e,className:nt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:h.jsx(F1,{className:"relative flex-1 rounded-full bg-border"})}));z1.displayName=ep.displayName;var uF=Symbol.for("react.lazy"),Zl=wf[" use ".trim().toString()];function dF(t){return typeof t=="object"&&t!==null&&"then"in t}function W1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===uF&&"_payload"in t&&dF(t._payload)}function q1(t){const e=pF(t),r=C.forwardRef((n,i)=>{let{children:s,...o}=n;W1(s)&&typeof Zl=="function"&&(s=Zl(s._payload));const a=C.Children.toArray(s),l=a.find(gF);if(l){const c=l.props.children,u=a.map(d=>d===l?C.Children.count(c)>1?C.Children.only(null):C.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:i,children:C.isValidElement(c)?C.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}var fF=q1("Slot");function pF(t){const e=C.forwardRef((r,n)=>{let{children:i,...s}=r;if(W1(i)&&typeof Zl=="function"&&(i=Zl(i._payload)),C.isValidElement(i)){const o=yF(i),a=xF(s,i.props);return i.type!==C.Fragment&&(a.ref=n?Kc(n,o):o),C.cloneElement(i,a)}return C.Children.count(i)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var mF=Symbol("radix.slottable");function gF(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===mF}function xF(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function yF(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var bF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],CF=bF.reduce((t,e)=>{const r=q1(`Primitive.${e}`),n=C.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{}),kF="Separator",jg="horizontal",vF=["horizontal","vertical"],H1=C.forwardRef((t,e)=>{const{decorative:r,orientation:n=jg,...i}=t,s=wF(n)?n:jg,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return h.jsx(CF.div,{"data-orientation":s,...a,...i,ref:e})});H1.displayName=kF;function wF(t){return vF.includes(t)}var U1=H1;const Ql=C.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>h.jsx(U1,{ref:i,decorative:r,orientation:e,className:nt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Ql.displayName=U1.displayName;function SF({agentId:t,status:e}){const[r,n]=C.useState(""),[i,s]=C.useState(""),o=C.useRef(null),a=C.useRef(!1),l=C.useCallback(()=>{const d=o.current;d&&(a.current=d.scrollTop+d.clientHeight<d.scrollHeight-20)},[]);C.useEffect(()=>{const d=o.current;d&&!a.current&&(d.scrollTop=d.scrollHeight)},[r,i]),C.useEffect(()=>{if(!t)return;const d=async()=>{try{const p=await $t(`/api/agent/${t}`);if(!p.ok)return;const f=await p.json();f.output!=null&&n(f.output),f.stderr!=null&&s(f.stderr)}catch{}};if(d(),e==="running"){const p=setInterval(d,2e3);return()=>clearInterval(p)}},[t,e]);const c=!r&&!i,u=e==="running";return h.jsx("div",{children:h.jsx("div",{ref:o,onScroll:l,className:"overflow-auto max-h-[300px] rounded bg-muted/30 p-2",children:c?h.jsx("p",{className:"text-[10px] font-mono text-muted-foreground italic",children:u?"Waiting for output...":"No output"}):h.jsxs(h.Fragment,{children:[r&&h.jsx("pre",{className:"text-[10px] font-mono text-muted-foreground whitespace-pre-wrap break-all m-0",children:r}),i&&h.jsxs("div",{className:"mt-2",children:[h.jsx("span",{className:"text-[10px] font-mono font-medium text-destructive",children:"stderr"}),h.jsx("pre",{className:"text-[10px] font-mono text-destructive whitespace-pre-wrap break-all m-0 mt-0.5",children:i})]})]})})})}const TF=Vt.memo(SF);function _F(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 EF({agentId:t,relays:e}){const r=C.useMemo(()=>!e||!t?[]:e.filter(n=>n.fromAgentId===t||n.toAgentId===t),[e,t]);return r.length===0?null:h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Relays"}),h.jsx("div",{className:"space-y-0.5",children:r.map((n,i)=>{const s=n.direction==="result";return h.jsxs("div",{className:"flex items-start gap-1 text-[10px] font-mono",children:[h.jsx("span",{className:s?"text-foreground shrink-0":"text-muted-foreground shrink-0",children:s?"→":"←"}),h.jsx("span",{className:s?"text-foreground truncate":"text-muted-foreground truncate",title:n.messagePreview,children:n.messagePreview}),h.jsx("span",{className:"text-muted-foreground opacity-50 ml-auto shrink-0 tabular-nums",children:_F(n.timestamp)})]},n.id||i)})})]})}const NF=Vt.memo(EF),jF={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},Lg={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function tu(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 LF=Vt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Vt.useState(0);Vt.useEffect(()=>{if(!r)return;const l=setInterval(()=>i(c=>c+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 h.jsxs("span",{className:"tabular-nums",children:[o,"m ",String(a).padStart(2,"0"),"s"]})});function BF({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,b;const[a,l]=Vt.useState(null),[c,u]=Vt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Vt.useState(0),[p,f]=Vt.useState([]),m=Vt.useRef(null);return Vt.useEffect(()=>{const k=S=>u(S.detail);return window.addEventListener("compose:agent-status",k),()=>window.removeEventListener("compose:agent-status",k)},[]),Vt.useEffect(()=>{if(c.status!=="working")return;const k=setInterval(()=>d(S=>S+1),1e3);return()=>clearInterval(k)},[c.status]),Vt.useEffect(()=>{if(!t||t.length===0)return;const k=t[t.length-1];Array.isArray(k.items)&&k.items.length>0&&(f(k.items),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>f([]),3e4))},[t]),Vt.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),h.jsxs(h.Fragment,{children:[i&&i.length>0&&h.jsxs("div",{className:"flex items-center gap-0.5 mb-1.5 overflow-x-auto px-3",children:[h.jsx("button",{onClick:()=>l(null),className:nt("text-[10px] px-2 py-0.5 rounded cursor-pointer transition-colors border shrink-0",a?"bg-transparent text-muted-foreground border-border hover:text-foreground":"bg-primary text-primary-foreground border-primary"),children:"Session"}),i.map(k=>h.jsxs("span",{className:"flex items-center gap-0 shrink-0",children:[h.jsxs("button",{onClick:()=>l(k.agentId),className:nt("text-[10px] px-2 py-0.5 rounded-l cursor-pointer transition-colors border flex items-center gap-1 shrink-0",a===k.agentId?"bg-primary text-primary-foreground border-primary":"bg-transparent text-muted-foreground border-border hover:text-foreground"),children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:k.status==="killed"?"hsl(var(--destructive))":k.silent?"hsl(45 93% 47%)":k.status==="running"?"hsl(var(--success))":k.status==="complete"?"hsl(142 71% 45%)":"hsl(var(--destructive))",animation:k.status==="running"&&!k.silent?"phase-active-pulse 2s ease-in-out infinite":"none"}}),k.agentType,k.silent&&h.jsx("span",{className:"text-[8px] text-yellow-500 ml-0.5",title:"Agent silent",children:"!"})]}),k.status==="running"&&o&&h.jsx("button",{onClick:S=>{S.stopPropagation(),o(k.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"})]},k.agentId))]}),a?h.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[h.jsx(TF,{agentId:a,status:(x=i.find(k=>k.agentId===a))==null?void 0:x.status}),h.jsx(NF,{agentId:a,relays:s})]}):h.jsxs(h.Fragment,{children:[(r==null?void 0:r.featureCode)&&h.jsxs("div",{className:"px-3 py-1.5 mb-1 rounded bg-muted/50",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:"Working on"}),h.jsx("button",{className:"font-medium text-foreground hover:underline",onClick:()=>r.featureItemId&&(n==null?void 0:n(r.featureItemId)),children:r.featureCode})]}),r.phaseAtBind&&h.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:["Phase: ",r.phaseAtBind.replace(/_/g," ")]})]}),r&&h.jsxs("div",{className:"px-3 pb-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:r.active?"hsl(var(--primary))":"hsl(var(--success))"}}),h.jsx(LF,{startedAt:r.startedAt,active:r.active,duration:r.duration}),h.jsxs("span",{className:"tabular-nums",children:[r.toolCount||0," tools"]}),r.errorCount>0&&h.jsxs("span",{style:{color:"hsl(var(--destructive))"},children:[r.errorCount," err"]}),!r.active&&r.journalSpawned&&h.jsx("span",{style:{color:"hsl(var(--primary))"},children:"journal"})]}),((g=r.summaries)==null?void 0:g.length)>0&&h.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:(b=r.summaries[r.summaries.length-1])==null?void 0:b.summary})]}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("div",{className:"rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:c.status==="working"?"var(--color-category-writing)":"hsl(var(--success))",animation:c.status==="working"?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider",style:{color:c.status==="working"?"var(--color-category-writing)":"hsl(var(--muted-foreground))"},children:c.status==="working"?jF[c.category]||"Working":"Idle"}),c.status==="working"&&c.tool&&h.jsx("span",{className:"text-[10px] tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:c.tool}),c.status==="working"&&c.currentActivity&&h.jsx("span",{className:"text-[10px] tabular-nums ml-auto",style:{color:"hsl(var(--muted-foreground))",opacity:.6},children:tu(Date.now()-c.currentActivity.startTime)})]}),c.activityLog&&c.activityLog.length>0&&h.jsx("div",{className:"flex items-center gap-0.5 mt-1",children:c.activityLog.slice(-6).map((k,S,E)=>h.jsx("div",{className:"h-1 rounded-full",title:`${k.tool||"thinking"} — ${tu(k.duration)}`,style:{width:Math.max(4,Math.min(16,(k.duration||0)/1e3*2)),background:ym[k.category]||(c.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+S/E.length*.6}},S))}),t&&t.length>0&&h.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((k,S)=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px]",style:{color:k.error?"hsl(var(--destructive))":"hsl(var(--muted-foreground))"},children:[k.error&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"font-medium shrink-0",children:k.tool}),k.category&&!k.error&&h.jsx("span",{className:"shrink-0 opacity-50",style:{color:ym[k.category]},children:k.category}),k.error?h.jsx("span",{className:"truncate",title:k.error.type,children:Lg[k.error.type]||k.error.type}):k.detail?h.jsx("span",{className:"truncate opacity-60",title:k.detail,children:k.detail.split("/").pop()}):null]},S))}),p.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Working on"}),p.slice(0,3).map(k=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{children:k.status==="in_progress"?"◆":"◇"}),h.jsx("span",{className:"truncate",children:k.title})]},k.id))]}),e&&e.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--destructive))"},children:"Errors"}),e.slice(-3).map((k,S)=>h.jsxs("div",{className:"flex items-center gap-1 text-[10px] py-0.5",style:{color:"hsl(var(--destructive))"},children:[h.jsx("span",{className:"font-medium shrink-0",children:Lg[k.errorType]||k.errorType}),h.jsx("span",{className:"truncate opacity-70",title:k.message,children:k.message})]},S))]}),i&&i.length>0&&h.jsxs("div",{className:"mt-1.5",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider mb-0.5",style:{color:"hsl(var(--muted-foreground))"},children:"Subagents"}),i.map(k=>h.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] py-0.5",style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:k.status==="running"?"var(--color-category-executing)":k.status==="complete"?"hsl(var(--success))":"hsl(var(--destructive))",animation:k.status==="running"?"pulse 1.5s ease-in-out infinite":"none"}}),h.jsx("span",{className:"font-medium shrink-0",children:k.agentType}),h.jsx("span",{className:"truncate opacity-60",children:k.status}),h.jsx("span",{className:"tabular-nums ml-auto opacity-50",children:tu(Date.now()-new Date(k.startedAt).getTime())})]},k.agentId))]})]})})]})]})}const AF=Vt.memo(BF),zo={DECISION:1,PENDING_GATE:2,BLOCKED:3};function G1(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,zo.BLOCKED,"Blocked"),r.has(s.id)&&i(s,zo.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,zo.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function MF(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))),c=e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," "):"";return{isRunning:o,pct:l,stepLabel:c,featureCode:s||"",stepNum:r??0,totalSteps:n??0,status:i||""}}function V1(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=G1(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function IF(t,e){return t&&t===e?null:e}const FF={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"}},PF={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function ip({status:t,className:e}){const r=FF[t]||PF,n=t?t.replace(/_/g," "):"—";return h.jsxs("span",{className:nt("inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium",r.bg,r.text,e),children:[h.jsx("span",{className:nt("w-1 h-1 rounded-full shrink-0",r.dot)}),n]})}const DF={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"},OF="text-slate-400 bg-slate-500/10 border-slate-500/20";function $F({phase:t,className:e}){const r=DF[t]||OF;return h.jsx("span",{className:nt("inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-mono",r,e),children:t||"—"})}async function An(t,e={}){const r=await $t(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let eu=null;function Y1(t){if(eu)return;const e=window.location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${e}//${window.location.host}/ws/vision`);eu=r,r.onmessage=n=>{try{const i=JSON.parse(n.data);i.type==="ideaboxUpdated"&&t(i)}catch{}},r.onclose=()=>{eu=null,setTimeout(()=>{Y1(t)},3e3)},r.onerror=()=>{}}const As=Kf((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{Y1(()=>{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 An("/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 An("/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 An(`/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 An(`/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 An(`/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 An(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await An(`/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 An(`/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 RF({activeBuild:t}){const e=MF(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 h.jsxs("div",{className:"mx-3 mb-2 rounded-md p-2",style:{background:"hsl(var(--accent))"},children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Vl,{className:"h-3 w-3 shrink-0",style:{color:r}}),h.jsx("span",{className:"text-[10px] font-medium truncate max-w-[100px]",style:{color:"hsl(var(--foreground))"},children:e.featureCode||"Build"})]}),h.jsxs("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--muted-foreground))"},children:[e.stepNum,"/",e.totalSteps]})]}),h.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${e.pct}%`,background:r}})}),h.jsxs("div",{className:"flex items-center justify-between mt-1",children:[h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:e.stepLabel}),e.isRunning&&h.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 zF({items:t,gates:e,onSelectItem:r,onViewChange:n}){const i=Vt.useMemo(()=>G1(t,e),[t,e]);if(i.length===0)return null;const s=i.slice(0,5),o=i.length-s.length,a=l=>l===zo.BLOCKED?h.jsx(Vc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):l===zo.PENDING_GATE?h.jsx(vI,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):h.jsx(SM,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--muted-foreground))"}});return h.jsxs("div",{className:"px-2 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Needs Attention"}),s.map(({item:l,priority:c,reason:u})=>h.jsxs("button",{onClick:()=>r==null?void 0:r(l.id),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors hover:bg-sidebar-accent/50",style:{color:"hsl(var(--muted-foreground))"},title:u,children:[a(c),h.jsx("span",{className:"truncate flex-1 text-left",children:l.title}),l.phase&&h.jsx($F,{phase:l.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),h.jsx(ip,{status:l.status,className:"shrink-0"})]},l.id)),o>0&&h.jsxs("button",{onClick:()=>n==null?void 0:n("attention"),className:"flex w-full items-center px-2 py-0.5 text-[10px] rounded-md hover:bg-sidebar-accent/50 transition-colors",style:{color:"hsl(var(--muted-foreground))"},children:["+",o," more"]})]})}function WF({items:t,gates:e}){const r=Vt.useMemo(()=>V1(t,e),[t,e]);return r.total===0?null:h.jsxs("div",{className:"flex items-center gap-2 flex-wrap px-3 pb-1",children:[h.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.total," items"]}),r.inProgress>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--primary))"},children:[r.inProgress," active"]}),r.blocked>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--destructive))"},children:[r.blocked," blocked"]}),r.pendingGates>0&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--warning))"},children:[r.pendingGates," ",r.pendingGates===1?"gate":"gates"]})]})}const qF=new Set(["planned","ready","in_progress","review","blocked","parked"]);function HF({items:t,hiddenGroups:e,onToggleGroup:r}){const n=Vt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!qF.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:h.jsx(h.Fragment,{children:n.map(({group:i,count:s,active:o})=>{const a=e==null?void 0:e.has(i);return h.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:[h.jsx("span",{className:"truncate flex-1 text-left",children:i}),o>0&&h.jsx("span",{className:"text-[10px] tabular-nums",style:{color:"hsl(var(--primary))"},children:o}),h.jsx("span",{className:"text-[10px] tabular-nums shrink-0",style:{color:"hsl(var(--muted-foreground))"},children:s})]},i)})})}function UF({onViewChange:t}){const e=As(n=>n.ideas),r=Vt.useMemo(()=>e.filter(n=>!n.priority||n.priority==="—").length,[e]);return r===0?null:h.jsxs("div",{className:"px-2 mb-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Ideas"}),h.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:[h.jsx(Ci,{className:"h-3 w-3 shrink-0 text-amber-400"}),h.jsxs("span",{className:"flex-1 text-left",children:[r," untriaged"]})]})]})}function X1({items:t,gates:e,activeBuild:r,onViewChange:n,selectedPhase:i,onPhaseSelect:s,selectedTrack:o,onTrackSelect:a,visibleTracks:l,onToggleVisibleTrack:c,onShowAllTracks:u,hiddenGroups:d,onToggleGroup:p,searchQuery:f,onSearchChange:m,connected:x,agentActivity:g,agentErrors:y,spawnedAgents:b,agentRelays:k,sessionState:S,onSelectItem:E,onStopAgent:w,onThemeChange:T,onNewItem:N,widthPx:F}){const L=t||[],B=e||[],W=Vt.useMemo(()=>V1(L,B),[L,B]),[G,O]=Vt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Vt.useEffect(()=>{if(typeof document>"u")return;const M=new MutationObserver(()=>{O(document.documentElement.classList.contains("dark"))});return M.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>M.disconnect()},[]);const I=Vt.useCallback(()=>{const M=!G,P=M?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",M);try{localStorage.setItem("compose:theme",P)}catch{}T&&T({ui:{theme:P}})},[G,T]);return Vt.useCallback(M=>{s&&s(IF(i,M))},[s,i]),h.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:F??208},children:[h.jsxs("div",{className:"p-3 pb-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-sm font-semibold text-sidebar-foreground",children:"Compose"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[!x&&h.jsx("span",{className:"text-[10px] text-destructive",children:"disconnected"}),N&&h.jsx("button",{onClick:N,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:"New item (⌘N)",children:h.jsx(l1,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:I,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:G?"Switch to light mode":"Switch to dark mode",children:G?h.jsx(NI,{className:"h-3.5 w-3.5"}):h.jsx(hI,{className:"h-3.5 w-3.5"})})]})]}),h.jsx(WF,{items:L,gates:B})]}),h.jsx(RF,{activeBuild:r}),h.jsx(AF,{agentActivity:g,agentErrors:y,sessionState:S,onSelectItem:E,onStopAgent:w,spawnedAgents:b,agentRelays:k}),W.attentionCount>0&&h.jsxs(h.Fragment,{children:[h.jsx(Ql,{className:"bg-sidebar-border"}),h.jsx(zF,{items:L,gates:B,onSelectItem:E,onViewChange:n})]}),h.jsx(UF,{onViewChange:n}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("div",{className:"relative",children:[h.jsx(Zn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Xc,{placeholder:"Search...",value:f,onChange:M=>m(M.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),h.jsx(Ql,{className:"bg-sidebar-border"}),h.jsx(Hn,{className:"flex-1",children:h.jsxs("div",{className:"p-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider px-2 mb-1",style:{color:"hsl(var(--muted-foreground))"},children:"Groups"}),h.jsx(HF,{items:L,hiddenGroups:d,onToggleGroup:p})]})})]})}function GF({level:t,size:e=4}){return h.jsx("div",{className:"flex items-center gap-px",children:[0,1,2,3].map(r=>h.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 ka({featureCode:t,active:e,onToggle:r}){return t?h.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}const Bg=[{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"]}],VF=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function Ag({active:t,onClick:e,children:r}){return h.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 K1({item:t,children:e,depth:r,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o}){const a=e.length>0,l=o.has(t.id),c=n===t.id,u=mr[t.type]||mr.task,d=qn[t.status]||qn.planned,{newIds:p,changedIds:f}=C.useContext(Yc),m=p.has(t.id),x=f.has(t.id);return h.jsxs("div",{children:[h.jsxs("div",{"data-item-id":t.id,onClick:()=>i(t.id),className:nt("flex items-center gap-1.5 py-1 px-2 cursor-pointer transition-colors rounded-md","hover:bg-accent/5",c&&"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:[h.jsx("button",{onClick:g=>{g.stopPropagation(),a&&s(t.id)},className:nt("shrink-0 w-4 h-4 flex items-center justify-center rounded",a?"text-muted-foreground hover:text-foreground":"invisible"),children:a&&(l?h.jsx(Ca,{className:"h-3.5 w-3.5"}):h.jsx(js,{className:"h-3.5 w-3.5"}))}),h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:d}}),h.jsx("span",{className:"text-[9px] uppercase tracking-wider shrink-0 w-12",style:{color:u},children:t.type}),h.jsx("span",{className:nt("text-sm text-foreground truncate flex-1",t.status==="killed"&&"line-through opacity-50"),children:t.title}),h.jsx(GF,{level:t.confidence||0}),t.phase&&h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-3.5 shrink-0",children:t.phase})]}),a&&l&&h.jsx("div",{children:e.map(g=>h.jsx(K1,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function Z1({items:t,connections:e,selectedItemId:r,onSelect:n,onCreate:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,c]=C.useState(()=>new Set),[u,d]=C.useState(""),[p,f]=C.useState("all"),[m,x]=C.useState("all"),g=C.useCallback(E=>{c(w=>{const T=new Set(w);return T.has(E)?T.delete(E):T.add(E),T})},[]),y=C.useMemo(()=>{let E=t;const w=Bg.find(T=>T.key===p);if(w!=null&&w.statuses&&(E=E.filter(T=>w.statuses.includes(T.status||"planned"))),m!=="all"&&(E=E.filter(T=>T.type===m)),u){const T=u.toLowerCase();E=E.filter(N=>(N.title||"").toLowerCase().includes(T)||(N.description||"").toLowerCase().includes(T)||(N.type||"").toLowerCase().includes(T)||(N.phase||"").toLowerCase().includes(T))}return o&&s&&(E=E.filter(T=>{var N;return T.featureCode===s||((N=T.lifecycle)==null?void 0:N.featureCode)===s||(T.title||"").includes(s)})),E},[t,u,p,m,o,s]),b=C.useMemo(()=>{const E=new Set(y.map(L=>L.id)),w=new Map;for(const L of y)w.set(L.id,{...L,_children:[]});const T=new Map;for(const L of e)!E.has(L.fromId)||!E.has(L.toId)||(L.type==="informs"?T.has(L.toId)||T.set(L.toId,L.fromId):(L.type==="supports"||L.type==="blocks")&&(T.has(L.fromId)||T.set(L.fromId,L.toId)));for(const L of t)L.parentId&&w.has(L.parentId)&&T.set(L.id,L.parentId);for(const[L]of T){const B=new Set;let W=L;for(;W&&T.has(W);){if(B.has(W)){T.delete(W);break}B.add(W),W=T.get(W)}}const N=[];for(const L of w.values()){const B=T.get(L.id);B&&w.has(B)?w.get(B)._children.push(L):N.push(L)}const F=L=>{L.sort((B,W)=>(B.confidence||0)-(W.confidence||0));for(const B of L)B._children.length>0&&F(B._children)};return F(N),N},[y,e]);Vt.useEffect(()=>{if(u){const E=new Set,w=T=>{for(const N of T)N._children.length>0&&(E.add(N.id),w(N._children))};w(b),c(E)}else l.size===0&&b.length>0&&c(new Set(b.map(E=>E.id)))},[b,u]),Vt.useEffect(()=>{if(!r||b.length===0)return;const E=[],w=(T,N)=>{for(const F of T){if(F.id===N)return!0;if(F._children.length>0&&w(F._children,N))return E.push(F.id),!0}return!1};w(b,r),E.length>0&&c(T=>{const N=new Set(T);for(const F of E)N.add(F);return N}),requestAnimationFrame(()=>{const T=document.querySelector(`[data-item-id="${r}"]`);T&&T.scrollIntoView({block:"center",behavior:"smooth"})})},[r,b]);const k=C.useCallback(()=>{const E=new Set,w=T=>{for(const N of T)N._children.length>0&&(E.add(N.id),w(N._children))};w(b),c(E)},[b]),S=C.useCallback(()=>{c(new Set)},[]);return b.filter(E=>E._children.length>0).length,h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[h.jsx(ka,{featureCode:s,active:o,onToggle:a}),h.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[h.jsx(Zn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Xc,{placeholder:"Search items...",value:u,onChange:E=>d(E.target.value),className:"h-7 pl-7 pr-7 text-xs"}),u&&h.jsx("button",{onClick:()=>d(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h.jsx(ln,{className:"h-3 w-3"})})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Status:"}),Bg.map(E=>h.jsx(Ag,{active:p===E.key,onClick:()=>f(E.key),children:E.label},E.key))]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground mr-0.5",children:"Type:"}),VF.map(E=>h.jsx(Ag,{active:m===E.key,onClick:()=>x(E.key),children:E.label},E.key))]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[y.length,u||p!=="all"||m!=="all"?`/${t.length}`:""]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:k,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Expand"}),h.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&&h.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:h.jsx(l1,{className:"h-3.5 w-3.5"})})]}),h.jsx(Hn,{className:"flex-1",children:h.jsx("div",{className:"py-1",children:b.length===0?h.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No items to display"}):b.map(E=>h.jsx(K1,{item:E,children:E._children,depth:0,selectedItemId:r,onSelect:n,onToggle:g,expandedIds:l},E.id))})})]})}try{ma.use($y)}catch{}try{ma.use(oE)}catch{}const Jl={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},YF=Object.fromEntries(Object.entries(mr).map(([t,e])=>{const r=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16),s=[15,23,42],o=.15,a=[Math.round(s[0]*(1-o)+r*o),Math.round(s[1]*(1-o)+n*o),Math.round(s[2]*(1-o)+i*o)];return[t,`#${a.map(l=>l.toString(16).padStart(2,"0")).join("")}`]})),XF=[1,1.5,2,2.5,3],ld={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"}},Mg=[{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 Eo(t){return t.group||"other"}const Ig=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,ru=24;function KF(t){if(!t||t.length<=ru)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>ru-1)break;r=i}return(r||t.slice(0,ru-1))+"…"}function ZF(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&Ig.test(e))return e;if(t.id&&Ig.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?KF(t.slug):t.id?t.id.slice(0,12):"item"}function Fg(t,e=18){const r=t.split("-"),n=[];let i="";for(const s of r){const o=i?i+"-"+s:s;o.length>e&&i?(n.push(i),i=s):i=o}return i&&n.push(i),n.join(`
339
- `)}function QF(t,e,r,n,i){var c;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(p=>Eo(p)).filter(Boolean))].map(p=>{const f=t.filter(y=>Eo(y)===p),m=f.filter(y=>["blocked","parked"].includes(y.status)).length,x=f.filter(y=>["in_progress","review","ready"].includes(y.status)).length,g=f.filter(y=>y.status==="planned").length;return{group:p,blocked:m,active:x,planned:g,total:f.length}});d.sort((p,f)=>f.active-p.active||f.blocked-p.blocked||f.planned-p.planned||p.group.localeCompare(f.group));for(const{group:p,active:f,total:m}of d){if(m<2)continue;l.add(p);const x=a&&t.some(g=>Eo(g)===p&&a.has(g.id));s.push({data:{id:`group-${p}`,label:`${Fg(p)}
340
- (${f} active, ${m} total)`,isGroup:!0,groupType:p},...a&&!x?{classes:"focus-dimmed"}:{}})}}for(const u of t){const d=u.slug||u.id.slice(0,8),p=Fg(ZF(u),14),f=Eo(u),m=a&&!a.has(u.id);s.push({data:{id:u.id,label:p,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:((c=u.lifecycle)==null?void 0:c.featureCode)||u.featureCode||null,group:f||null,...r&&f&&l.has(f)?{parent:`group-${f}`}:{}},...m?{classes:"focus-dimmed"}:{}})}for(const u of e){if(!o.has(u.fromId)||!o.has(u.toId))continue;let d,p;u.type==="supports"||u.type==="blocks"?(d=u.toId,p=u.fromId):(d=u.fromId,p=u.toId);const f=ld[u.type]||ld.informs;s.push({data:{id:u.id||`${u.fromId}-${u.toId}`,source:d,target:p,edgeType:u.type,edgeColor:f.color,edgeStyle:f.style}})}return s}function JF(){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(Jl).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(YF).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...XF.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 t4({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=Jl[n.status]||Jl.planned,s=mr[n.itemType]||"#94a3b8",o=e+300>window.innerWidth?e-294:e+14,a=Math.min(r-10,window.innerHeight-200);return h.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:[h.jsx("div",{style:{fontWeight:700,fontSize:13,color:"#f8fafc",marginBottom:3},children:n.slug}),h.jsx("div",{style:{color:"#94a3b8",marginBottom:6,lineHeight:1.4},children:n.title}),h.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[h.jsx(nu,{color:i,children:(n.status||"planned").replace("_"," ")}),h.jsx(nu,{color:s,children:n.itemType}),n.phase&&h.jsx(nu,{color:"#94a3b8",children:Rl[n.phase]||n.phase})]}),n.description&&h.jsx("div",{style:{marginTop:8,color:"#94a3b8",fontSize:11,lineHeight:1.4},children:n.description.length>140?n.description.slice(0,140)+"…":n.description}),h.jsxs("div",{style:{marginTop:6,color:"#64748b",fontSize:10},children:[Sf[n.confidence||0]," confidence"]})]})}function e4({data:t,onApply:e,onClose:r}){const{x:n,y:i,currentGroup:s}=t,[o,a]=C.useState(s||""),l=C.useRef(null);C.useEffect(()=>{var p,f;(p=l.current)==null||p.focus(),(f=l.current)==null||f.select()},[]),C.useEffect(()=>{const p=f=>{f.key==="Escape"&&r()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),C.useEffect(()=>{const p=m=>{const x=document.getElementById("group-change-popover-root");x&&!x.contains(m.target)&&r()},f=setTimeout(()=>window.addEventListener("mousedown",p),0);return()=>{clearTimeout(f),window.removeEventListener("mousedown",p)}},[r]);const c=n+240>window.innerWidth?n-234:n+14,u=Math.min(i-10,window.innerHeight-120),d=()=>e(o.trim());return h.jsxs("div",{id:"group-change-popover-root","data-testid":"group-change-popover",style:{position:"fixed",left:c,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:[h.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Change group"}),h.jsx("input",{ref:l,type:"text",value:o,onChange:p=>a(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.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"}}),h.jsxs("div",{style:{display:"flex",gap:6,marginTop:8,justifyContent:"flex-end"},children:[h.jsx("button",{onClick:r,style:{fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",background:"transparent",color:"#94a3b8",border:"1px solid #334155"},children:"Cancel"}),h.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 nu({color:t,children:e}){return h.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 Q1={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function co({active:t,onClick:e,children:r}){return h.jsx("button",{onClick:e,style:{...Q1,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function iu({onClick:t,children:e,title:r}){return h.jsx("button",{onClick:t,title:r,style:{...Q1,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function Za(){return h.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const r4=["build-building","build-gate-pending","build-blocked-downstream","build-error"],n4={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 i4({badge:t,onClick:e}){const r=n4[t.state];return r?h.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 s4({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 c=l.stepId?l.stepId.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()):"Gate";return h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{position:"fixed",inset:0,zIndex:199},onClick:s}),h.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:[h.jsx("div",{style:{fontSize:10,color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:4},children:c}),h.jsx("div",{style:{fontSize:12,color:"#f8fafc",fontWeight:600,marginBottom:8},children:t}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.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"}),h.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"}),h.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 J1({items:t,connections:e,selectedItemId:r,onSelect:n,visibleTracks:i,hiddenGroups:s,buildStateMap:o,resolveGate:a,gates:l,spawnedAgents:c,agentRelays:u,agentOverlay:d,featureCode:p,focusActive:f,onToggleFocus:m}){const x=C.useRef(null),g=C.useRef(null),y=C.useRef({}),b=C.useRef(!1),k=C.useRef({}),S=C.useRef(null),[E,w]=C.useState(null),[T,N]=C.useState("active"),[F,L]=C.useState(!0),[B,W]=C.useState(!1),[G,O]=C.useState(null),[I,M]=C.useState(null),[P,$]=C.useState([]),[D,_]=C.useState(!1),[R,X]=C.useState(!1),A=As(V=>V.ideas);C.useEffect(()=>{let V=!1;return $t("/api/graph/layout").then(it=>it.ok?it.json():{positions:{}}).then(it=>{if(V)return;y.current=it.positions||{},b.current=!0;const ut=g.current;ut&&J(ut)}).catch(()=>{b.current=!0}),()=>{V=!0}},[]);const ct=C.useCallback(()=>{const V=k.current;k.current={},S.current=null,Object.keys(V).length&&$t("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:V})}).catch(it=>console.warn("[graph-layout] save failed:",it))},[]),st=C.useCallback(V=>{Object.assign(k.current,V),Object.assign(y.current,V),S.current&&clearTimeout(S.current),S.current=setTimeout(ct,500)},[ct]),J=C.useCallback(V=>{const it=y.current,ut={};V.nodes("node[status]").forEach(jt=>{const tt=jt.data();if(tt.isAgentNode||tt.isIdeaNode)return;const mt=jt.id(),U=it[mt];if(U&&Number.isFinite(U.x)&&Number.isFinite(U.y))jt.position({x:U.x,y:U.y});else{const et=jt.position();Number.isFinite(et.x)&&Number.isFinite(et.y)&&(ut[mt]={x:et.x,y:et.y})}}),Object.keys(ut).length&&st(ut)},[st]),yt=C.useRef(!1);C.useEffect(()=>{const V=c==null?void 0:c.some(it=>it.status==="running");V&&!yt.current?_(!0):!V&&yt.current&&(c==null?void 0:c.length)>0&&_(!1),yt.current=!!V},[c]);const Ot=C.useMemo(()=>t.filter(V=>{const it=V.title||"";return!it.startsWith("`docs/")&&!it.startsWith("docs/")}),[t]),lt=C.useMemo(()=>{let V=Ot;const it=Mg.find(ut=>ut.key===T);if(it!=null&&it.statuses&&(V=V.filter(ut=>it.statuses.includes(ut.status||"planned"))),i){const ut=jt=>{const tt=(jt.description||"").match(/Track:\s*(\w+)/i);return tt?tt[1].toLowerCase():jt.type||"other"};V=V.filter(jt=>i.has(ut(jt)))}return(s==null?void 0:s.size)>0&&(V=V.filter(ut=>!s.has(Eo(ut)))),V},[Ot,T,i,s]),Z=C.useMemo(()=>{const V=new Set(lt.map(it=>it.id));return e.filter(it=>V.has(it.fromId)&&V.has(it.toId))},[e,lt]),at=C.useMemo(()=>!d||!d.nodes.length?[]:[...d.nodes,...d.edges],[c]),vt=C.useMemo(()=>{if(!R)return[];new Set(lt.map(it=>it.id));const V=[];for(const it of A){if(!it.mapsTo)continue;const ut=`idea-${it.id}`;V.push({data:{id:ut,label:`${it.id}
341
- ${it.title.slice(0,20)}${it.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:it.id},classes:"idea-node"});const jt=it.mapsTo.split(",").map(tt=>tt.trim()).filter(Boolean);for(const tt of jt){const mt=lt.find(U=>{var et;return((et=U.lifecycle)==null?void 0:et.featureCode)===tt||U.featureCode===tt||(U.title||"").startsWith(tt)});mt&&V.push({data:{id:`idea-edge-${it.id}-${mt.id}`,source:ut,target:mt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return V},[R,A,lt]),Et=C.useMemo(()=>{let it=QF(lt,Z,F,f,p);return D&&at.length>0&&(it=[...it,...at]),R&&vt.length>0&&(it=[...it,...vt]),it},[lt,Z,F,D,at,R,vt,f,p]),Mt=C.useMemo(()=>JF(),[]);C.useEffect(()=>{if(!x.current)return;g.current&&(g.current.destroy(),g.current=null);const V=ma({container:x.current,elements:Et,style:Mt,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(g.current=V,V.one("layoutstop",()=>{b.current&&J(V),V.fit(void 0,30)}),V.fit(void 0,30),V.on("dragfree","node[status]",it=>{const ut=it.target,jt=ut.data();if(jt.isAgentNode||jt.isIdeaNode)return;const tt=ut.position();!Number.isFinite(tt.x)||!Number.isFinite(tt.y)||st({[ut.id()]:{x:tt.x,y:tt.y}})}),r){const it=V.$id(r);it.length&&su(V,it)}return V.on("mouseover","node[status]",it=>{const ut=it.renderedPosition||it.position,jt=V.container().getBoundingClientRect();w({x:jt.left+ut.x,y:jt.top+ut.y,item:it.target.data()})}),V.on("mousemove","node[status]",it=>{const ut=it.renderedPosition||it.position,jt=V.container().getBoundingClientRect();w(tt=>tt?{x:jt.left+ut.x,y:jt.top+ut.y,item:tt.item}:null)}),V.on("mouseout","node[status]",()=>w(null)),V.on("tap","node[status]",it=>{re.current=!0,su(V,it.target),n(it.target.id())}),V.on("tap",it=>{it.target===V&&V.elements().removeClass("dimmed highlighted")}),V.on("cxttap","node[status]",it=>{var mt;const ut=it.target.data();if(ut.isAgentNode||ut.isIdeaNode||ut.isGroup)return;try{(mt=it.originalEvent)==null||mt.preventDefault()}catch{}const jt=it.renderedPosition||it.position,tt=V.container().getBoundingClientRect();M({x:tt.left+jt.x,y:tt.top+jt.y,itemId:it.target.id(),currentGroup:ut.group||""}),w(null)}),V.container().addEventListener("contextmenu",it=>it.preventDefault()),()=>{S.current&&(clearTimeout(S.current),ct()),V.destroy(),g.current=null}},[Et,Mt]);const re=C.useRef(!1);C.useEffect(()=>{const V=g.current;if(!V||!r)return;const it=V.$id(r);it.length&&(V.elements().removeClass("dimmed highlighted"),su(V,it),re.current||V.animate({center:{eles:it},duration:200}),re.current=!1)},[r]),C.useEffect(()=>{const V=g.current;if(V&&(V.nodes().removeClass(r4.join(" ")),!(!o||Object.keys(o).length===0)))for(const[it,ut]of Object.entries(o)){const jt=`build-${ut.replace(/_/g,"-")}`,tt=V.nodes().filter(mt=>{const U=mt.data();return U.slug===it||U.title===it||U.featureCode===it});tt.length&&tt.addClass(jt)}},[o]),C.useEffect(()=>{const V=g.current;if(!V||!o||!Object.values(o).includes("building"))return;let ut=!0;const jt=setInterval(()=>{const tt=V.nodes(".build-building");tt.length&&(ut=!ut,tt.style("shadow-blur",ut?12:4),tt.style("shadow-opacity",ut?.6:.2))},800);return()=>clearInterval(jt)},[o]),C.useEffect(()=>{var tt;const V=g.current;if(!V||(V.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!D||!((tt=d==null?void 0:d.activeEdgeIds)!=null&&tt.size)))return;const it=new Set((c||[]).map(mt=>mt.agentId)),ut=mt=>mt==="session"?"agent-session":it.has(mt)?`agent-${mt}`:"agent-session";for(const mt of d.activeEdgeIds){const U=V.getElementById(mt);if(U.length){const et=u==null?void 0:u.findLast(Tt=>{const zt=ut(Tt.fromAgentId),Yt=ut(Tt.toAgentId);return(Tt.direction==="dispatch"?`relay-${zt}-${Yt}`:`relay-${Yt}-${zt}`)===mt});U.addClass((et==null?void 0:et.direction)==="result"?"relay-result":"relay-active")}}const jt=setInterval(()=>{const mt=V.edges(".relay-active, .relay-result");if(!mt.length)return;const U=Date.now()/20%100;mt.style("line-dash-offset",-U)},50);return()=>clearInterval(jt)},[D,d==null?void 0:d.activeEdgeIds,u]);const xe=C.useCallback(()=>{const V=g.current;if(!V||!o||Object.keys(o).length===0){$([]);return}const it=[];for(const[ut,jt]of Object.entries(o)){if(jt!=="gate_pending"&&jt!=="error"&&jt!=="building")continue;const tt=V.nodes().filter(et=>{const Tt=et.data();return Tt.slug===ut||Tt.title===ut||Tt.featureCode===ut});if(!tt.length)continue;const mt=tt.renderedPosition(),U=tt.renderedOuterWidth();it.push({featureCode:ut,state:jt,x:mt.x+U/2-6,y:mt.y-tt.renderedOuterHeight()/2-6,nodeId:tt.id()})}$(it)},[o]);C.useEffect(()=>{const V=g.current;if(V)return V.on("render pan zoom",xe),xe(),()=>{V.removeListener("render pan zoom",xe)}},[xe]);const Re=C.useCallback(()=>{var V;return(V=g.current)==null?void 0:V.fit(void 0,40)},[]),Kt=C.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()*1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]),_e=C.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()/1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]);return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",style:{background:"#0f172a"},children:[h.jsx("div",{className:"shrink-0",style:{background:"#1e293b",borderBottom:"1px solid #334155"},children:h.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ka,{featureCode:p,active:f,onToggle:m}),p&&h.jsx(Za,{}),h.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),Mg.map(V=>h.jsx(co,{active:T===V.key,onClick:()=>N(V.key),children:V.label},V.key)),h.jsx(Za,{}),h.jsxs("span",{style:{fontSize:10,color:"#475569"},children:[lt.length," items · ",Z.length," edges"]})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(co,{active:F,onClick:()=>L(!F),children:"Group"}),h.jsx(co,{active:D,onClick:()=>_(V=>!V),title:"Show/hide agent topology",children:"Agents"}),h.jsx(co,{active:R,onClick:()=>X(V=>!V),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),h.jsx(Za,{}),h.jsx(iu,{onClick:_e,title:"Zoom out",children:"−"}),h.jsx(iu,{onClick:Re,title:"Fit to view",children:"Fit"}),h.jsx(iu,{onClick:Kt,title:"Zoom in",children:"+"}),h.jsx(Za,{}),h.jsx(co,{active:B,onClick:()=>W(!B),children:"Legend"})]})]})}),lt.length===0&&!D?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsxs("div",{style:{textAlign:"center"},children:[h.jsx("div",{style:{fontSize:12,color:"#64748b",marginBottom:6},children:"No items match the current filters"}),h.jsx("div",{style:{fontSize:11,color:"#475569"},children:"Try adjusting the status or group filters"})]})}):h.jsxs("div",{className:"flex-1 relative min-h-0",children:[h.jsx("div",{ref:x,className:"w-full h-full"}),B&&h.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:[h.jsx(ou,{title:"Types",children:Object.entries(mr).map(([V,it])=>h.jsxs(lu,{children:[h.jsx(Pg,{color:it}),V]},V))}),h.jsx(au,{}),h.jsx(ou,{title:"Status",children:Object.entries(Jl).map(([V,it])=>h.jsxs(lu,{children:[h.jsx(Pg,{color:it}),V.replace("_"," ")]},V))}),h.jsx(au,{}),h.jsx(ou,{title:"Edges",children:Object.entries(ld).map(([V,it])=>h.jsxs(lu,{children:[h.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:h.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:it.color,strokeWidth:"1.5",strokeDasharray:it.style==="dashed"?"6,3":"none"})}),V]},V))}),h.jsx(au,{}),h.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",h.jsx("br",{}),"Click node to trace deps"]})]}),h.jsx(t4,{data:E}),I&&h.jsx(e4,{data:I,onClose:()=>M(null),onApply:V=>{const it=I.itemId;M(null),$t(`/api/vision/items/${it}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:V||null})}).catch(ut=>console.warn("[graph] group update failed:",ut))}}),P.map(V=>h.jsx(i4,{badge:V,onClick:V.state==="gate_pending"?()=>O(G===V.featureCode?null:V.featureCode):V.state==="error"?()=>n(V.nodeId):void 0},V.featureCode)),G&&h.jsx(s4,{featureCode:G,gates:l,items:t,badgePositions:P,onResolve:(V,it)=>{a&&a(V,it),O(null)},onClose:()=>O(null)})]})]})}function su(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 ou({title:t,children:e}){return h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{fontSize:10,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:5,fontWeight:700},children:t}),e]})}function au(){return h.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function lu({children:t}){return h.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function Pg({color:t}){return h.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var Tl={exports:{}},o4=Tl.exports,Dg;function a4(){return Dg||(Dg=1,(function(t,e){(function(r,n){t.exports=n()})(o4,(function(){var r=1e3,n=6e4,i=36e5,s="millisecond",o="second",a="minute",l="hour",c="day",u="week",d="month",p="quarter",f="year",m="date",x="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={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(O){var I=["th","st","nd","rd"],M=O%100;return"["+O+(I[(M-20)%10]||I[M]||I[0])+"]"}},k=function(O,I,M){var P=String(O);return!P||P.length>=I?O:""+Array(I+1-P.length).join(M)+O},S={s:k,z:function(O){var I=-O.utcOffset(),M=Math.abs(I),P=Math.floor(M/60),$=M%60;return(I<=0?"+":"-")+k(P,2,"0")+":"+k($,2,"0")},m:function O(I,M){if(I.date()<M.date())return-O(M,I);var P=12*(M.year()-I.year())+(M.month()-I.month()),$=I.clone().add(P,d),D=M-$<0,_=I.clone().add(P+(D?-1:1),d);return+(-(P+(M-$)/(D?$-_:_-$))||0)},a:function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},p:function(O){return{M:d,y:f,w:u,d:c,D:m,h:l,m:a,s:o,ms:s,Q:p}[O]||String(O||"").toLowerCase().replace(/s$/,"")},u:function(O){return O===void 0}},E="en",w={};w[E]=b;var T="$isDayjsObject",N=function(O){return O instanceof W||!(!O||!O[T])},F=function O(I,M,P){var $;if(!I)return E;if(typeof I=="string"){var D=I.toLowerCase();w[D]&&($=D),M&&(w[D]=M,$=D);var _=I.split("-");if(!$&&_.length>1)return O(_[0])}else{var R=I.name;w[R]=I,$=R}return!P&&$&&(E=$),$||!P&&E},L=function(O,I){if(N(O))return O.clone();var M=typeof I=="object"?I:{};return M.date=O,M.args=arguments,new W(M)},B=S;B.l=F,B.i=N,B.w=function(O,I){return L(O,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var W=(function(){function O(M){this.$L=F(M.locale,null,!0),this.parse(M),this.$x=this.$x||M.x||{},this[T]=!0}var I=O.prototype;return I.parse=function(M){this.$d=(function(P){var $=P.date,D=P.utc;if($===null)return new Date(NaN);if(B.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var _=$.match(g);if(_){var R=_[2]-1||0,X=(_[7]||"0").substring(0,3);return D?new Date(Date.UTC(_[1],R,_[3]||1,_[4]||0,_[5]||0,_[6]||0,X)):new Date(_[1],R,_[3]||1,_[4]||0,_[5]||0,_[6]||0,X)}}return new Date($)})(M),this.init()},I.init=function(){var M=this.$d;this.$y=M.getFullYear(),this.$M=M.getMonth(),this.$D=M.getDate(),this.$W=M.getDay(),this.$H=M.getHours(),this.$m=M.getMinutes(),this.$s=M.getSeconds(),this.$ms=M.getMilliseconds()},I.$utils=function(){return B},I.isValid=function(){return this.$d.toString()!==x},I.isSame=function(M,P){var $=L(M);return this.startOf(P)<=$&&$<=this.endOf(P)},I.isAfter=function(M,P){return L(M)<this.startOf(P)},I.isBefore=function(M,P){return this.endOf(P)<L(M)},I.$g=function(M,P,$){return B.u(M)?this[P]:this.set($,M)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(M,P){var $=this,D=!!B.u(P)||P,_=B.p(M),R=function(lt,Z){var at=B.w($.$u?Date.UTC($.$y,Z,lt):new Date($.$y,Z,lt),$);return D?at:at.endOf(c)},X=function(lt,Z){return B.w($.toDate()[lt].apply($.toDate("s"),(D?[0,0,0,0]:[23,59,59,999]).slice(Z)),$)},A=this.$W,ct=this.$M,st=this.$D,J="set"+(this.$u?"UTC":"");switch(_){case f:return D?R(1,0):R(31,11);case d:return D?R(1,ct):R(0,ct+1);case u:var yt=this.$locale().weekStart||0,Ot=(A<yt?A+7:A)-yt;return R(D?st-Ot:st+(6-Ot),ct);case c:case m:return X(J+"Hours",0);case l:return X(J+"Minutes",1);case a:return X(J+"Seconds",2);case o:return X(J+"Milliseconds",3);default:return this.clone()}},I.endOf=function(M){return this.startOf(M,!1)},I.$set=function(M,P){var $,D=B.p(M),_="set"+(this.$u?"UTC":""),R=($={},$[c]=_+"Date",$[m]=_+"Date",$[d]=_+"Month",$[f]=_+"FullYear",$[l]=_+"Hours",$[a]=_+"Minutes",$[o]=_+"Seconds",$[s]=_+"Milliseconds",$)[D],X=D===c?this.$D+(P-this.$W):P;if(D===d||D===f){var A=this.clone().set(m,1);A.$d[R](X),A.init(),this.$d=A.set(m,Math.min(this.$D,A.daysInMonth())).$d}else R&&this.$d[R](X);return this.init(),this},I.set=function(M,P){return this.clone().$set(M,P)},I.get=function(M){return this[B.p(M)]()},I.add=function(M,P){var $,D=this;M=Number(M);var _=B.p(P),R=function(ct){var st=L(D);return B.w(st.date(st.date()+Math.round(ct*M)),D)};if(_===d)return this.set(d,this.$M+M);if(_===f)return this.set(f,this.$y+M);if(_===c)return R(1);if(_===u)return R(7);var X=($={},$[a]=n,$[l]=i,$[o]=r,$)[_]||1,A=this.$d.getTime()+M*X;return B.w(A,this)},I.subtract=function(M,P){return this.add(-1*M,P)},I.format=function(M){var P=this,$=this.$locale();if(!this.isValid())return $.invalidDate||x;var D=M||"YYYY-MM-DDTHH:mm:ssZ",_=B.z(this),R=this.$H,X=this.$m,A=this.$M,ct=$.weekdays,st=$.months,J=$.meridiem,yt=function(Z,at,vt,Et){return Z&&(Z[at]||Z(P,D))||vt[at].slice(0,Et)},Ot=function(Z){return B.s(R%12||12,Z,"0")},lt=J||function(Z,at,vt){var Et=Z<12?"AM":"PM";return vt?Et.toLowerCase():Et};return D.replace(y,(function(Z,at){return at||(function(vt){switch(vt){case"YY":return String(P.$y).slice(-2);case"YYYY":return B.s(P.$y,4,"0");case"M":return A+1;case"MM":return B.s(A+1,2,"0");case"MMM":return yt($.monthsShort,A,st,3);case"MMMM":return yt(st,A);case"D":return P.$D;case"DD":return B.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return yt($.weekdaysMin,P.$W,ct,2);case"ddd":return yt($.weekdaysShort,P.$W,ct,3);case"dddd":return ct[P.$W];case"H":return String(R);case"HH":return B.s(R,2,"0");case"h":return Ot(1);case"hh":return Ot(2);case"a":return lt(R,X,!0);case"A":return lt(R,X,!1);case"m":return String(X);case"mm":return B.s(X,2,"0");case"s":return String(P.$s);case"ss":return B.s(P.$s,2,"0");case"SSS":return B.s(P.$ms,3,"0");case"Z":return _}return null})(Z)||_.replace(":","")}))},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(M,P,$){var D,_=this,R=B.p(P),X=L(M),A=(X.utcOffset()-this.utcOffset())*n,ct=this-X,st=function(){return B.m(_,X)};switch(R){case f:D=st()/12;break;case d:D=st();break;case p:D=st()/3;break;case u:D=(ct-A)/6048e5;break;case c:D=(ct-A)/864e5;break;case l:D=ct/i;break;case a:D=ct/n;break;case o:D=ct/r;break;default:D=ct}return $?D:B.a(D)},I.daysInMonth=function(){return this.endOf(d).$D},I.$locale=function(){return w[this.$L]},I.locale=function(M,P){if(!M)return this.$L;var $=this.clone(),D=F(M,P,!0);return D&&($.$L=D),$},I.clone=function(){return B.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},O})(),G=W.prototype;return L.prototype=G,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",c],["$M",d],["$y",f],["$D",m]].forEach((function(O){G[O[1]]=function(I){return this.$g(I,O[0],O[1])}})),L.extend=function(O,I){return O.$i||(O(I,W,L),O.$i=!0),L},L.locale=F,L.isDayjs=N,L.unix=function(O){return L(1e3*O)},L.en=w[E],L.Ls=w,L.p={},L}))})(Tl)),Tl.exports}var l4=a4();const c4=Rc(l4);var tC=Object.defineProperty,v=(t,e)=>tC(t,"name",{value:e,configurable:!0}),h4=(t,e)=>{for(var r in e)tC(t,r,{get:e[r],enumerable:!0})},mn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},rt={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},sp=v(function(t="fatal"){let e=mn.fatal;typeof t=="string"?t.toLowerCase()in mn&&(e=mn[t]):typeof t=="number"&&(e=t),rt.trace=()=>{},rt.debug=()=>{},rt.info=()=>{},rt.warn=()=>{},rt.error=()=>{},rt.fatal=()=>{},e<=mn.fatal&&(rt.fatal=console.error?console.error.bind(console,Br("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Br("FATAL"))),e<=mn.error&&(rt.error=console.error?console.error.bind(console,Br("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Br("ERROR"))),e<=mn.warn&&(rt.warn=console.warn?console.warn.bind(console,Br("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Br("WARN"))),e<=mn.info&&(rt.info=console.info?console.info.bind(console,Br("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Br("INFO"))),e<=mn.debug&&(rt.debug=console.debug?console.debug.bind(console,Br("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Br("DEBUG"))),e<=mn.trace&&(rt.trace=console.debug?console.debug.bind(console,Br("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Br("TRACE")))},"setLogLevel"),Br=v(t=>`%c${c4().format("ss.SSS")} : ${t} : `,"format");const _l={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 _l.hue2rgb(s,i,t+1/3)*255;case"g":return _l.hue2rgb(s,i,t)*255;case"b":return _l.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}}},u4={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},d4={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Dt={channel:_l,lang:u4,unit:d4},Fn={};for(let t=0;t<=255;t++)Fn[t]=Dt.unit.dec2hex(t);const qe={ALL:0,RGB:1,HSL:2};class f4{constructor(){this.type=qe.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=qe.ALL}is(e){return this.type===e}}class p4{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new f4}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=qe.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Dt.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Dt.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Dt.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Dt.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Dt.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Dt.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(qe.HSL)&&r!==void 0?r:(this._ensureHSL(),Dt.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(qe.HSL)&&r!==void 0?r:(this._ensureHSL(),Dt.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(qe.HSL)&&r!==void 0?r:(this._ensureHSL(),Dt.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(qe.RGB)&&r!==void 0?r:(this._ensureRGB(),Dt.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(qe.RGB)&&r!==void 0?r:(this._ensureRGB(),Dt.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(qe.RGB)&&r!==void 0?r:(this._ensureRGB(),Dt.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(qe.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(qe.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(qe.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(qe.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(qe.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(qe.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const Jc=new p4({r:0,g:0,b:0,a:0},"transparent"),cs={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(cs.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,c=s?0:-1,u=o?255:15;return Jc.set({r:(n>>l*(c+3)&u)*a,g:(n>>l*(c+2)&u)*a,b:(n>>l*(c+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?`#${Fn[Math.round(e)]}${Fn[Math.round(r)]}${Fn[Math.round(n)]}${Fn[Math.round(i*255)]}`:`#${Fn[Math.round(e)]}${Fn[Math.round(r)]}${Fn[Math.round(n)]}`}},fi={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(fi.hueRe);if(e){const[,r,n]=e;switch(n){case"grad":return Dt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Dt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Dt.channel.clamp.h(parseFloat(r)*360)}}return Dt.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const r=t.match(fi.re);if(!r)return;const[,n,i,s,o,a]=r;return Jc.set({h:fi._hue2deg(n),s:Dt.channel.clamp.s(parseFloat(i)),l:Dt.channel.clamp.l(parseFloat(s)),a:o?Dt.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(${Dt.lang.round(e)}, ${Dt.lang.round(r)}%, ${Dt.lang.round(n)}%, ${i})`:`hsl(${Dt.lang.round(e)}, ${Dt.lang.round(r)}%, ${Dt.lang.round(n)}%)`}},Wo={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=Wo.colors[t];if(e)return cs.parse(e)},stringify:t=>{const e=cs.stringify(t);for(const r in Wo.colors)if(Wo.colors[r]===e)return r}},No={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(No.re);if(!r)return;const[,n,i,s,o,a,l,c,u]=r;return Jc.set({r:Dt.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Dt.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:Dt.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:c?Dt.channel.clamp.a(u?parseFloat(c)/100:parseFloat(c)):1},t)},stringify:t=>{const{r:e,g:r,b:n,a:i}=t;return i<1?`rgba(${Dt.lang.round(e)}, ${Dt.lang.round(r)}, ${Dt.lang.round(n)}, ${Dt.lang.round(i)})`:`rgb(${Dt.lang.round(e)}, ${Dt.lang.round(r)}, ${Dt.lang.round(n)})`}},sn={format:{keyword:Wo,hex:cs,rgb:No,rgba:No,hsl:fi,hsla:fi},parse:t=>{if(typeof t!="string")return t;const e=cs.parse(t)||No.parse(t)||fi.parse(t)||Wo.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(qe.HSL)||t.data.r===void 0?fi.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?No.stringify(t):cs.stringify(t)},eC=(t,e)=>{const r=sn.parse(t);for(const n in e)r[n]=Dt.channel.clamp[n](e[n]);return sn.stringify(r)},Rn=(t,e,r=0,n=1)=>{if(typeof t!="number")return eC(t,{a:e});const i=Jc.set({r:Dt.channel.clamp.r(t),g:Dt.channel.clamp.g(e),b:Dt.channel.clamp.b(r),a:Dt.channel.clamp.a(n)});return sn.stringify(i)},m4=t=>{const{r:e,g:r,b:n}=sn.parse(t),i=.2126*Dt.channel.toLinear(e)+.7152*Dt.channel.toLinear(r)+.0722*Dt.channel.toLinear(n);return Dt.lang.round(i)},g4=t=>m4(t)>=.5,Vr=t=>!g4(t),rC=(t,e,r)=>{const n=sn.parse(t),i=n[e],s=Dt.channel.clamp[e](i+r);return i!==s&&(n[e]=s),sn.stringify(n)},K=(t,e)=>rC(t,"l",e),Y=(t,e)=>rC(t,"l",-e),j=(t,e)=>{const r=sn.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return eC(t,n)},x4=(t,e,r=50)=>{const{r:n,g:i,b:s,a:o}=sn.parse(t),{r:a,g:l,b:c,a:u}=sn.parse(e),d=r/100,p=d*2-1,f=o-u,x=((p*f===-1?p:(p+f)/(1+p*f))+1)/2,g=1-x,y=n*x+a*g,b=i*x+l*g,k=s*x+c*g,S=o*d+u*(1-d);return Rn(y,b,k,S)},H=(t,e=100)=>{const r=sn.parse(t);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,x4(r,t,e)};/*! @license DOMPurify 3.4.2 | (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.2/LICENSE */const{entries:nC,setPrototypeOf:Og,isFrozen:y4,getPrototypeOf:b4,getOwnPropertyDescriptor:C4}=Object;let{freeze:nr,seal:Ir,create:ts}=Object,{apply:cd,construct:hd}=typeof Reflect<"u"&&Reflect;nr||(nr=function(e){return e});Ir||(Ir=function(e){return e});cd||(cd=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)});hd||(hd=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 ho=Be(Array.prototype.forEach),k4=Be(Array.prototype.lastIndexOf),$g=Be(Array.prototype.pop),uo=Be(Array.prototype.push),v4=Be(Array.prototype.splice),Ze=Array.isArray,jo=Be(String.prototype.toLowerCase),cu=Be(String.prototype.toString),Rg=Be(String.prototype.match),Wi=Be(String.prototype.replace),zg=Be(String.prototype.indexOf),w4=Be(String.prototype.trim),S4=Be(Number.prototype.toString),T4=Be(Boolean.prototype.toString),Wg=typeof BigInt>"u"?null:Be(BigInt.prototype.toString),qg=typeof Symbol>"u"?null:Be(Symbol.prototype.toString),ke=Be(Object.prototype.hasOwnProperty),fo=Be(Object.prototype.toString),De=Be(RegExp.prototype.test),Qa=_4(TypeError);function Be(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 cd(t,e,n)}}function _4(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return hd(t,r)}}function qt(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jo;if(Og&&Og(t,null),!Ze(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(y4(e)||(e[n]=s),i=s)}t[i]=!0}return t}function E4(t){for(let e=0;e<t.length;e++)ke(t,e)||(t[e]=null);return t}function hr(t){const e=ts(null);for(const[r,n]of nC(t))ke(t,r)&&(Ze(n)?e[r]=E4(n):n&&typeof n=="object"&&n.constructor===Object?e[r]=hr(n):e[r]=n);return e}function N4(t){switch(typeof t){case"string":return t;case"number":return S4(t);case"boolean":return T4(t);case"bigint":return Wg?Wg(t):"0";case"symbol":return qg?qg(t):"Symbol()";case"undefined":return fo(t);case"function":case"object":{if(t===null)return fo(t);const e=t,r=es(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:fo(n)}return fo(t)}default:return fo(t)}}function es(t,e){for(;t!==null;){const n=C4(t,e);if(n){if(n.get)return Be(n.get);if(typeof n.value=="function")return Be(n.value)}t=b4(t)}function r(){return null}return r}function j4(t){try{return De(t,""),!0}catch{return!1}}const Hg=nr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),hu=nr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),uu=nr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),L4=nr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),du=nr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),B4=nr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ug=nr(["#text"]),Gg=nr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),fu=nr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Vg=nr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ja=nr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),A4=Ir(/\{\{[\w\W]*|[\w\W]*\}\}/gm),M4=Ir(/<%[\w\W]*|[\w\W]*%>/gm),I4=Ir(/\$\{[\w\W]*/gm),F4=Ir(/^data-[\-\w.\u00B7-\uFFFF]+$/),P4=Ir(/^aria-[\-\w]+$/),iC=Ir(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),D4=Ir(/^(?:\w+script|data):/i),O4=Ir(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),sC=Ir(/^html$/i),$4=Ir(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yg=Object.freeze({__proto__:null,ARIA_ATTR:P4,ATTR_WHITESPACE:O4,CUSTOM_ELEMENT:$4,DATA_ATTR:F4,DOCTYPE_NAME:sC,ERB_EXPR:M4,IS_ALLOWED_URI:iC,IS_SCRIPT_OR_DATA:D4,MUSTACHE_EXPR:A4,TMPLIT_EXPR:I4});const po={element:1,text:3,progressingInstruction:7,comment:8,document:9},R4=function(){return typeof window>"u"?null:window},z4=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}},Xg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function oC(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R4();const e=Nt=>oC(Nt);if(e.version="3.4.2",e.removed=[],!t||!t.document||t.document.nodeType!==po.document||!t.Element)return e.isSupported=!1,e;let{document:r}=t;const n=r,i=n.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:p,trustedTypes:f}=t,m=l.prototype,x=es(m,"cloneNode"),g=es(m,"remove"),y=es(m,"nextSibling"),b=es(m,"childNodes"),k=es(m,"parentNode");if(typeof o=="function"){const Nt=r.createElement("template");Nt.content&&Nt.content.ownerDocument&&(r=Nt.content.ownerDocument)}let S,E="";const{implementation:w,createNodeIterator:T,createDocumentFragment:N,getElementsByTagName:F}=r,{importNode:L}=n;let B=Xg();e.isSupported=typeof nC=="function"&&typeof k=="function"&&w&&w.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:W,ERB_EXPR:G,TMPLIT_EXPR:O,DATA_ATTR:I,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:P,ATTR_WHITESPACE:$,CUSTOM_ELEMENT:D}=Yg;let{IS_ALLOWED_URI:_}=Yg,R=null;const X=qt({},[...Hg,...hu,...uu,...du,...Ug]);let A=null;const ct=qt({},[...Gg,...fu,...Vg,...Ja]);let st=Object.seal(ts(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}})),J=null,yt=null;const Ot=Object.seal(ts(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let lt=!0,Z=!0,at=!1,vt=!0,Et=!1,Mt=!0,re=!1,xe=!1,Re=!1,Kt=!1,_e=!1,V=!1,it=!0,ut=!1;const jt="user-content-";let tt=!0,mt=!1,U={},et=null;const Tt=qt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let zt=null;const Yt=qt({},["audio","video","img","source","image","track"]);let ve=null;const sr=qt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ae="http://www.w3.org/1998/Math/MathML",yr="http://www.w3.org/2000/svg",ue="http://www.w3.org/1999/xhtml";let pe=ue,br=!1,Ke=null;const jh=qt({},[ae,yr,ue],cu);let Xs=qt({},["mi","mo","mn","ms","mtext"]),Ks=qt({},["annotation-xml"]);const Ia=qt({},["title","style","font","a","script"]);let ri=null;const Lh=["application/xhtml+xml","text/html"],ni="text/html";let we=null,Kr=null;const Bh=r.createElement("form"),Zs=function(z){return z instanceof RegExp||z instanceof Function},Qs=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Kr&&Kr===z)return;(!z||typeof z!="object")&&(z={}),z=hr(z),ri=Lh.indexOf(z.PARSER_MEDIA_TYPE)===-1?ni:z.PARSER_MEDIA_TYPE,we=ri==="application/xhtml+xml"?cu:jo,R=ke(z,"ALLOWED_TAGS")&&Ze(z.ALLOWED_TAGS)?qt({},z.ALLOWED_TAGS,we):X,A=ke(z,"ALLOWED_ATTR")&&Ze(z.ALLOWED_ATTR)?qt({},z.ALLOWED_ATTR,we):ct,Ke=ke(z,"ALLOWED_NAMESPACES")&&Ze(z.ALLOWED_NAMESPACES)?qt({},z.ALLOWED_NAMESPACES,cu):jh,ve=ke(z,"ADD_URI_SAFE_ATTR")&&Ze(z.ADD_URI_SAFE_ATTR)?qt(hr(sr),z.ADD_URI_SAFE_ATTR,we):sr,zt=ke(z,"ADD_DATA_URI_TAGS")&&Ze(z.ADD_DATA_URI_TAGS)?qt(hr(Yt),z.ADD_DATA_URI_TAGS,we):Yt,et=ke(z,"FORBID_CONTENTS")&&Ze(z.FORBID_CONTENTS)?qt({},z.FORBID_CONTENTS,we):Tt,J=ke(z,"FORBID_TAGS")&&Ze(z.FORBID_TAGS)?qt({},z.FORBID_TAGS,we):hr({}),yt=ke(z,"FORBID_ATTR")&&Ze(z.FORBID_ATTR)?qt({},z.FORBID_ATTR,we):hr({}),U=ke(z,"USE_PROFILES")?z.USE_PROFILES&&typeof z.USE_PROFILES=="object"?hr(z.USE_PROFILES):z.USE_PROFILES:!1,lt=z.ALLOW_ARIA_ATTR!==!1,Z=z.ALLOW_DATA_ATTR!==!1,at=z.ALLOW_UNKNOWN_PROTOCOLS||!1,vt=z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Et=z.SAFE_FOR_TEMPLATES||!1,Mt=z.SAFE_FOR_XML!==!1,re=z.WHOLE_DOCUMENT||!1,Kt=z.RETURN_DOM||!1,_e=z.RETURN_DOM_FRAGMENT||!1,V=z.RETURN_TRUSTED_TYPE||!1,Re=z.FORCE_BODY||!1,it=z.SANITIZE_DOM!==!1,ut=z.SANITIZE_NAMED_PROPS||!1,tt=z.KEEP_CONTENT!==!1,mt=z.IN_PLACE||!1,_=j4(z.ALLOWED_URI_REGEXP)?z.ALLOWED_URI_REGEXP:iC,pe=typeof z.NAMESPACE=="string"?z.NAMESPACE:ue,Xs=ke(z,"MATHML_TEXT_INTEGRATION_POINTS")&&z.MATHML_TEXT_INTEGRATION_POINTS&&typeof z.MATHML_TEXT_INTEGRATION_POINTS=="object"?hr(z.MATHML_TEXT_INTEGRATION_POINTS):qt({},["mi","mo","mn","ms","mtext"]),Ks=ke(z,"HTML_INTEGRATION_POINTS")&&z.HTML_INTEGRATION_POINTS&&typeof z.HTML_INTEGRATION_POINTS=="object"?hr(z.HTML_INTEGRATION_POINTS):qt({},["annotation-xml"]);const Q=ke(z,"CUSTOM_ELEMENT_HANDLING")&&z.CUSTOM_ELEMENT_HANDLING&&typeof z.CUSTOM_ELEMENT_HANDLING=="object"?hr(z.CUSTOM_ELEMENT_HANDLING):ts(null);if(st=ts(null),ke(Q,"tagNameCheck")&&Zs(Q.tagNameCheck)&&(st.tagNameCheck=Q.tagNameCheck),ke(Q,"attributeNameCheck")&&Zs(Q.attributeNameCheck)&&(st.attributeNameCheck=Q.attributeNameCheck),ke(Q,"allowCustomizedBuiltInElements")&&typeof Q.allowCustomizedBuiltInElements=="boolean"&&(st.allowCustomizedBuiltInElements=Q.allowCustomizedBuiltInElements),Et&&(Z=!1),_e&&(Kt=!0),U&&(R=qt({},Ug),A=ts(null),U.html===!0&&(qt(R,Hg),qt(A,Gg)),U.svg===!0&&(qt(R,hu),qt(A,fu),qt(A,Ja)),U.svgFilters===!0&&(qt(R,uu),qt(A,fu),qt(A,Ja)),U.mathMl===!0&&(qt(R,du),qt(A,Vg),qt(A,Ja))),Ot.tagCheck=null,Ot.attributeCheck=null,ke(z,"ADD_TAGS")&&(typeof z.ADD_TAGS=="function"?Ot.tagCheck=z.ADD_TAGS:Ze(z.ADD_TAGS)&&(R===X&&(R=hr(R)),qt(R,z.ADD_TAGS,we))),ke(z,"ADD_ATTR")&&(typeof z.ADD_ATTR=="function"?Ot.attributeCheck=z.ADD_ATTR:Ze(z.ADD_ATTR)&&(A===ct&&(A=hr(A)),qt(A,z.ADD_ATTR,we))),ke(z,"ADD_URI_SAFE_ATTR")&&Ze(z.ADD_URI_SAFE_ATTR)&&qt(ve,z.ADD_URI_SAFE_ATTR,we),ke(z,"FORBID_CONTENTS")&&Ze(z.FORBID_CONTENTS)&&(et===Tt&&(et=hr(et)),qt(et,z.FORBID_CONTENTS,we)),ke(z,"ADD_FORBID_CONTENTS")&&Ze(z.ADD_FORBID_CONTENTS)&&(et===Tt&&(et=hr(et)),qt(et,z.ADD_FORBID_CONTENTS,we)),tt&&(R["#text"]=!0),re&&qt(R,["html","head","body"]),R.table&&(qt(R,["tbody"]),delete J.tbody),z.TRUSTED_TYPES_POLICY){if(typeof z.TRUSTED_TYPES_POLICY.createHTML!="function")throw Qa('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Qa('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=z.TRUSTED_TYPES_POLICY,E=S.createHTML("")}else S===void 0&&(S=z4(f,i)),S!==null&&typeof E=="string"&&(E=S.createHTML(""));nr&&nr(z),Kr=z},Js=qt({},[...hu,...uu,...L4]),ii=qt({},[...du,...B4]),Fa=function(z){let Q=k(z);(!Q||!Q.tagName)&&(Q={namespaceURI:pe,tagName:"template"});const gt=jo(z.tagName),se=jo(Q.tagName);return Ke[z.namespaceURI]?z.namespaceURI===yr?Q.namespaceURI===ue?gt==="svg":Q.namespaceURI===ae?gt==="svg"&&(se==="annotation-xml"||Xs[se]):!!Js[gt]:z.namespaceURI===ae?Q.namespaceURI===ue?gt==="math":Q.namespaceURI===yr?gt==="math"&&Ks[se]:!!ii[gt]:z.namespaceURI===ue?Q.namespaceURI===yr&&!Ks[se]||Q.namespaceURI===ae&&!Xs[se]?!1:!ii[gt]&&(Ia[gt]||!Js[gt]):!!(ri==="application/xhtml+xml"&&Ke[z.namespaceURI]):!1},Cr=function(z){uo(e.removed,{element:z});try{k(z).removeChild(z)}catch{g(z)}},Dr=function(z,Q){try{uo(e.removed,{attribute:Q.getAttributeNode(z),from:Q})}catch{uo(e.removed,{attribute:null,from:Q})}if(Q.removeAttribute(z),z==="is")if(Kt||_e)try{Cr(Q)}catch{}else try{Q.setAttribute(z,"")}catch{}},Pa=function(z){let Q=null,gt=null;if(Re)z="<remove></remove>"+z;else{const de=Rg(z,/^[\r\n\t ]+/);gt=de&&de[0]}ri==="application/xhtml+xml"&&pe===ue&&(z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+z+"</body></html>");const se=S?S.createHTML(z):z;if(pe===ue)try{Q=new p().parseFromString(se,ri)}catch{}if(!Q||!Q.documentElement){Q=w.createDocument(pe,"template",null);try{Q.documentElement.innerHTML=br?E:se}catch{}}const Ee=Q.body||Q.documentElement;return z&&gt&&Ee.insertBefore(r.createTextNode(gt),Ee.childNodes[0]||null),pe===ue?F.call(Q,re?"html":"body")[0]:re?Q.documentElement:Ee},to=function(z){return T.call(z.ownerDocument||z,z,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},eo=function(z){return z instanceof d&&(typeof z.nodeName!="string"||typeof z.textContent!="string"||typeof z.removeChild!="function"||!(z.attributes instanceof u)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function")},ze=function(z){return typeof a=="function"&&z instanceof a};function Lr(Nt,z,Q){ho(Nt,gt=>{gt.call(e,z,Q,Kr)})}const jn=function(z){let Q=null;if(Lr(B.beforeSanitizeElements,z,null),eo(z))return Cr(z),!0;const gt=we(z.nodeName);if(Lr(B.uponSanitizeElement,z,{tagName:gt,allowedTags:R}),Mt&&z.hasChildNodes()&&!ze(z.firstElementChild)&&De(/<[/\w!]/g,z.innerHTML)&&De(/<[/\w!]/g,z.textContent)||Mt&&z.namespaceURI===ue&&gt==="style"&&ze(z.firstElementChild)||z.nodeType===po.progressingInstruction||Mt&&z.nodeType===po.comment&&De(/<[/\w]/g,z.data))return Cr(z),!0;if(J[gt]||!(Ot.tagCheck instanceof Function&&Ot.tagCheck(gt))&&!R[gt]){if(!J[gt]&&Oa(gt)&&(st.tagNameCheck instanceof RegExp&&De(st.tagNameCheck,gt)||st.tagNameCheck instanceof Function&&st.tagNameCheck(gt)))return!1;if(tt&&!et[gt]){const se=k(z)||z.parentNode,Ee=b(z)||z.childNodes;if(Ee&&se){const de=Ee.length;for(let We=de-1;We>=0;--We){const or=x(Ee[We],!0);se.insertBefore(or,y(z))}}}return Cr(z),!0}return z instanceof l&&!Fa(z)||(gt==="noscript"||gt==="noembed"||gt==="noframes")&&De(/<\/no(script|embed|frames)/i,z.innerHTML)?(Cr(z),!0):(Et&&z.nodeType===po.text&&(Q=z.textContent,ho([W,G,O],se=>{Q=Wi(Q,se," ")}),z.textContent!==Q&&(uo(e.removed,{element:z.cloneNode()}),z.textContent=Q)),Lr(B.afterSanitizeElements,z,null),!1)},Oi=function(z,Q,gt){if(yt[Q]||it&&(Q==="id"||Q==="name")&&(gt in r||gt in Bh))return!1;const se=A[Q]||Ot.attributeCheck instanceof Function&&Ot.attributeCheck(Q,z);if(!(Z&&!yt[Q]&&De(I,Q))){if(!(lt&&De(M,Q))){if(!se||yt[Q]){if(!(Oa(z)&&(st.tagNameCheck instanceof RegExp&&De(st.tagNameCheck,z)||st.tagNameCheck instanceof Function&&st.tagNameCheck(z))&&(st.attributeNameCheck instanceof RegExp&&De(st.attributeNameCheck,Q)||st.attributeNameCheck instanceof Function&&st.attributeNameCheck(Q,z))||Q==="is"&&st.allowCustomizedBuiltInElements&&(st.tagNameCheck instanceof RegExp&&De(st.tagNameCheck,gt)||st.tagNameCheck instanceof Function&&st.tagNameCheck(gt))))return!1}else if(!ve[Q]){if(!De(_,Wi(gt,$,""))){if(!((Q==="src"||Q==="xlink:href"||Q==="href")&&z!=="script"&&zg(gt,"data:")===0&&zt[z])){if(!(at&&!De(P,Wi(gt,$,"")))){if(gt)return!1}}}}}}return!0},Da=qt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Oa=function(z){return!Da[jo(z)]&&De(D,z)},$a=function(z){Lr(B.beforeSanitizeAttributes,z,null);const{attributes:Q}=z;if(!Q||eo(z))return;const gt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0};let se=Q.length;for(;se--;){const Ee=Q[se],{name:de,namespaceURI:We,value:or}=Ee,kr=we(de),$i=or;let Ne=de==="value"?$i:w4($i);if(gt.attrName=kr,gt.attrValue=Ne,gt.keepAttr=!0,gt.forceKeepAttr=void 0,Lr(B.uponSanitizeAttribute,z,gt),Ne=gt.attrValue,ut&&(kr==="id"||kr==="name")&&zg(Ne,jt)!==0&&(Dr(de,z),Ne=jt+Ne),Mt&&De(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ne)){Dr(de,z);continue}if(kr==="attributename"&&Rg(Ne,"href")){Dr(de,z);continue}if(gt.forceKeepAttr)continue;if(!gt.keepAttr){Dr(de,z);continue}if(!vt&&De(/\/>/i,Ne)){Dr(de,z);continue}Et&&ho([W,G,O],Wa=>{Ne=Wi(Ne,Wa," ")});const za=we(z.nodeName);if(!Oi(za,kr,Ne)){Dr(de,z);continue}if(S&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!We)switch(f.getAttributeType(za,kr)){case"TrustedHTML":{Ne=S.createHTML(Ne);break}case"TrustedScriptURL":{Ne=S.createScriptURL(Ne);break}}if(Ne!==$i)try{We?z.setAttributeNS(We,de,Ne):z.setAttribute(de,Ne),eo(z)?Cr(z):$g(e.removed)}catch{Dr(de,z)}}Lr(B.afterSanitizeAttributes,z,null)},Ra=function(z){let Q=null;const gt=to(z);for(Lr(B.beforeSanitizeShadowDOM,z,null);Q=gt.nextNode();)Lr(B.uponSanitizeShadowNode,Q,null),jn(Q),$a(Q),Q.content instanceof s&&Ra(Q.content);Lr(B.afterSanitizeShadowDOM,z,null)};return e.sanitize=function(Nt){let z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Q=null,gt=null,se=null,Ee=null;if(br=!Nt,br&&(Nt="<!-->"),typeof Nt!="string"&&!ze(Nt)&&(Nt=N4(Nt),typeof Nt!="string"))throw Qa("dirty is not a string, aborting");if(!e.isSupported)return Nt;if(xe||Qs(z),e.removed=[],typeof Nt=="string"&&(mt=!1),mt){const or=Nt.nodeName;if(typeof or=="string"){const kr=we(or);if(!R[kr]||J[kr])throw Qa("root node is forbidden and cannot be sanitized in-place")}}else if(Nt instanceof a)Q=Pa("<!---->"),gt=Q.ownerDocument.importNode(Nt,!0),gt.nodeType===po.element&&gt.nodeName==="BODY"||gt.nodeName==="HTML"?Q=gt:Q.appendChild(gt);else{if(!Kt&&!Et&&!re&&Nt.indexOf("<")===-1)return S&&V?S.createHTML(Nt):Nt;if(Q=Pa(Nt),!Q)return Kt?null:V?E:""}Q&&Re&&Cr(Q.firstChild);const de=to(mt?Nt:Q);for(;se=de.nextNode();)jn(se),$a(se),se.content instanceof s&&Ra(se.content);if(mt)return Nt;if(Kt){if(Et){Q.normalize();let or=Q.innerHTML;ho([W,G,O],kr=>{or=Wi(or,kr," ")}),Q.innerHTML=or}if(_e)for(Ee=N.call(Q.ownerDocument);Q.firstChild;)Ee.appendChild(Q.firstChild);else Ee=Q;return(A.shadowroot||A.shadowrootmode)&&(Ee=L.call(n,Ee,!0)),Ee}let We=re?Q.outerHTML:Q.innerHTML;return re&&R["!doctype"]&&Q.ownerDocument&&Q.ownerDocument.doctype&&Q.ownerDocument.doctype.name&&De(sC,Q.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+Q.ownerDocument.doctype.name+`>
342
- `+We),Et&&ho([W,G,O],or=>{We=Wi(We,or," ")}),S&&V?S.createHTML(We):We},e.setConfig=function(){let Nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Qs(Nt),xe=!0},e.clearConfig=function(){Kr=null,xe=!1},e.isValidAttribute=function(Nt,z,Q){Kr||Qs({});const gt=we(Nt),se=we(z);return Oi(gt,se,Q)},e.addHook=function(Nt,z){typeof z=="function"&&uo(B[Nt],z)},e.removeHook=function(Nt,z){if(z!==void 0){const Q=k4(B[Nt],z);return Q===-1?void 0:v4(B[Nt],Q,1)[0]}return $g(B[Nt])},e.removeHooks=function(Nt){B[Nt]=[]},e.removeAllHooks=function(){B=Xg()},e}var Ms=oC(),aC=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,qo=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,W4=/\s*%%.*\n/gm,ps,lC=(ps=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(ps,"UnknownDiagramError"),ps),ki={},op=v(function(t,e){t=t.replace(aC,"").replace(qo,"").replace(W4,`
343
- `);for(const[r,{detector:n}]of Object.entries(ki))if(n(t,e))return r;throw new lC(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),ud=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)cC(e,r,n)},"registerLazyLoadedDiagrams"),cC=v((t,e,r)=>{ki[t]&&rt.warn(`Detector with key ${t} already exists. Overwriting.`),ki[t]={detector:e,loader:r},rt.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),q4=v(t=>ki[t].loader,"getDiagramLoader"),dd=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=>dd(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]=dd(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=dd,hn="#ffffff",un="#f2f2f2",Pt=v((t,e)=>e?j(t,{s:-40,l:10}):j(t,{s:-40,l:-10}),"mkBorder"),ms,H4=(ms=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,c,u,d,p,f,m,x,g,y,b,k,S,E,w,T;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||j(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||j(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(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?Y(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||Y(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(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||Y(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Y(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||j(this.primaryColor,{h:30}),this.cScale4=this.cScale4||j(this.primaryColor,{h:60}),this.cScale5=this.cScale5||j(this.primaryColor,{h:90}),this.cScale6=this.cScale6||j(this.primaryColor,{h:120}),this.cScale7=this.cScale7||j(this.primaryColor,{h:150}),this.cScale8=this.cScale8||j(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||j(this.primaryColor,{h:270}),this.cScale10=this.cScale10||j(this.primaryColor,{h:300}),this.cScale11=this.cScale11||j(this.primaryColor,{h:330}),this.darkMode)for(let N=0;N<this.THEME_COLOR_LIMIT;N++)this["cScale"+N]=Y(this["cScale"+N],75);else for(let N=0;N<this.THEME_COLOR_LIMIT;N++)this["cScale"+N]=Y(this["cScale"+N],25);for(let N=0;N<this.THEME_COLOR_LIMIT;N++)this["cScaleInv"+N]=this["cScaleInv"+N]||H(this["cScale"+N]);for(let N=0;N<this.THEME_COLOR_LIMIT;N++)this.darkMode?this["cScalePeer"+N]=this["cScalePeer"+N]||K(this["cScale"+N],10):this["cScalePeer"+N]=this["cScalePeer"+N]||Y(this["cScale"+N],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let N=0;N<this.THEME_COLOR_LIMIT;N++)this["cScaleLabel"+N]=this["cScaleLabel"+N]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let N=0;N<5;N++)this["surface"+N]=this["surface"+N]||j(this.mainBkg,{h:180,s:-15,l:e*(5+N*3)}),this["surfacePeer"+N]=this["surfacePeer"+N]||j(this.mainBkg,{h:180,s:-15,l:e*(8+N*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||j(this.primaryColor,{h:64}),this.fillType3=this.fillType3||j(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||j(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||j(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||j(this.primaryColor,{h:128}),this.fillType7=this.fillType7||j(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||j(this.primaryColor,{l:-10}),this.pie5=this.pie5||j(this.secondaryColor,{l:-10}),this.pie6=this.pie6||j(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||j(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||j(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||j(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||j(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||j(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||j(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??j(this.primaryColor,{l:-30}),this.venn2=this.venn2??j(this.secondaryColor,{l:-30}),this.venn3=this.venn3??j(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??j(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??j(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??j(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??j(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??j(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:((c=this.radar)==null?void 0:c.graticuleOpacity)||.3,legendBoxSize:((u=this.radar)==null?void 0:u.legendBoxSize)||12,legendFontSize:((d=this.radar)==null?void 0:d.legendFontSize)||12},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((p=this.xyChart)==null?void 0:p.backgroundColor)||this.background,titleColor:((f=this.xyChart)==null?void 0:f.titleColor)||this.primaryTextColor,dataLabelColor:((m=this.xyChart)==null?void 0:m.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((x=this.xyChart)==null?void 0:x.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((g=this.xyChart)==null?void 0:g.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((y=this.xyChart)==null?void 0:y.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((b=this.xyChart)==null?void 0:b.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((k=this.xyChart)==null?void 0:k.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((S=this.xyChart)==null?void 0:S.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((E=this.xyChart)==null?void 0:E.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((w=this.xyChart)==null?void 0:w.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((T=this.xyChart)==null?void 0:T.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?Y(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||j(this.primaryColor,{h:-30}),this.git4=this.git4||j(this.primaryColor,{h:-60}),this.git5=this.git5||j(this.primaryColor,{h:-90}),this.git6=this.git6||j(this.primaryColor,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(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||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un,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(ms,"Theme"),ms),U4=v(t=>{const e=new H4;return e.calculate(t),e},"getThemeVariables"),gs,G4=(gs=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=j(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(H("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=Rn(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=Y("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Y(this.sectionBkgColor,10),this.taskBorderColor=Rn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=Rn(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||Y(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,c,u,d,p,f,m,x,g,y,b,k,S,E,w;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=H(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=j(this.primaryColor,{h:64}),this.fillType3=j(this.secondaryColor,{h:64}),this.fillType4=j(this.primaryColor,{h:-64}),this.fillType5=j(this.secondaryColor,{h:-64}),this.fillType6=j(this.primaryColor,{h:128}),this.fillType7=j(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||j(this.primaryColor,{h:30}),this.cScale4=this.cScale4||j(this.primaryColor,{h:60}),this.cScale5=this.cScale5||j(this.primaryColor,{h:90}),this.cScale6=this.cScale6||j(this.primaryColor,{h:120}),this.cScale7=this.cScale7||j(this.primaryColor,{h:150}),this.cScale8=this.cScale8||j(this.primaryColor,{h:210}),this.cScale9=this.cScale9||j(this.primaryColor,{h:270}),this.cScale10=this.cScale10||j(this.primaryColor,{h:300}),this.cScale11=this.cScale11||j(this.primaryColor,{h:330});for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleInv"+T]=this["cScaleInv"+T]||H(this["cScale"+T]);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScalePeer"+T]=this["cScalePeer"+T]||K(this["cScale"+T],10);for(let T=0;T<5;T++)this["surface"+T]=this["surface"+T]||j(this.mainBkg,{h:30,s:-30,l:-(-10+T*4)}),this["surfacePeer"+T]=this["surfacePeer"+T]||j(this.mainBkg,{h:30,s:-30,l:-(-7+T*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleLabel"+T]=this["cScaleLabel"+T]||this.scaleLabelColor;for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["pie"+T]=this["cScale"+T];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 T=0;T<8;T++)this["venn"+(T+1)]=this["venn"+(T+1)]??K(this["cScale"+T],30);this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.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:((f=this.radar)==null?void 0:f.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:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((k=this.radar)==null?void 0:k.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.graticuleOpacity)||.3,legendBoxSize:((E=this.radar)==null?void 0:E.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?Y(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||j(this.primaryColor,{h:-30}),20),this.git4=K(this.pie5||j(this.primaryColor,{h:-60}),20),this.git5=K(this.pie6||j(this.primaryColor,{h:-90}),10),this.git6=K(this.pie7||j(this.primaryColor,{h:60}),10),this.git7=K(this.pie8||j(this.primaryColor,{h:120}),20),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||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(gs,"Theme"),gs),V4=v(t=>{const e=new G4;return e.calculate(t),e},"getThemeVariables"),xs,Y4=(xs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=j(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=j(this.primaryColor,{h:-160}),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Pt(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=Rn(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,c,u,d,p,f,m,x,g,y,b,k,S,E,w;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||j(this.primaryColor,{h:30}),this.cScale4=this.cScale4||j(this.primaryColor,{h:60}),this.cScale5=this.cScale5||j(this.primaryColor,{h:90}),this.cScale6=this.cScale6||j(this.primaryColor,{h:120}),this.cScale7=this.cScale7||j(this.primaryColor,{h:150}),this.cScale8=this.cScale8||j(this.primaryColor,{h:210}),this.cScale9=this.cScale9||j(this.primaryColor,{h:270}),this.cScale10=this.cScale10||j(this.primaryColor,{h:300}),this.cScale11=this.cScale11||j(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Y(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Y(this.tertiaryColor,40);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=Y(this["cScale"+T],10),this["cScalePeer"+T]=this["cScalePeer"+T]||Y(this["cScale"+T],25);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleInv"+T]=this["cScaleInv"+T]||j(this["cScale"+T],{h:180});for(let T=0;T<5;T++)this["surface"+T]=this["surface"+T]||j(this.mainBkg,{h:30,l:-(5+T*5)}),this["surfacePeer"+T]=this["surfacePeer"+T]||j(this.mainBkg,{h:30,l:-(7+T*5)});if(this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor,this.labelTextColor!=="calculated"){this.cScaleLabel0=this.cScaleLabel0||H(this.labelTextColor),this.cScaleLabel3=this.cScaleLabel3||H(this.labelTextColor);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleLabel"+T]=this["cScaleLabel"+T]||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=j(this.primaryColor,{h:64}),this.fillType3=j(this.secondaryColor,{h:64}),this.fillType4=j(this.primaryColor,{h:-64}),this.fillType5=j(this.secondaryColor,{h:-64}),this.fillType6=j(this.primaryColor,{h:128}),this.fillType7=j(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||j(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||j(this.primaryColor,{l:-10}),this.pie5=this.pie5||j(this.secondaryColor,{l:-30}),this.pie6=this.pie6||j(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||j(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||j(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||j(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||j(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||j(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||j(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??j(this.primaryColor,{l:-30}),this.venn2=this.venn2??j(this.secondaryColor,{l:-30}),this.venn3=this.venn3??j(this.tertiaryColor,{l:-40}),this.venn4=this.venn4??j(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??j(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??j(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??j(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??j(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||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((p=this.xyChart)==null?void 0:p.titleColor)||this.primaryTextColor,dataLabelColor:((f=this.xyChart)==null?void 0:f.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((m=this.xyChart)==null?void 0:m.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((x=this.xyChart)==null?void 0:x.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((g=this.xyChart)==null?void 0:g.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((y=this.xyChart)==null?void 0:y.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((k=this.xyChart)==null?void 0:k.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((S=this.xyChart)==null?void 0:S.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((E=this.xyChart)==null?void 0:E.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((w=this.xyChart)==null?void 0:w.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||j(this.primaryColor,{h:-30}),this.git4=this.git4||j(this.primaryColor,{h:-60}),this.git5=this.git5||j(this.primaryColor,{h:-90}),this.git6=this.git6||j(this.primaryColor,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||Y(H(this.git0),25),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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(xs,"Theme"),xs),X4=v(t=>{const e=new Y4;return e.calculate(t),e},"getThemeVariables"),ys,K4=(ys=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=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.primaryColor),this.lineColor=H(this.background),this.textColor=H(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,c,u,d,p,f,m,x,g,y,b,k,S,E,w;this.actorBorder=Y(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||j(this.primaryColor,{h:30}),this.cScale4=this.cScale4||j(this.primaryColor,{h:60}),this.cScale5=this.cScale5||j(this.primaryColor,{h:90}),this.cScale6=this.cScale6||j(this.primaryColor,{h:120}),this.cScale7=this.cScale7||j(this.primaryColor,{h:150}),this.cScale8=this.cScale8||j(this.primaryColor,{h:210}),this.cScale9=this.cScale9||j(this.primaryColor,{h:270}),this.cScale10=this.cScale10||j(this.primaryColor,{h:300}),this.cScale11=this.cScale11||j(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Y(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Y(this.tertiaryColor,40);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScale"+T]=Y(this["cScale"+T],10),this["cScalePeer"+T]=this["cScalePeer"+T]||Y(this["cScale"+T],25);for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleInv"+T]=this["cScaleInv"+T]||j(this["cScale"+T],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleLabel"+T]=this["cScaleLabel"+T]||this.scaleLabelColor;for(let T=0;T<5;T++)this["surface"+T]=this["surface"+T]||j(this.mainBkg,{h:30,s:-30,l:-(5+T*5)}),this["surfacePeer"+T]=this["surfacePeer"+T]||j(this.mainBkg,{h:30,s:-30,l:-(8+T*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=j(this.primaryColor,{h:64}),this.fillType3=j(this.secondaryColor,{h:64}),this.fillType4=j(this.primaryColor,{h:-64}),this.fillType5=j(this.secondaryColor,{h:-64}),this.fillType6=j(this.primaryColor,{h:128}),this.fillType7=j(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||j(this.primaryColor,{l:-30}),this.pie5=this.pie5||j(this.secondaryColor,{l:-30}),this.pie6=this.pie6||j(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||j(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||j(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||j(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||j(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||j(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||j(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??j(this.primaryColor,{l:-30}),this.venn2=this.venn2??j(this.secondaryColor,{l:-30}),this.venn3=this.venn3??j(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??j(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??j(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??j(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??j(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??j(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||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.radar)==null?void 0:c.legendBoxSize)||12,legendFontSize:((u=this.radar)==null?void 0:u.legendFontSize)||12},this.xyChart={backgroundColor:((d=this.xyChart)==null?void 0:d.backgroundColor)||this.background,titleColor:((p=this.xyChart)==null?void 0:p.titleColor)||this.primaryTextColor,dataLabelColor:((f=this.xyChart)==null?void 0:f.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((m=this.xyChart)==null?void 0:m.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((x=this.xyChart)==null?void 0:x.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((g=this.xyChart)==null?void 0:g.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((y=this.xyChart)==null?void 0:y.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((b=this.xyChart)==null?void 0:b.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((k=this.xyChart)==null?void 0:k.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((S=this.xyChart)==null?void 0:S.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((E=this.xyChart)==null?void 0:E.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((w=this.xyChart)==null?void 0:w.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||j(this.primaryColor,{h:-30}),this.git4=this.git4||j(this.primaryColor,{h:-60}),this.git5=this.git5||j(this.primaryColor,{h:-90}),this.git6=this.git6||j(this.primaryColor,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.gitBranchLabel0=this.gitBranchLabel0||H(this.labelTextColor),this.gitBranchLabel1=this.gitBranchLabel1||this.labelTextColor,this.gitBranchLabel2=this.gitBranchLabel2||this.labelTextColor,this.gitBranchLabel3=this.gitBranchLabel3||H(this.labelTextColor),this.gitBranchLabel4=this.gitBranchLabel4||this.labelTextColor,this.gitBranchLabel5=this.gitBranchLabel5||this.labelTextColor,this.gitBranchLabel6=this.gitBranchLabel6||this.labelTextColor,this.gitBranchLabel7=this.gitBranchLabel7||this.labelTextColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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(ys,"Theme"),ys),Z4=v(t=>{const e=new K4;return e.calculate(t),e},"getThemeVariables"),bs,Q4=(bs=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=K(this.contrast,55),this.background="#ffffff",this.tertiaryColor=j(this.primaryColor,{h:-160}),this.primaryBorderColor=Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.lineColor=H(this.background),this.textColor=H(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,c,u,d,p,f,m,x,g,y,b,k,S,E,w;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 T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleInv"+T]=this["cScaleInv"+T]||H(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]||Y(this["cScale"+T],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["cScaleLabel"+T]=this["cScaleLabel"+T]||this.scaleLabelColor;for(let T=0;T<5;T++)this["surface"+T]=this["surface"+T]||j(this.mainBkg,{l:-(5+T*5)}),this["surfacePeer"+T]=this["surfacePeer"+T]||j(this.mainBkg,{l:-(8+T*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=Y(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=Y(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=j(this.primaryColor,{h:64}),this.fillType3=j(this.secondaryColor,{h:64}),this.fillType4=j(this.primaryColor,{h:-64}),this.fillType5=j(this.secondaryColor,{h:-64}),this.fillType6=j(this.primaryColor,{h:128}),this.fillType7=j(this.secondaryColor,{h:128});for(let T=0;T<this.THEME_COLOR_LIMIT;T++)this["pie"+T]=this["cScale"+T];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 T=0;T<8;T++)this["venn"+(T+1)]=this["venn"+(T+1)]??this["cScale"+T];this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.plotColorPalette)||"#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"},this.radar={axisColor:((f=this.radar)==null?void 0:f.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:((b=this.radar)==null?void 0:b.graticuleColor)||"#DEDEDE",graticuleStrokeWidth:((k=this.radar)==null?void 0:k.graticuleStrokeWidth)||1,graticuleOpacity:((S=this.radar)==null?void 0:S.graticuleOpacity)||.3,legendBoxSize:((E=this.radar)==null?void 0:E.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Y(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||j(this.primaryColor,{h:-30}),this.git4=this.pie5||j(this.primaryColor,{h:-60}),this.git5=this.pie6||j(this.primaryColor,{h:-90}),this.git6=this.pie7||j(this.primaryColor,{h:60}),this.git7=this.pie8||j(this.primaryColor,{h:120}),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(this.git7),this.branchLabelColor=this.branchLabelColor||this.labelTextColor,this.gitBranchLabel0=this.branchLabelColor,this.gitBranchLabel1="white",this.gitBranchLabel2=this.branchLabelColor,this.gitBranchLabel3="white",this.gitBranchLabel4=this.branchLabelColor,this.gitBranchLabel5=this.branchLabelColor,this.gitBranchLabel6=this.branchLabelColor,this.gitBranchLabel7=this.branchLabelColor,this.tagLabelColor=this.tagLabelColor||this.primaryTextColor,this.tagLabelBackground=this.tagLabelBackground||this.primaryColor,this.tagLabelBorder=this.tagBorder||this.primaryBorderColor,this.tagLabelFontSize=this.tagLabelFontSize||"10px",this.commitLabelColor=this.commitLabelColor||this.secondaryTextColor,this.commitLabelBackground=this.commitLabelBackground||this.secondaryColor,this.commitLabelFontSize=this.commitLabelFontSize||"10px",this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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(bs,"Theme"),bs),J4=v(t=>{const e=new Q4;return e.calculate(t),e},"getThemeVariables"),Cs,tP=(Cs=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=Pt(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,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||j(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||j(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(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?Y(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||Y(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=j(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||j(e,{h:30}),this.cScale4=this.cScale4||j(e,{h:60}),this.cScale5=this.cScale5||j(e,{h:90}),this.cScale6=this.cScale6||j(e,{h:120}),this.cScale7=this.cScale7||j(e,{h:150}),this.cScale8=this.cScale8||j(e,{h:210,l:150}),this.cScale9=this.cScale9||j(e,{h:270}),this.cScale10=this.cScale10||j(e,{h:300}),this.cScale11=this.cScale11||j(e,{h:330}),this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Y(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Y(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(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]||Y(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]||j(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||j(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||j(e,{h:64}),this.fillType3=this.fillType3||j(r,{h:64}),this.fillType4=this.fillType4||j(e,{h:-64}),this.fillType5=this.fillType5||j(r,{h:-64}),this.fillType6=this.fillType6||j(e,{h:128}),this.fillType7=this.fillType7||j(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||j(e,{l:-10}),this.pie5=this.pie5||j(r,{l:-10}),this.pie6=this.pie6||j(n,{l:-10}),this.pie7=this.pie7||j(e,{h:60,l:-10}),this.pie8=this.pie8||j(e,{h:-60,l:-10}),this.pie9=this.pie9||j(e,{h:120,l:0}),this.pie10=this.pie10||j(e,{h:60,l:-20}),this.pie11=this.pie11||j(e,{h:-60,l:-20}),this.pie12=this.pie12||j(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||j(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.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?Y(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||j(e,{h:-30}),this.git4=this.git4||j(e,{h:-60}),this.git5=this.git5||j(e,{h:-90}),this.git6=this.git6||j(e,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(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||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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),eP=v(t=>{const e=new tP;return e.calculate(t),e},"getThemeVariables"),ks,rP=(ks=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=j(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(H("#323D47"),10),this.border1="#ccc",this.border2=Rn(255,255,255,.25),this.arrowheadColor=H(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,c,u,d,p;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||j(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||j(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(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?Y(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||Y(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(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||j(this.primaryColor,{h:30}),this.cScale4=this.cScale4||j(this.primaryColor,{h:60}),this.cScale5=this.cScale5||j(this.primaryColor,{h:90}),this.cScale6=this.cScale6||j(this.primaryColor,{h:120}),this.cScale7=this.cScale7||j(this.primaryColor,{h:150}),this.cScale8=this.cScale8||j(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||j(this.primaryColor,{h:270}),this.cScale10=this.cScale10||j(this.primaryColor,{h:300}),this.cScale11=this.cScale11||j(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=Y(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=Y(this["cScale"+f],25);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||K(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||Y(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=this["cScaleLabel"+f]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||j(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||j(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||j(this.primaryColor,{h:64}),this.fillType3=this.fillType3||j(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||j(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||j(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||j(this.primaryColor,{h:128}),this.fillType7=this.fillType7||j(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||j(this.primaryColor,{l:-10}),this.pie5=this.pie5||j(this.secondaryColor,{l:-10}),this.pie6=this.pie6||j(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||j(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||j(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||j(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||j(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||j(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||j(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||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.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?Y(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(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||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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(ks,"Theme"),ks),nP=v(t=>{const e=new rP;return e.calculate(t),e},"getThemeVariables"),vs,iP=(vs=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=Pt("#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,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||j(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||j(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(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?Y(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||Y(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=j(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]=Y(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=Y(this["cScale"+g],25);for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScaleInv"+g]=this["cScaleInv"+g]||H(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]||Y(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]||j(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||j(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||j(e,{h:64}),this.fillType3=this.fillType3||j(r,{h:64}),this.fillType4=this.fillType4||j(e,{h:-64}),this.fillType5=this.fillType5||j(r,{h:-64}),this.fillType6=this.fillType6||j(e,{h:128}),this.fillType7=this.fillType7||j(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||j(e,{l:-10}),this.pie5=this.pie5||j(r,{l:-10}),this.pie6=this.pie6||j(n,{l:-10}),this.pie7=this.pie7||j(e,{h:60,l:-10}),this.pie8=this.pie8||j(e,{h:-60,l:-10}),this.pie9=this.pie9||j(e,{h:120,l:0}),this.pie10=this.pie10||j(e,{h:60,l:-20}),this.pie11=this.pie11||j(e,{h:-60,l:-20}),this.pie12=this.pie12||j(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||j(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.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?Y(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||j(e,{h:-30}),this.git4=this.git4||j(e,{h:-60}),this.git5=this.git5||j(e,{h:-90}),this.git6=this.git6||j(e,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(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||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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(vs,"Theme"),vs),sP=v(t=>{const e=new iP;return e.calculate(t),e},"getThemeVariables"),ws,oP=(ws=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=j(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(H("#323D47"),10),this.border1="#ccc",this.border2=Rn(255,255,255,.25),this.arrowheadColor=H(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,c,u,d,p;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||j(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||j(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(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?Y(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||Y(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(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||j(this.primaryColor,{h:30}),this.cScale4=this.cScale4||j(this.primaryColor,{h:60}),this.cScale5=this.cScale5||j(this.primaryColor,{h:90}),this.cScale6=this.cScale6||j(this.primaryColor,{h:120}),this.cScale7=this.cScale7||j(this.primaryColor,{h:150}),this.cScale8=this.cScale8||j(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||j(this.primaryColor,{h:270}),this.cScale10=this.cScale10||j(this.primaryColor,{h:300}),this.cScale11=this.cScale11||j(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=Y(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=Y(this["cScale"+f],25);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||K(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||Y(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=this["cScaleLabel"+f]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||j(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||j(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||j(this.primaryColor,{h:64}),this.fillType3=this.fillType3||j(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||j(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||j(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||j(this.primaryColor,{h:128}),this.fillType7=this.fillType7||j(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||j(this.primaryColor,{l:-10}),this.pie5=this.pie5||j(this.secondaryColor,{l:-10}),this.pie6=this.pie6||j(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||j(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||j(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||j(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||j(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||j(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||j(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||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.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?Y(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||j(this.primaryColor,{h:-30}),this.git4=this.git4||j(this.primaryColor,{h:-60}),this.git5=this.git5||j(this.primaryColor,{h:-90}),this.git6=this.git6||j(this.primaryColor,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(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||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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(ws,"Theme"),ws),aP=v(t=>{const e=new oP;return e.calculate(t),e},"getThemeVariables"),Ss,lP=(Ss=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=Pt(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,c,u,d,p,f,m,x;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||j(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||j(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(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?Y(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||Y(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=j(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]||H(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]||Y(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]||j(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||j(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||j(e,{h:64}),this.fillType3=this.fillType3||j(r,{h:64}),this.fillType4=this.fillType4||j(e,{h:-64}),this.fillType5=this.fillType5||j(r,{h:-64}),this.fillType6=this.fillType6||j(e,{h:128}),this.fillType7=this.fillType7||j(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||j(e,{l:-10}),this.pie5=this.pie5||j(r,{l:-10}),this.pie6=this.pie6||j(n,{l:-10}),this.pie7=this.pie7||j(e,{h:60,l:-10}),this.pie8=this.pie8||j(e,{h:-60,l:-10}),this.pie9=this.pie9||j(e,{h:120,l:0}),this.pie10=this.pie10||j(e,{h:60,l:-20}),this.pie11=this.pie11||j(e,{h:-60,l:-20}),this.pie12=this.pie12||j(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||j(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((f=this.xyChart)==null?void 0:f.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?Y(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||j(e,{h:-30}),this.git4=this.git4||j(e,{h:-60}),this.git5=this.git5||j(e,{h:-90}),this.git6=this.git6||j(e,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(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||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}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),cP=v(t=>{const e=new lP;return e.calculate(t),e},"getThemeVariables"),Ts,hP=(Ts=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=K(this.primaryColor,16),this.tertiaryColor=j(this.primaryColor,{h:-160}),this.primaryBorderColor=H(this.background),this.secondaryBorderColor=Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Pt(this.tertiaryColor,this.darkMode),this.primaryTextColor=H(this.primaryColor),this.secondaryTextColor=H(this.secondaryColor),this.tertiaryTextColor=H(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=K(H("#323D47"),10),this.border1="#ccc",this.border2=Rn(255,255,255,.25),this.arrowheadColor=H(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,c,u,d,p;this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||j(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||j(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Pt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Pt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Pt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Pt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||H(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||H(this.tertiaryColor),this.lineColor=this.lineColor||H(this.background),this.arrowheadColor=this.arrowheadColor||H(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?Y(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||Y(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(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 f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleInv"+f]=this["cScaleInv"+f]||H(this["cScale"+f]);for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this.darkMode?this["cScalePeer"+f]=this["cScalePeer"+f]||K(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||Y(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=Y(this["cScale"+f],75);const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||j(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||j(this.mainBkg,{h:180,s:-15,l:e*(8+f*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||j(this.primaryColor,{h:64}),this.fillType3=this.fillType3||j(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||j(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||j(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||j(this.primaryColor,{h:128}),this.fillType7=this.fillType7||j(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||j(this.primaryColor,{l:-10}),this.pie5=this.pie5||j(this.secondaryColor,{l:-10}),this.pie6=this.pie6||j(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||j(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||j(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||j(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||j(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||j(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||j(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||j(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||j(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||j(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||j(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||j(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||j(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Vr(this.quadrant1Fill)?K(this.quadrant1Fill):Y(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:((c=this.xyChart)==null?void 0:c.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:((p=this.xyChart)==null?void 0:p.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?Y(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||j(this.primaryColor,{h:-30}),this.git4=this.git4||j(this.primaryColor,{h:-60}),this.git5=this.git5||j(this.primaryColor,{h:-90}),this.git6=this.git6||j(this.primaryColor,{h:60}),this.git7=this.git7||j(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=Y(this.git0,25),this.git1=Y(this.git1,25),this.git2=Y(this.git2,25),this.git3=Y(this.git3,25),this.git4=Y(this.git4,25),this.git5=Y(this.git5,25),this.git6=Y(this.git6,25),this.git7=Y(this.git7,25)),this.gitInv0=this.gitInv0||H(this.git0),this.gitInv1=this.gitInv1||H(this.git1),this.gitInv2=this.gitInv2||H(this.git2),this.gitInv3=this.gitInv3||H(this.git3),this.gitInv4=this.gitInv4||H(this.git4),this.gitInv5=this.gitInv5||H(this.git5),this.gitInv6=this.gitInv6||H(this.git6),this.gitInv7=this.gitInv7||H(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||hn,this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||un}calculate(e){if(typeof e!="object"){this.updateColors();return}const r=Object.keys(e);r.forEach(n=>{this[n]=e[n]}),this.updateColors(),r.forEach(n=>{this[n]=e[n]})}},v(Ts,"Theme"),Ts),uP=v(t=>{const e=new hP;return e.calculate(t),e},"getThemeVariables"),bn={base:{getThemeVariables:U4},dark:{getThemeVariables:V4},default:{getThemeVariables:X4},forest:{getThemeVariables:Z4},neutral:{getThemeVariables:J4},neo:{getThemeVariables:eP},"neo-dark":{getThemeVariables:nP},redux:{getThemeVariables:sP},"redux-dark":{getThemeVariables:aP},"redux-color":{getThemeVariables:cP},"redux-dark-color":{getThemeVariables:uP}},vr={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},hC={...vr,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:bn.default.getThemeVariables(),sequence:{...vr.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...vr.gantt,tickInterval:void 0,useWidth:void 0},c4:{...vr.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...vr.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:{...vr.pie,useWidth:984},xyChart:{...vr.xyChart,useWidth:void 0},requirement:{...vr.requirement,useWidth:void 0},packet:{...vr.packet},treeView:{...vr.treeView,useWidth:void 0},radar:{...vr.radar},ishikawa:{...vr.ishikawa},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...vr.venn}},uC=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...uC(t[n],"")]:[...r,e+n],[]),"keyify"),dP=new Set(uC(hC,"")),dC=hC,tc=v(t=>{if(rt.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>tc(e));return}for(const e of Object.keys(t)){if(rt.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!dP.has(e)||t[e]==null){rt.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){rt.debug("sanitizing object",e),tc(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(rt.debug("sanitizing css option",e),t[e]=fP(t[e]))}if(t.themeVariables)for(const e of Object.keys(t.themeVariables)){const r=t.themeVariables[e];r!=null&&r.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[e]="")}rt.debug("After sanitization",t)}},"sanitizeDirective"),fP=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"),Is=Object.freeze(dC),Tn=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),ur=Ie({},Is),ec,vi=[],Ho=Ie({},Is),th=v((t,e)=>{let r=Ie({},t),n={};for(const i of e)mC(i),n=Ie(n,i);if(r=Ie(r,n),n.theme&&n.theme in bn){const i=Ie({},ec),s=Ie(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in bn&&(r.themeVariables=bn[r.theme].getThemeVariables(s))}return Ho=r,xC(Ho),Ho},"updateCurrentConfig"),pP=v(t=>(ur=Ie({},Is),ur=Ie(ur,t),t.theme&&bn[t.theme]&&(ur.themeVariables=bn[t.theme].getThemeVariables(t.themeVariables)),th(ur,vi),ur),"setSiteConfig"),mP=v(t=>{ec=Ie({},t)},"saveConfigFromInitialize"),gP=v(t=>(ur=Ie(ur,t),th(ur,vi),ur),"updateSiteConfig"),fC=v(()=>Ie({},ur),"getSiteConfig"),pC=v(t=>(xC(t),Ie(Ho,t),be()),"setConfig"),be=v(()=>Ie({},Ho),"getConfig"),mC=v(t=>{t&&(["secure",...ur.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(rt.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])}),Object.keys(t).forEach(e=>{e.startsWith("__")&&delete t[e]}),Object.keys(t).forEach(e=>{typeof t[e]=="string"&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],typeof t[e]=="object"&&mC(t[e])}))},"sanitize"),xP=v(t=>{var e;tc(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),vi.push(t),th(ur,vi)},"addDirective"),rc=v((t=ur)=>{vi=[],th(t,vi)},"reset"),yP={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."},Kg={},gC=v(t=>{Kg[t]||(rt.warn(yP[t]),Kg[t]=!0)},"issueWarning"),xC=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&gC("LAZY_LOAD_DEPRECATED")},"checkConfig"),ttt=v(()=>{let t={};ec&&(t=Ie(t,ec));for(const e of vi)t=Ie(t,e);return t},"getUserDefinedConfig"),ir=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&gC("FLOWCHART_HTML_LABELS_DEPRECATED"),Tn(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),va=/<br\s*\/?>/gi,bP=v(t=>t?CC(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),CP=(()=>{let t=!1;return()=>{t||(yC(),t=!0)}})();function yC(){const t="data-temp-href-target";Ms.addHook("beforeSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),Ms.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(yC,"setupDompurifyHooks");var bC=v(t=>(CP(),Ms.sanitize(t)),"removeScript"),Zg=v((t,e)=>{if(ir(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=bC(t):r!=="loose"&&(t=CC(t),t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=t.replace(/=/g,"&equals;"),t=SP(t))}return t},"sanitizeMore"),Gr=v((t,e)=>t&&(e.dompurifyConfig?t=Ms.sanitize(Zg(t,e),e.dompurifyConfig).toString():t=Ms.sanitize(Zg(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),kP=v((t,e)=>typeof t=="string"?Gr(t,e):t.flat().map(r=>Gr(r,e)),"sanitizeTextOrArray"),vP=v(t=>va.test(t),"hasBreaks"),wP=v(t=>t.split(va),"splitBreaks"),SP=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),CC=v(t=>t.replace(va,"#br#"),"breakToPlaceholder"),TP=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"),_P=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),EP=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),Qg=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];NP(s,o)&&(i=s+","+o,n++,r.pop())}r.push(jP(i))}return r.join("")},"parseGenericTypes"),fd=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),NP=v((t,e)=>{const r=fd(t,"~"),n=fd(e,"~");return r===1&&n===1},"shouldCombineSets"),jP=v(t=>{const e=fd(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"),Jg=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),pd=/\$\$(.*)\$\$/g,ta=v(t=>{var e;return(((e=t.match(pd))==null?void 0:e.length)??0)>0},"hasKatex"),ett=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await kC(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"),LP=v(async(t,e)=>{if(!ta(t))return t;if(!(Jg()||e.legacyMathML||e.forceLegacyMathML))return t.replace(pd,"MathML is unsupported in this environment.");{const{default:r}=await Jt(async()=>{const{default:i}=await import("./katex-DkKDou_j.js");return{default:i}},[]),n=e.forceLegacyMathML||!Jg()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(va).map(i=>ta(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(pd,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),kC=v(async(t,e)=>Gr(await LP(t,e),e),"renderKatexSanitized"),wa={getRows:bP,sanitizeText:Gr,sanitizeTextOrArray:kP,hasBreaks:vP,splitBreaks:wP,lineBreakRegex:va,removeScript:bC,getUrl:TP,evaluate:Tn,getMax:_P,getMin:EP},BP=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),AP=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"),vC=v(function(t,e,r,n){const i=AP(e,r,n);BP(t,i)},"configureSvgSize"),MP=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;rt.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;rt.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,rt.info(`Calculated bounds: ${a}x${l}`),vC(e,l,a,n);const c=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;e.attr("viewBox",c)},"setupGraphViewbox"),El={},IP=v((t,e,r,n)=>{let i="";return t in El&&El[t]?i=El[t]({...r,svgId:n}):rt.warn(`No theme found for ${t}`),` & {
344
- font-family: ${r.fontFamily};
345
- font-size: ${r.fontSize};
346
- fill: ${r.textColor}
347
- }
348
- @keyframes edge-animation-frame {
349
- from {
350
- stroke-dashoffset: 0;
351
- }
352
- }
353
- @keyframes dash {
354
- to {
355
- stroke-dashoffset: 0;
356
- }
357
- }
358
- & .edge-animation-slow {
359
- stroke-dasharray: 9,5 !important;
360
- stroke-dashoffset: 900;
361
- animation: dash 50s linear infinite;
362
- stroke-linecap: round;
363
- }
364
- & .edge-animation-fast {
365
- stroke-dasharray: 9,5 !important;
366
- stroke-dashoffset: 900;
367
- animation: dash 20s linear infinite;
368
- stroke-linecap: round;
369
- }
370
- /* Classes common for multiple diagrams */
371
-
372
- & .error-icon {
373
- fill: ${r.errorBkgColor};
374
- }
375
- & .error-text {
376
- fill: ${r.errorTextColor};
377
- stroke: ${r.errorTextColor};
378
- }
379
-
380
- & .edge-thickness-normal {
381
- stroke-width: ${r.strokeWidth??1}px;
382
- }
383
- & .edge-thickness-thick {
384
- stroke-width: 3.5px
385
- }
386
- & .edge-pattern-solid {
387
- stroke-dasharray: 0;
388
- }
389
- & .edge-thickness-invisible {
390
- stroke-width: 0;
391
- fill: none;
392
- }
393
- & .edge-pattern-dashed{
394
- stroke-dasharray: 3;
395
- }
396
- .edge-pattern-dotted {
397
- stroke-dasharray: 2;
398
- }
399
-
400
- & .marker {
401
- fill: ${r.lineColor};
402
- stroke: ${r.lineColor};
403
- }
404
- & .marker.cross {
405
- stroke: ${r.lineColor};
406
- }
407
-
408
- & svg {
409
- font-family: ${r.fontFamily};
410
- font-size: ${r.fontSize};
411
- }
412
- & p {
413
- margin: 0
414
- }
415
-
416
- ${i}
417
- .node .neo-node {
418
- stroke: ${r.nodeBorder};
419
- }
420
-
421
- [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
422
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
423
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
424
- }
425
-
426
-
427
- [data-look="neo"].node path {
428
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
429
- stroke-width: ${r.strokeWidth??1}px;
430
- }
431
-
432
- [data-look="neo"].node .outer-path {
433
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
434
- }
435
-
436
- [data-look="neo"].node .neo-line path {
437
- stroke: ${r.nodeBorder};
438
- filter: none;
439
- }
440
-
441
- [data-look="neo"].node circle{
442
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
443
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
444
- }
445
-
446
- [data-look="neo"].node circle .state-start{
447
- fill: #000000;
448
- }
449
-
450
- [data-look="neo"].icon-shape .icon {
451
- fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
452
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
453
- }
454
-
455
- [data-look="neo"].icon-shape .icon-neo path {
456
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
457
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
458
- }
459
-
460
- ${e}
461
- `},"getStyles"),FP=v((t,e)=>{e!==void 0&&(El[t]=e)},"addStylesForDiagram"),PP=IP,wC={};h4(wC,{clear:()=>DP,getAccDescription:()=>zP,getAccTitle:()=>$P,getDiagramTitle:()=>qP,setAccDescription:()=>RP,setAccTitle:()=>OP,setDiagramTitle:()=>WP});var ap="",lp="",cp="",hp=v(t=>Gr(t,be()),"sanitizeText"),DP=v(()=>{ap="",cp="",lp=""},"clear"),OP=v(t=>{ap=hp(t).replace(/^\s+/g,"")},"setAccTitle"),$P=v(()=>ap,"getAccTitle"),RP=v(t=>{cp=hp(t).replace(/\n\s+/g,`
462
- `)},"setAccDescription"),zP=v(()=>cp,"getAccDescription"),WP=v(t=>{lp=hp(t)},"setDiagramTitle"),qP=v(()=>lp,"getDiagramTitle"),tx=rt,HP=sp,te=be,rtt=pC,ntt=Is,up=v(t=>Gr(t,te()),"sanitizeText"),UP=MP,GP=v(()=>wC,"getCommonDb"),nc={},ic=v((t,e,r)=>{var n;nc[t]&&tx.warn(`Diagram with id ${t} already registered. Overwriting.`),nc[t]=e,r&&cC(t,r),FP(t,e.styles),(n=e.injectUtils)==null||n.call(e,tx,HP,te,up,UP,GP(),()=>{})},"registerDiagram"),md=v(t=>{if(t in nc)return nc[t];throw new VP(t)},"getDiagram"),_s,VP=(_s=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(_s,"DiagramNotFoundError"),_s),YP={value:()=>{}};function SC(){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 Nl(r)}function Nl(t){this._=t}function XP(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}})}Nl.prototype=SC.prototype={constructor:Nl,on:function(t,e){var r=this._,n=XP(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=KP(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]=ex(r[i],t.name,e);else if(e==null)for(i in r)r[i]=ex(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 Nl(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 KP(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function ex(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=YP,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var gd="http://www.w3.org/1999/xhtml";const rx={svg:"http://www.w3.org/2000/svg",xhtml:gd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function eh(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),rx.hasOwnProperty(e)?{space:rx[e],local:t}:t}function ZP(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===gd&&e.documentElement.namespaceURI===gd?e.createElement(t):e.createElementNS(r,t)}}function QP(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function TC(t){var e=eh(t);return(e.local?QP:ZP)(e)}function JP(){}function dp(t){return t==null?JP:function(){return this.querySelector(t)}}function tD(t){typeof t!="function"&&(t=dp(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,c,u=0;u<o;++u)(l=s[u])&&(c=t.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new Nr(n,this._parents)}function eD(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function rD(){return[]}function _C(t){return t==null?rD:function(){return this.querySelectorAll(t)}}function nD(t){return function(){return eD(t.apply(this,arguments))}}function iD(t){typeof t=="function"?t=nD(t):t=_C(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,c=0;c<a;++c)(l=o[c])&&(n.push(t.call(l,l.__data__,c,o)),i.push(l));return new Nr(n,i)}function EC(t){return function(){return this.matches(t)}}function NC(t){return function(e){return e.matches(t)}}var sD=Array.prototype.find;function oD(t){return function(){return sD.call(this.children,t)}}function aD(){return this.firstElementChild}function lD(t){return this.select(t==null?aD:oD(typeof t=="function"?t:NC(t)))}var cD=Array.prototype.filter;function hD(){return Array.from(this.children)}function uD(t){return function(){return cD.call(this.children,t)}}function dD(t){return this.selectAll(t==null?hD:uD(typeof t=="function"?t:NC(t)))}function fD(t){typeof t!="function"&&(t=EC(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,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new Nr(n,this._parents)}function jC(t){return new Array(t.length)}function pD(){return new Nr(this._enter||this._groups.map(jC),this._parents)}function sc(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}sc.prototype={constructor:sc,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 mD(t){return function(){return t}}function gD(t,e,r,n,i,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):r[o]=new sc(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function xD(t,e,r,n,i,s,o){var a,l,c=new Map,u=e.length,d=s.length,p=new Array(u),f;for(a=0;a<u;++a)(l=e[a])&&(p[a]=f=o.call(l,l.__data__,a,e)+"",c.has(f)?i[a]=l:c.set(f,l));for(a=0;a<d;++a)f=o.call(t,s[a],a,s)+"",(l=c.get(f))?(n[a]=l,l.__data__=s[a],c.delete(f)):r[a]=new sc(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(i[a]=l)}function yD(t){return t.__data__}function bD(t,e){if(!arguments.length)return Array.from(this,yD);var r=e?xD:gD,n=this._parents,i=this._groups;typeof t!="function"&&(t=mD(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],d=i[c],p=d.length,f=CD(t.call(u,u&&u.__data__,c,n)),m=f.length,x=a[c]=new Array(m),g=o[c]=new Array(m),y=l[c]=new Array(p);r(u,d,x,g,y,f,e);for(var b=0,k=0,S,E;b<m;++b)if(S=x[b]){for(b>=k&&(k=b+1);!(E=g[k])&&++k<m;);S._next=E||null}}return o=new Nr(o,n),o._enter=a,o._exit=l,o}function CD(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function kD(){return new Nr(this._exit||this._groups.map(jC),this._parents)}function vD(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 wD(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 c=r[l],u=n[l],d=c.length,p=a[l]=new Array(d),f,m=0;m<d;++m)(f=c[m]||u[m])&&(p[m]=f);for(;l<i;++l)a[l]=r[l];return new Nr(a,this._parents)}function SD(){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 TD(t){t||(t=_D);function e(d,p){return d&&p?t(d.__data__,p.__data__):!d-!p}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),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new Nr(i,this._parents).order()}function _D(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ED(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ND(){return Array.from(this)}function jD(){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 LD(){let t=0;for(const e of this)++t;return t}function BD(){return!this.node()}function AD(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 MD(t){return function(){this.removeAttribute(t)}}function ID(t){return function(){this.removeAttributeNS(t.space,t.local)}}function FD(t,e){return function(){this.setAttribute(t,e)}}function PD(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function DD(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function OD(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 $D(t,e){var r=eh(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?ID:MD:typeof e=="function"?r.local?OD:DD:r.local?PD:FD)(r,e))}function LC(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function RD(t){return function(){this.style.removeProperty(t)}}function zD(t,e,r){return function(){this.style.setProperty(t,e,r)}}function WD(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function qD(t,e,r){return arguments.length>1?this.each((e==null?RD:typeof e=="function"?WD:zD)(t,e,r??"")):Fs(this.node(),t)}function Fs(t,e){return t.style.getPropertyValue(e)||LC(t).getComputedStyle(t,null).getPropertyValue(e)}function HD(t){return function(){delete this[t]}}function UD(t,e){return function(){this[t]=e}}function GD(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function VD(t,e){return arguments.length>1?this.each((e==null?HD:typeof e=="function"?GD:UD)(t,e)):this.node()[t]}function BC(t){return t.trim().split(/^|\s+/)}function fp(t){return t.classList||new AC(t)}function AC(t){this._node=t,this._names=BC(t.getAttribute("class")||"")}AC.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 MC(t,e){for(var r=fp(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function IC(t,e){for(var r=fp(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function YD(t){return function(){MC(this,t)}}function XD(t){return function(){IC(this,t)}}function KD(t,e){return function(){(e.apply(this,arguments)?MC:IC)(this,t)}}function ZD(t,e){var r=BC(t+"");if(arguments.length<2){for(var n=fp(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?KD:e?YD:XD)(r,e))}function QD(){this.textContent=""}function JD(t){return function(){this.textContent=t}}function tO(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function eO(t){return arguments.length?this.each(t==null?QD:(typeof t=="function"?tO:JD)(t)):this.node().textContent}function rO(){this.innerHTML=""}function nO(t){return function(){this.innerHTML=t}}function iO(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function sO(t){return arguments.length?this.each(t==null?rO:(typeof t=="function"?iO:nO)(t)):this.node().innerHTML}function oO(){this.nextSibling&&this.parentNode.appendChild(this)}function aO(){return this.each(oO)}function lO(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function cO(){return this.each(lO)}function hO(t){var e=typeof t=="function"?t:TC(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function uO(){return null}function dO(t,e){var r=typeof t=="function"?t:TC(t),n=e==null?uO:typeof e=="function"?e:dp(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function fO(){var t=this.parentNode;t&&t.removeChild(this)}function pO(){return this.each(fO)}function mO(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function gO(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function xO(t){return this.select(t?gO:mO)}function yO(t){return arguments.length?this.property("__data__",t):this.node().__data__}function bO(t){return function(e){t.call(this,e,this.__data__)}}function CO(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 kO(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 vO(t,e,r){return function(){var n=this.__on,i,s=bO(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 wO(t,e,r){var n=CO(t+""),i,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++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?vO:kO,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function FC(t,e,r){var n=LC(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 SO(t,e){return function(){return FC(this,t,e)}}function TO(t,e){return function(){return FC(this,t,e.apply(this,arguments))}}function _O(t,e){return this.each((typeof e=="function"?TO:SO)(t,e))}function*EO(){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 PC=[null];function Nr(t,e){this._groups=t,this._parents=e}function Sa(){return new Nr([[document.documentElement]],PC)}function NO(){return this}Nr.prototype=Sa.prototype={constructor:Nr,select:tD,selectAll:iD,selectChild:lD,selectChildren:dD,filter:fD,data:bD,enter:pD,exit:kD,join:vD,merge:wD,selection:NO,order:SD,sort:TD,call:ED,nodes:ND,node:jD,size:LD,empty:BD,each:AD,attr:$D,style:qD,property:VD,classed:ZD,text:eO,html:sO,raise:aO,lower:cO,append:hO,insert:dO,remove:pO,clone:xO,datum:yO,on:wO,dispatch:_O,[Symbol.iterator]:EO};function Ut(t){return typeof t=="string"?new Nr([[document.querySelector(t)]],[document.documentElement]):new Nr([[t]],PC)}function pp(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function DC(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Ta(){}var ea=.7,oc=1/ea,hs="\\s*([+-]?\\d+)\\s*",ra="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",nn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jO=/^#([0-9a-f]{3,8})$/,LO=new RegExp(`^rgb\\(${hs},${hs},${hs}\\)$`),BO=new RegExp(`^rgb\\(${nn},${nn},${nn}\\)$`),AO=new RegExp(`^rgba\\(${hs},${hs},${hs},${ra}\\)$`),MO=new RegExp(`^rgba\\(${nn},${nn},${nn},${ra}\\)$`),IO=new RegExp(`^hsl\\(${ra},${nn},${nn}\\)$`),FO=new RegExp(`^hsla\\(${ra},${nn},${nn},${ra}\\)$`),nx={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};pp(Ta,na,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ix,formatHex:ix,formatHex8:PO,formatHsl:DO,formatRgb:sx,toString:sx});function ix(){return this.rgb().formatHex()}function PO(){return this.rgb().formatHex8()}function DO(){return OC(this).formatHsl()}function sx(){return this.rgb().formatRgb()}function na(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=jO.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?ox(e):r===3?new fr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?tl(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?tl(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=LO.exec(t))?new fr(e[1],e[2],e[3],1):(e=BO.exec(t))?new fr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=AO.exec(t))?tl(e[1],e[2],e[3],e[4]):(e=MO.exec(t))?tl(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=IO.exec(t))?cx(e[1],e[2]/100,e[3]/100,1):(e=FO.exec(t))?cx(e[1],e[2]/100,e[3]/100,e[4]):nx.hasOwnProperty(t)?ox(nx[t]):t==="transparent"?new fr(NaN,NaN,NaN,0):null}function ox(t){return new fr(t>>16&255,t>>8&255,t&255,1)}function tl(t,e,r,n){return n<=0&&(t=e=r=NaN),new fr(t,e,r,n)}function OO(t){return t instanceof Ta||(t=na(t)),t?(t=t.rgb(),new fr(t.r,t.g,t.b,t.opacity)):new fr}function xd(t,e,r,n){return arguments.length===1?OO(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}pp(fr,xd,DC(Ta,{brighter(t){return t=t==null?oc:Math.pow(oc,t),new fr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ea:Math.pow(ea,t),new fr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new fr(xi(this.r),xi(this.g),xi(this.b),ac(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:ax,formatHex:ax,formatHex8:$O,formatRgb:lx,toString:lx}));function ax(){return`#${pi(this.r)}${pi(this.g)}${pi(this.b)}`}function $O(){return`#${pi(this.r)}${pi(this.g)}${pi(this.b)}${pi((isNaN(this.opacity)?1:this.opacity)*255)}`}function lx(){const t=ac(this.opacity);return`${t===1?"rgb(":"rgba("}${xi(this.r)}, ${xi(this.g)}, ${xi(this.b)}${t===1?")":`, ${t})`}`}function ac(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function xi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function pi(t){return t=xi(t),(t<16?"0":"")+t.toString(16)}function cx(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new zr(t,e,r,n)}function OC(t){if(t instanceof zr)return new zr(t.h,t.s,t.l,t.opacity);if(t instanceof Ta||(t=na(t)),!t)return new zr;if(t instanceof zr)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 zr(o,a,l,t.opacity)}function RO(t,e,r,n){return arguments.length===1?OC(t):new zr(t,e,r,n??1)}function zr(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}pp(zr,RO,DC(Ta,{brighter(t){return t=t==null?oc:Math.pow(oc,t),new zr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ea:Math.pow(ea,t),new zr(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(pu(t>=240?t-240:t+120,i,n),pu(t,i,n),pu(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new zr(hx(this.h),el(this.s),el(this.l),ac(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=ac(this.opacity);return`${t===1?"hsl(":"hsla("}${hx(this.h)}, ${el(this.s)*100}%, ${el(this.l)*100}%${t===1?")":`, ${t})`}`}}));function hx(t){return t=(t||0)%360,t<0?t+360:t}function el(t){return Math.max(0,Math.min(1,t||0))}function pu(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 mp=t=>()=>t;function $C(t,e){return function(r){return t+r*e}}function zO(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 itt(t,e){var r=e-t;return r?$C(t,r>180||r<-180?r-360*Math.round(r/360):r):mp(isNaN(t)?e:t)}function WO(t){return(t=+t)==1?RC:function(e,r){return r-e?zO(e,r,t):mp(isNaN(e)?r:e)}}function RC(t,e){var r=e-t;return r?$C(t,r):mp(isNaN(t)?e:t)}const ux=(function t(e){var r=WO(e);function n(i,s){var o=r((i=xd(i)).r,(s=xd(s)).r),a=r(i.g,s.g),l=r(i.b,s.b),c=RC(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return n.gamma=t,n})(1);function Dn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var yd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,mu=new RegExp(yd.source,"g");function qO(t){return function(){return t}}function HO(t){return function(e){return t(e)+""}}function UO(t,e){var r=yd.lastIndex=mu.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=yd.exec(t))&&(i=mu.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:Dn(n,i)})),r=mu.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?HO(l[0].x):qO(e):(e=l.length,function(c){for(var u=0,d;u<e;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}var dx=180/Math.PI,bd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zC(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)*dx,skewX:Math.atan(l)*dx,scaleX:o,scaleY:a}}var rl;function GO(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?bd:zC(e.a,e.b,e.c,e.d,e.e,e.f)}function VO(t){return t==null||(rl||(rl=document.createElementNS("http://www.w3.org/2000/svg","g")),rl.setAttribute("transform",t),!(t=rl.transform.baseVal.consolidate()))?bd:(t=t.matrix,zC(t.a,t.b,t.c,t.d,t.e,t.f))}function WC(t,e,r,n){function i(c){return c.length?c.pop()+" ":""}function s(c,u,d,p,f,m){if(c!==d||u!==p){var x=f.push("translate(",null,e,null,r);m.push({i:x-4,x:Dn(c,d)},{i:x-2,x:Dn(u,p)})}else(d||p)&&f.push("translate("+d+e+p+r)}function o(c,u,d,p){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),p.push({i:d.push(i(d)+"rotate(",null,n)-2,x:Dn(c,u)})):u&&d.push(i(d)+"rotate("+u+n)}function a(c,u,d,p){c!==u?p.push({i:d.push(i(d)+"skewX(",null,n)-2,x:Dn(c,u)}):u&&d.push(i(d)+"skewX("+u+n)}function l(c,u,d,p,f,m){if(c!==d||u!==p){var x=f.push(i(f)+"scale(",null,",",null,")");m.push({i:x-4,x:Dn(c,d)},{i:x-2,x:Dn(u,p)})}else(d!==1||p!==1)&&f.push(i(f)+"scale("+d+","+p+")")}return function(c,u){var d=[],p=[];return c=t(c),u=t(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,p),o(c.rotate,u.rotate,d,p),a(c.skewX,u.skewX,d,p),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,p),c=u=null,function(f){for(var m=-1,x=p.length,g;++m<x;)d[(g=p[m]).i]=g.x(f);return d.join("")}}}var YO=WC(GO,"px, ","px)","deg)"),XO=WC(VO,", ",")",")"),Ps=0,Lo=0,mo=0,qC=1e3,lc,Bo,cc=0,wi=0,rh=0,ia=typeof performance=="object"&&performance.now?performance:Date,HC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function gp(){return wi||(HC(KO),wi=ia.now()+rh)}function KO(){wi=0}function hc(){this._call=this._time=this._next=null}hc.prototype=UC.prototype={constructor:hc,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?gp():+r)+(e==null?0:+e),!this._next&&Bo!==this&&(Bo?Bo._next=this:lc=this,Bo=this),this._call=t,this._time=r,Cd()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cd())}};function UC(t,e,r){var n=new hc;return n.restart(t,e,r),n}function ZO(){gp(),++Ps;for(var t=lc,e;t;)(e=wi-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ps}function fx(){wi=(cc=ia.now())+rh,Ps=Lo=0;try{ZO()}finally{Ps=0,JO(),wi=0}}function QO(){var t=ia.now(),e=t-cc;e>qC&&(rh-=e,cc=t)}function JO(){for(var t,e=lc,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:lc=r);Bo=t,Cd(n)}function Cd(t){if(!Ps){Lo&&(Lo=clearTimeout(Lo));var e=t-wi;e>24?(t<1/0&&(Lo=setTimeout(fx,t-ia.now()-rh)),mo&&(mo=clearInterval(mo))):(mo||(cc=ia.now(),mo=setInterval(QO,qC)),Ps=1,HC(fx))}}function px(t,e,r){var n=new hc;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var t$=SC("start","end","cancel","interrupt"),e$=[],GC=0,mx=1,kd=2,jl=3,gx=4,vd=5,Ll=6;function nh(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;r$(t,r,{name:e,index:n,group:i,on:t$,tween:e$,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:GC})}function xp(t,e){var r=Yr(t,e);if(r.state>GC)throw new Error("too late; already scheduled");return r}function dn(t,e){var r=Yr(t,e);if(r.state>jl)throw new Error("too late; already running");return r}function Yr(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function r$(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=UC(s,0,r.time);function s(c){r.state=mx,r.timer.restart(o,r.delay,r.time),r.delay<=c&&o(c-r.delay)}function o(c){var u,d,p,f;if(r.state!==mx)return l();for(u in n)if(f=n[u],f.name===r.name){if(f.state===jl)return px(o);f.state===gx?(f.state=Ll,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete n[u]):+u<e&&(f.state=Ll,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete n[u])}if(px(function(){r.state===jl&&(r.state=gx,r.timer.restart(a,r.delay,r.time),a(c))}),r.state=kd,r.on.call("start",t,t.__data__,r.index,r.group),r.state===kd){for(r.state=jl,i=new Array(p=r.tween.length),u=0,d=-1;u<p;++u)(f=r.tween[u].value.call(t,t.__data__,r.index,r.group))&&(i[++d]=f);i.length=d+1}}function a(c){for(var u=c<r.duration?r.ease.call(null,c/r.duration):(r.timer.restart(l),r.state=vd,1),d=-1,p=i.length;++d<p;)i[d].call(t,u);r.state===vd&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=Ll,r.timer.stop(),delete n[e];for(var c in n)return;delete t.__transition}}function n$(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>kd&&n.state<vd,n.state=Ll,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function i$(t){return this.each(function(){n$(this,t)})}function s$(t,e){var r,n;return function(){var i=dn(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 o$(t,e,r){var n,i;if(typeof r!="function")throw new Error;return function(){var s=dn(this,t),o=s.tween;if(o!==n){i=(n=o).slice();for(var a={name:e,value:r},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function a$(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=Yr(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?s$:o$)(r,t,e))}function yp(t,e,r){var n=t._id;return t.each(function(){var i=dn(this,n);(i.value||(i.value={}))[e]=r.apply(this,arguments)}),function(i){return Yr(i,n).value[e]}}function VC(t,e){var r;return(typeof e=="number"?Dn:e instanceof na?ux:(r=na(e))?(e=r,ux):UO)(t,e)}function l$(t){return function(){this.removeAttribute(t)}}function c$(t){return function(){this.removeAttributeNS(t.space,t.local)}}function h$(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 u$(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 d$(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 f$(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 p$(t,e){var r=eh(t),n=r==="transform"?XO:VC;return this.attrTween(t,typeof e=="function"?(r.local?f$:d$)(r,n,yp(this,"attr."+t,e)):e==null?(r.local?c$:l$)(r):(r.local?u$:h$)(r,n,e))}function m$(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function g$(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function x$(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&g$(t,s)),r}return i._value=e,i}function y$(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&m$(t,s)),r}return i._value=e,i}function b$(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=eh(t);return this.tween(r,(n.local?x$:y$)(n,e))}function C$(t,e){return function(){xp(this,t).delay=+e.apply(this,arguments)}}function k$(t,e){return e=+e,function(){xp(this,t).delay=e}}function v$(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?C$:k$)(e,t)):Yr(this.node(),e).delay}function w$(t,e){return function(){dn(this,t).duration=+e.apply(this,arguments)}}function S$(t,e){return e=+e,function(){dn(this,t).duration=e}}function T$(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?w$:S$)(e,t)):Yr(this.node(),e).duration}function _$(t,e){if(typeof e!="function")throw new Error;return function(){dn(this,t).ease=e}}function E$(t){var e=this._id;return arguments.length?this.each(_$(e,t)):Yr(this.node(),e).ease}function N$(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;dn(this,t).ease=r}}function j$(t){if(typeof t!="function")throw new Error;return this.each(N$(this._id,t))}function L$(t){typeof t!="function"&&(t=EC(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,c=0;c<o;++c)(l=s[c])&&t.call(l,l.__data__,c,s)&&a.push(l);return new vn(n,this._parents,this._name,this._id)}function B$(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],c=r[a],u=l.length,d=o[a]=new Array(u),p,f=0;f<u;++f)(p=l[f]||c[f])&&(d[f]=p);for(;a<n;++a)o[a]=e[a];return new vn(o,this._parents,this._name,this._id)}function A$(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 M$(t,e,r){var n,i,s=A$(e)?xp:dn;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function I$(t,e){var r=this._id;return arguments.length<2?Yr(this.node(),r).on.on(t):this.each(M$(r,t,e))}function F$(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function P$(){return this.on("end.remove",F$(this._id))}function D$(t){var e=this._name,r=this._id;typeof t!="function"&&(t=dp(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,c=s[o]=new Array(l),u,d,p=0;p<l;++p)(u=a[p])&&(d=t.call(u,u.__data__,p,a))&&("__data__"in u&&(d.__data__=u.__data__),c[p]=d,nh(c[p],e,r,p,c,Yr(u,r)));return new vn(s,this._parents,e,r)}function O$(t){var e=this._name,r=this._id;typeof t!="function"&&(t=_C(t));for(var n=this._groups,i=n.length,s=[],o=[],a=0;a<i;++a)for(var l=n[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var p=t.call(u,u.__data__,d,l),f,m=Yr(u,r),x=0,g=p.length;x<g;++x)(f=p[x])&&nh(f,e,r,x,p,m);s.push(p),o.push(u)}return new vn(s,o,e,r)}var $$=Sa.prototype.constructor;function R$(){return new $$(this._groups,this._parents)}function z$(t,e){var r,n,i;return function(){var s=Fs(this,t),o=(this.style.removeProperty(t),Fs(this,t));return s===o?null:s===r&&o===n?i:i=e(r=s,n=o)}}function YC(t){return function(){this.style.removeProperty(t)}}function W$(t,e,r){var n,i=r+"",s;return function(){var o=Fs(this,t);return o===i?null:o===n?s:s=e(n=o,r)}}function q$(t,e,r){var n,i,s;return function(){var o=Fs(this,t),a=r(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),Fs(this,t))),o===l?null:o===n&&l===i?s:(i=l,s=e(n=o,a))}}function H$(t,e){var r,n,i,s="style."+e,o="end."+s,a;return function(){var l=dn(this,t),c=l.on,u=l.value[s]==null?a||(a=YC(e)):void 0;(c!==r||i!==u)&&(n=(r=c).copy()).on(o,i=u),l.on=n}}function U$(t,e,r){var n=(t+="")=="transform"?YO:VC;return e==null?this.styleTween(t,z$(t,n)).on("end.style."+t,YC(t)):typeof e=="function"?this.styleTween(t,q$(t,n,yp(this,"style."+t,e))).each(H$(this._id,t)):this.styleTween(t,W$(t,n,e),r).on("end.style."+t,null)}function G$(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function V$(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&G$(t,o,r)),n}return s._value=e,s}function Y$(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,V$(t,e,r??""))}function X$(t){return function(){this.textContent=t}}function K$(t){return function(){var e=t(this);this.textContent=e??""}}function Z$(t){return this.tween("text",typeof t=="function"?K$(yp(this,"text",t)):X$(t==null?"":t+""))}function Q$(t){return function(e){this.textContent=t.call(this,e)}}function J$(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&Q$(i)),e}return n._value=t,n}function tR(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,J$(t))}function eR(){for(var t=this._name,e=this._id,r=XC(),n=this._groups,i=n.length,s=0;s<i;++s)for(var o=n[s],a=o.length,l,c=0;c<a;++c)if(l=o[c]){var u=Yr(l,e);nh(l,t,r,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new vn(n,this._parents,t,r)}function rR(){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 c=dn(this,n),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),i===0&&s()})}var nR=0;function vn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function XC(){return++nR}var gn=Sa.prototype;vn.prototype={constructor:vn,select:D$,selectAll:O$,selectChild:gn.selectChild,selectChildren:gn.selectChildren,filter:L$,merge:B$,selection:R$,transition:eR,call:gn.call,nodes:gn.nodes,node:gn.node,size:gn.size,empty:gn.empty,each:gn.each,on:I$,attr:p$,attrTween:b$,style:U$,styleTween:Y$,text:Z$,textTween:tR,remove:P$,tween:a$,delay:v$,duration:T$,ease:E$,easeVarying:j$,end:rR,[Symbol.iterator]:gn[Symbol.iterator]};function iR(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var sR={time:null,delay:0,duration:250,ease:iR};function oR(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 aR(t){var e,r;t instanceof vn?(e=t._id,t=t._name):(e=XC(),(r=sR).time=gp(),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,c=0;c<a;++c)(l=o[c])&&nh(l,t,e,c,o,r||oR(l,e));return new vn(n,this._parents,t,e)}Sa.prototype.interrupt=i$;Sa.prototype.transition=aR;const wd=Math.PI,Sd=2*wd,ci=1e-6,lR=Sd-ci;function KC(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function cR(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return KC;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 hR{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?KC:cR(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,c=i-r,u=o-e,d=a-r,p=u*u+d*d;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(p>ci)if(!(Math.abs(d*l-c*u)>ci)||!s)this._append`L${this._x1=e},${this._y1=r}`;else{let f=n-o,m=i-a,x=l*l+c*c,g=f*f+m*m,y=Math.sqrt(x),b=Math.sqrt(p),k=s*Math.tan((wd-Math.acos((x+p-g)/(2*y*b)))/2),S=k/b,E=k/y;Math.abs(S-1)>ci&&this._append`L${e+S*u},${r+S*d}`,this._append`A${s},${s},0,0,${+(d*f>u*m)},${this._x1=e+E*l},${this._y1=r+E*c}`}}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),c=e+a,u=r+l,d=1^o,p=o?i-s:s-i;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>ci||Math.abs(this._y1-u)>ci)&&this._append`L${c},${u}`,n&&(p<0&&(p=p%Sd+Sd),p>lR?this._append`A${n},${n},0,1,${d},${e-a},${r-l}A${n},${n},0,1,${d},${this._x1=c},${this._y1=u}`:p>ci&&this._append`A${n},${n},0,${+(p>=wd)},${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 qi(t){return function(){return t}}const stt=Math.abs,ott=Math.atan2,att=Math.cos,ltt=Math.max,ctt=Math.min,htt=Math.sin,utt=Math.sqrt,xx=1e-12,bp=Math.PI,yx=bp/2,dtt=2*bp;function ftt(t){return t>1?0:t<-1?bp:Math.acos(t)}function ptt(t){return t>=1?yx:t<=-1?-yx:Math.asin(t)}function uR(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 hR(e)}function dR(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ZC(t){this._context=t}ZC.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 Uo(t){return new ZC(t)}function fR(t){return t[0]}function pR(t){return t[1]}function mR(t,e){var r=qi(!0),n=null,i=Uo,s=null,o=uR(a);t=typeof t=="function"?t:t===void 0?fR:qi(t),e=typeof e=="function"?e:e===void 0?pR:qi(e);function a(l){var c,u=(l=dR(l)).length,d,p=!1,f;for(n==null&&(s=i(f=o())),c=0;c<=u;++c)!(c<u&&r(d=l[c],c,l))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+t(d,c,l),+e(d,c,l));if(f)return s=null,f+""||null}return a.x=function(l){return arguments.length?(t=typeof l=="function"?l:qi(+l),a):t},a.y=function(l){return arguments.length?(e=typeof l=="function"?l:qi(+l),a):e},a.defined=function(l){return arguments.length?(r=typeof l=="function"?l:qi(!!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 QC{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 JC(t){return new QC(t,!0)}function tk(t){return new QC(t,!1)}function Un(){}function uc(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 ih(t){this._context=t}ih.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:uc(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:uc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Td(t){return new ih(t)}function ek(t){this._context=t}ek.prototype={areaStart:Un,areaEnd:Un,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:uc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function gR(t){return new ek(t)}function rk(t){this._context=t}rk.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:uc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function xR(t){return new rk(t)}function nk(t,e){this._basis=new ih(t),this._beta=e}nk.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 yR=(function t(e){function r(n){return e===1?new ih(n):new nk(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function dc(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 Cp(t,e){this._context=t,this._k=(1-e)/6}Cp.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:dc(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:dc(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 ik=(function t(e){function r(n){return new Cp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function kp(t,e){this._context=t,this._k=(1-e)/6}kp.prototype={areaStart:Un,areaEnd:Un,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:dc(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 bR=(function t(e){function r(n){return new kp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function vp(t,e){this._context=t,this._k=(1-e)/6}vp.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:dc(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 CR=(function t(e){function r(n){return new vp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function wp(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>xx){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>xx){var c=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*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,s,o,t._x2,t._y2)}function sk(t,e){this._context=t,this._alpha=e}sk.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:wp(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 ok=(function t(e){function r(n){return e?new sk(n,e):new Cp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function ak(t,e){this._context=t,this._alpha=e}ak.prototype={areaStart:Un,areaEnd:Un,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:wp(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 kR=(function t(e){function r(n){return e?new ak(n,e):new kp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function lk(t,e){this._context=t,this._alpha=e}lk.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:wp(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 vR=(function t(e){function r(n){return e?new lk(n,e):new vp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function ck(t){this._context=t}ck.prototype={areaStart:Un,areaEnd:Un,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 wR(t){return new ck(t)}function bx(t){return t<0?-1:1}function Cx(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(bx(s)+bx(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function kx(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function gu(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 fc(t){this._context=t}fc.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:gu(this,this._t0,kx(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,gu(this,kx(this,r=Cx(this,t,e)),r);break;default:gu(this,this._t0,r=Cx(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function hk(t){this._context=new uk(t)}(hk.prototype=Object.create(fc.prototype)).point=function(t,e){fc.prototype.point.call(this,e,t)};function uk(t){this._context=t}uk.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 dk(t){return new fc(t)}function fk(t){return new hk(t)}function pk(t){this._context=t}pk.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=vx(t),i=vx(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 vx(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 mk(t){return new pk(t)}function sh(t,e){this._context=t,this._t=e}sh.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 gk(t){return new sh(t,.5)}function xk(t){return new sh(t,0)}function yk(t){return new sh(t,1)}function Ao(t,e,r){this.k=t,this.x=e,this.y=r}Ao.prototype={constructor:Ao,scale:function(t){return t===1?this:new Ao(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Ao(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+")"}};Ao.prototype;var SR=v(t=>{var i;const{securityLevel:e}=te();let r=Ut("body");if(e==="sandbox"){const o=((i=Ut(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=Ut(o.body)}return r.select(`#${t}`)},"selectSvgElement");function Sp(t){return typeof t>"u"||t===null}v(Sp,"isNothing");function bk(t){return typeof t=="object"&&t!==null}v(bk,"isObject");function Ck(t){return Array.isArray(t)?t:Sp(t)?[]:[t]}v(Ck,"toArray");function kk(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(kk,"extend");function vk(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(vk,"repeat");function wk(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(wk,"isNegativeZero");var TR=Sp,_R=bk,ER=Ck,NR=vk,jR=wk,LR=kk,Fe={isNothing:TR,isObject:_R,toArray:ER,repeat:NR,isNegativeZero:jR,extend:LR};function Tp(t,e){var r="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(r+='in "'+t.mark.name+'" '),r+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(r+=`
463
-
464
- `+t.mark.snippet),n+" "+r):n}v(Tp,"formatError");function Ds(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=Tp(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}v(Ds,"YAMLException$1");Ds.prototype=Object.create(Error.prototype);Ds.prototype.constructor=Ds;Ds.prototype.toString=v(function(e){return this.name+": "+Tp(this,e)},"toString");var dr=Ds;function Bl(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(Bl,"getLine");function Al(t,e){return Fe.repeat(" ",e-t.length)+t}v(Al,"padStart");function Sk(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,c,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++)c=Bl(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Fe.repeat(" ",e.indent)+Al((t.line-l+1).toString(),u)+" | "+c.str+`
465
- `+a;for(c=Bl(t.buffer,n[o],i[o],t.position,d),a+=Fe.repeat(" ",e.indent)+Al((t.line+1).toString(),u)+" | "+c.str+`
466
- `,a+=Fe.repeat("-",e.indent+u+3+c.pos)+`^
467
- `,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=Bl(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Fe.repeat(" ",e.indent)+Al((t.line+l+1).toString(),u)+" | "+c.str+`
468
- `;return a.replace(/\n$/,"")}v(Sk,"makeSnippet");var BR=Sk,AR=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],MR=["scalar","sequence","mapping"];function Tk(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v(Tk,"compileStyleAliases");function _k(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(AR.indexOf(r)===-1)throw new dr('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=Tk(e.styleAliases||null),MR.indexOf(this.kind)===-1)throw new dr('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(_k,"Type$1");var Ve=_k;function _d(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(_d,"compileList");function Ek(){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(Ek,"compileMap");function pc(t){return this.extend(t)}v(pc,"Schema$1");pc.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Ve)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new dr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ve))throw new dr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new dr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new dr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof Ve))throw new dr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(pc.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=_d(i,"implicit"),i.compiledExplicit=_d(i,"explicit"),i.compiledTypeMap=Ek(i.compiledImplicit,i.compiledExplicit),i},"extend");var IR=pc,FR=new Ve("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),PR=new Ve("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),DR=new Ve("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),OR=new IR({explicit:[FR,PR,DR]});function Nk(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(Nk,"resolveYamlNull");function jk(){return null}v(jk,"constructYamlNull");function Lk(t){return t===null}v(Lk,"isNull");var $R=new Ve("tag:yaml.org,2002:null",{kind:"scalar",resolve:Nk,construct:jk,predicate:Lk,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 Bk(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(Bk,"resolveYamlBoolean");function Ak(t){return t==="true"||t==="True"||t==="TRUE"}v(Ak,"constructYamlBoolean");function Mk(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(Mk,"isBoolean");var RR=new Ve("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Bk,construct:Ak,predicate:Mk,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 Ik(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(Ik,"isHexCode");function Fk(t){return 48<=t&&t<=55}v(Fk,"isOctCode");function Pk(t){return 48<=t&&t<=57}v(Pk,"isDecCode");function Dk(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(!Ik(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!Fk(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!Pk(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(Dk,"resolveYamlInteger");function Ok(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(Ok,"constructYamlInteger");function $k(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Fe.isNegativeZero(t)}v($k,"isInteger");var zR=new Ve("tag:yaml.org,2002:int",{kind:"scalar",resolve:Dk,construct:Ok,predicate:$k,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"]}}),WR=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Rk(t){return!(t===null||!WR.test(t)||t[t.length-1]==="_")}v(Rk,"resolveYamlFloat");function zk(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(zk,"constructYamlFloat");var qR=/^[-+]?[0-9]+e/;function Wk(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),qR.test(r)?r.replace("e",".e"):r}v(Wk,"representYamlFloat");function qk(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Fe.isNegativeZero(t))}v(qk,"isFloat");var HR=new Ve("tag:yaml.org,2002:float",{kind:"scalar",resolve:Rk,construct:zk,predicate:qk,represent:Wk,defaultStyle:"lowercase"}),Hk=OR.extend({implicit:[$R,RR,zR,HR]}),UR=Hk,Uk=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Gk=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 Vk(t){return t===null?!1:Uk.exec(t)!==null||Gk.exec(t)!==null}v(Vk,"resolveYamlTimestamp");function Yk(t){var e,r,n,i,s,o,a,l=0,c=null,u,d,p;if(e=Uk.exec(t),e===null&&(e=Gk.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),c=(u*60+d)*6e4,e[9]==="-"&&(c=-c)),p=new Date(Date.UTC(r,n,i,s,o,a,l)),c&&p.setTime(p.getTime()-c),p}v(Yk,"constructYamlTimestamp");function Xk(t){return t.toISOString()}v(Xk,"representYamlTimestamp");var GR=new Ve("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Vk,construct:Yk,instanceOf:Date,represent:Xk});function Kk(t){return t==="<<"||t===null}v(Kk,"resolveYamlMerge");var VR=new Ve("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Kk}),_p=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
469
- \r`;function Zk(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=_p;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(Zk,"resolveYamlBinary");function Qk(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=_p,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(Qk,"constructYamlBinary");function Jk(t){var e="",r=0,n,i,s=t.length,o=_p;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(Jk,"representYamlBinary");function tv(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(tv,"isBinary");var YR=new Ve("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Zk,construct:Qk,predicate:tv,represent:Jk}),XR=Object.prototype.hasOwnProperty,KR=Object.prototype.toString;function ev(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,KR.call(i)!=="[object Object]")return!1;for(s in i)if(XR.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(ev,"resolveYamlOmap");function rv(t){return t!==null?t:[]}v(rv,"constructYamlOmap");var ZR=new Ve("tag:yaml.org,2002:omap",{kind:"sequence",resolve:ev,construct:rv}),QR=Object.prototype.toString;function nv(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],QR.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}v(nv,"resolveYamlPairs");function iv(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(iv,"constructYamlPairs");var JR=new Ve("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:nv,construct:iv}),t6=Object.prototype.hasOwnProperty;function sv(t){if(t===null)return!0;var e,r=t;for(e in r)if(t6.call(r,e)&&r[e]!==null)return!1;return!0}v(sv,"resolveYamlSet");function ov(t){return t!==null?t:{}}v(ov,"constructYamlSet");var e6=new Ve("tag:yaml.org,2002:set",{kind:"mapping",resolve:sv,construct:ov}),av=UR.extend({implicit:[GR,VR],explicit:[YR,ZR,JR,e6]}),Gn=Object.prototype.hasOwnProperty,mc=1,lv=2,cv=3,gc=4,xu=1,r6=2,wx=3,n6=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i6=/[\x85\u2028\u2029]/,s6=/[,\[\]\{\}]/,hv=/^(?:!|!!|![a-z\-]+!)$/i,uv=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ed(t){return Object.prototype.toString.call(t)}v(Ed,"_class");function Hr(t){return t===10||t===13}v(Hr,"is_EOL");function zn(t){return t===9||t===32}v(zn,"is_WHITE_SPACE");function Je(t){return t===9||t===32||t===10||t===13}v(Je,"is_WS_OR_EOL");function mi(t){return t===44||t===91||t===93||t===123||t===125}v(mi,"is_FLOW_INDICATOR");function dv(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(dv,"fromHexCode");function fv(t){return t===120?2:t===117?4:t===85?8:0}v(fv,"escapedHexLen");function pv(t){return 48<=t&&t<=57?t-48:-1}v(pv,"fromDecimalCode");function Nd(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
470
- `:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"…":t===95?" ":t===76?"\u2028":t===80?"\u2029":""}v(Nd,"simpleEscapeSequence");function mv(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v(mv,"charFromCodepoint");function Ep(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(Ep,"setProperty");var gv=new Array(256),xv=new Array(256);for(ai=0;ai<256;ai++)gv[ai]=Nd(ai)?1:0,xv[ai]=Nd(ai);var ai;function yv(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||av,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(yv,"State$1");function Np(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=BR(r),new dr(e,r)}v(Np,"generateError");function _t(t,e){throw Np(t,e)}v(_t,"throwError");function sa(t,e){t.onWarning&&t.onWarning.call(null,Np(t,e))}v(sa,"throwWarning");var Sx={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&_t(e,"duplication of %YAML directive"),n.length!==1&&_t(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&_t(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&_t(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&sa(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&_t(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],hv.test(i)||_t(e,"ill-formed tag handle (first argument) of the TAG directive"),Gn.call(e.tagMap,i)&&_t(e,'there is a previously declared suffix for "'+i+'" tag handle'),uv.test(s)||_t(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{_t(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s},"handleTagDirective")};function Cn(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||_t(t,"expected valid JSON character");else n6.test(a)&&_t(t,"the stream contains non-printable characters");t.result+=a}}v(Cn,"captureSegment");function jd(t,e,r,n){var i,s,o,a;for(Fe.isObject(r)||_t(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],Gn.call(e,s)||(Ep(e,s,r[s]),n[s]=!0)}v(jd,"mergeMappings");function gi(t,e,r,n,i,s,o,a,l){var c,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,u=i.length;c<u;c+=1)Array.isArray(i[c])&&_t(t,"nested arrays are not supported inside keys"),typeof i=="object"&&Ed(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&Ed(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,u=s.length;c<u;c+=1)jd(t,e,s[c],r);else jd(t,e,s,r);else!t.json&&!Gn.call(r,i)&&Gn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,_t(t,"duplicated mapping key")),Ep(e,i,s),delete r[i];return e}v(gi,"storeMappingPair");function oh(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++):_t(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v(oh,"readLineBreak");function Te(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;zn(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(Hr(i))for(oh(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&&sa(t,"deficient indentation"),n}v(Te,"skipSeparationSpace");function _a(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||Je(r)))}v(_a,"testDocumentSeparator");function ah(t,e){e===1?t.result+=" ":e>1&&(t.result+=Fe.repeat(`
471
- `,e-1))}v(ah,"writeFoldedLines");function bv(t,e,r){var n,i,s,o,a,l,c,u,d=t.kind,p=t.result,f;if(f=t.input.charCodeAt(t.position),Je(f)||mi(f)||f===35||f===38||f===42||f===33||f===124||f===62||f===39||f===34||f===37||f===64||f===96||(f===63||f===45)&&(i=t.input.charCodeAt(t.position+1),Je(i)||r&&mi(i)))return!1;for(t.kind="scalar",t.result="",s=o=t.position,a=!1;f!==0;){if(f===58){if(i=t.input.charCodeAt(t.position+1),Je(i)||r&&mi(i))break}else if(f===35){if(n=t.input.charCodeAt(t.position-1),Je(n))break}else{if(t.position===t.lineStart&&_a(t)||r&&mi(f))break;if(Hr(f))if(l=t.line,c=t.lineStart,u=t.lineIndent,Te(t,!1,-1),t.lineIndent>=e){a=!0,f=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=l,t.lineStart=c,t.lineIndent=u;break}}a&&(Cn(t,s,o,!1),ah(t,t.line-l),s=o=t.position,a=!1),zn(f)||(o=t.position+1),f=t.input.charCodeAt(++t.position)}return Cn(t,s,o,!1),t.result?!0:(t.kind=d,t.result=p,!1)}v(bv,"readPlainScalar");function Cv(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(Cn(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 Hr(r)?(Cn(t,n,i,!0),ah(t,Te(t,!1,e)),n=i=t.position):t.position===t.lineStart&&_a(t)?_t(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);_t(t,"unexpected end of the stream within a single quoted scalar")}v(Cv,"readSingleQuotedScalar");function kv(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 Cn(t,r,t.position,!0),t.position++,!0;if(a===92){if(Cn(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),Hr(a))Te(t,!1,e);else if(a<256&&gv[a])t.result+=xv[a],t.position++;else if((o=fv(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=dv(a))>=0?s=(s<<4)+o:_t(t,"expected hexadecimal character");t.result+=mv(s),t.position++}else _t(t,"unknown escape sequence");r=n=t.position}else Hr(a)?(Cn(t,r,n,!0),ah(t,Te(t,!1,e)),r=n=t.position):t.position===t.lineStart&&_a(t)?_t(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}_t(t,"unexpected end of the stream within a double quoted scalar")}v(kv,"readDoubleQuotedScalar");function vv(t,e){var r=!0,n,i,s,o=t.tag,a,l=t.anchor,c,u,d,p,f,m=Object.create(null),x,g,y,b;if(b=t.input.charCodeAt(t.position),b===91)u=93,f=!1,a=[];else if(b===123)u=125,f=!0,a={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=a),b=t.input.charCodeAt(++t.position);b!==0;){if(Te(t,!0,e),b=t.input.charCodeAt(t.position),b===u)return t.position++,t.tag=o,t.anchor=l,t.kind=f?"mapping":"sequence",t.result=a,!0;r?b===44&&_t(t,"expected the node content, but found ','"):_t(t,"missed comma between flow collection entries"),g=x=y=null,d=p=!1,b===63&&(c=t.input.charCodeAt(t.position+1),Je(c)&&(d=p=!0,t.position++,Te(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,Si(t,e,mc,!1,!0),g=t.tag,x=t.result,Te(t,!0,e),b=t.input.charCodeAt(t.position),(p||t.line===n)&&b===58&&(d=!0,b=t.input.charCodeAt(++t.position),Te(t,!0,e),Si(t,e,mc,!1,!0),y=t.result),f?gi(t,a,m,g,x,y,n,i,s):d?a.push(gi(t,null,m,g,x,y,n,i,s)):a.push(x),Te(t,!0,e),b=t.input.charCodeAt(t.position),b===44?(r=!0,b=t.input.charCodeAt(++t.position)):r=!1}_t(t,"unexpected end of the stream within a flow collection")}v(vv,"readFlowCollection");function wv(t,e){var r,n,i=xu,s=!1,o=!1,a=e,l=0,c=!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)xu===i?i=d===43?wx:r6:_t(t,"repeat of a chomping mode identifier");else if((u=pv(d))>=0)u===0?_t(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?_t(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(zn(d)){do d=t.input.charCodeAt(++t.position);while(zn(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!Hr(d)&&d!==0)}for(;d!==0;){for(oh(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),Hr(d)){l++;continue}if(t.lineIndent<a){i===wx?t.result+=Fe.repeat(`
472
- `,s?1+l:l):i===xu&&s&&(t.result+=`
473
- `);break}for(n?zn(d)?(c=!0,t.result+=Fe.repeat(`
474
- `,s?1+l:l)):c?(c=!1,t.result+=Fe.repeat(`
475
- `,l+1)):l===0?s&&(t.result+=" "):t.result+=Fe.repeat(`
476
- `,l):t.result+=Fe.repeat(`
477
- `,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!Hr(d)&&d!==0;)d=t.input.charCodeAt(++t.position);Cn(t,r,t.position,!1)}return!0}v(wv,"readBlockScalar");function Ld(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,_t(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!Je(o))));){if(a=!0,t.position++,Te(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,Si(t,e,cv,!1,!0),s.push(t.result),Te(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)_t(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(Ld,"readBlockSequence");function Sv(t,e,r){var n,i,s,o,a,l,c=t.tag,u=t.anchor,d={},p=Object.create(null),f=null,m=null,x=null,g=!1,y=!1,b;if(t.firstTabInLine!==-1)return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=d),b=t.input.charCodeAt(t.position);b!==0;){if(!g&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,_t(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(b===63||b===58)&&Je(n))b===63?(g&&(gi(t,d,p,f,m,null,o,a,l),f=m=x=null),y=!0,g=!0,i=!0):g?(g=!1,i=!0):_t(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,b=n;else{if(o=t.line,a=t.lineStart,l=t.position,!Si(t,r,lv,!1,!0))break;if(t.line===s){for(b=t.input.charCodeAt(t.position);zn(b);)b=t.input.charCodeAt(++t.position);if(b===58)b=t.input.charCodeAt(++t.position),Je(b)||_t(t,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(gi(t,d,p,f,m,null,o,a,l),f=m=x=null),y=!0,g=!1,i=!1,f=t.tag,m=t.result;else if(y)_t(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=c,t.anchor=u,!0}else if(y)_t(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=c,t.anchor=u,!0}if((t.line===s||t.lineIndent>e)&&(g&&(o=t.line,a=t.lineStart,l=t.position),Si(t,e,gc,!0,i)&&(g?m=t.result:x=t.result),g||(gi(t,d,p,f,m,x,o,a,l),f=m=x=null),Te(t,!0,-1),b=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&b!==0)_t(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return g&&gi(t,d,p,f,m,null,o,a,l),y&&(t.tag=c,t.anchor=u,t.kind="mapping",t.result=d),y}v(Sv,"readBlockMapping");function Tv(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&&_t(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)):_t(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!Je(o);)o===33&&(n?_t(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),hv.test(i)||_t(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),s6.test(s)&&_t(t,"tag suffix cannot contain flow indicator characters")}s&&!uv.test(s)&&_t(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{_t(t,"tag name is malformed: "+s)}return r?t.tag=s:Gn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:_t(t,'undeclared tag handle "'+i+'"'),!0}v(Tv,"readTagProperty");function _v(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&_t(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!Je(r)&&!mi(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&_t(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(_v,"readAnchorProperty");function Ev(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&&!Je(n)&&!mi(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&_t(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Gn.call(t.anchorMap,r)||_t(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],Te(t,!0,-1),!0}v(Ev,"readAlias");function Si(t,e,r,n,i){var s,o,a,l=1,c=!1,u=!1,d,p,f,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=gc===r||cv===r,n&&Te(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;Tv(t)||_v(t);)Te(t,!0,-1)?(c=!0,a=s,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||gc===r)&&(mc===r||lv===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&(Ld(t,g)||Sv(t,g,x))||vv(t,x)?u=!0:(o&&wv(t,x)||Cv(t,x)||kv(t,x)?u=!0:Ev(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&_t(t,"alias node should not have any properties")):bv(t,x,mc===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&Ld(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"&&_t(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,p=t.implicitTypes.length;d<p;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(Gn.call(t.typeMap[t.kind||"fallback"],t.tag))m=t.typeMap[t.kind||"fallback"][t.tag];else for(m=null,f=t.typeMap.multi[t.kind||"fallback"],d=0,p=f.length;d<p;d+=1)if(t.tag.slice(0,f[d].tag.length)===f[d].tag){m=f[d];break}m||_t(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&_t(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)):_t(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(Si,"composeNode");function Nv(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&&(Te(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&&!Je(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&_t(t,"directive name must not be less than one character in length");o!==0;){for(;zn(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!Hr(o));break}if(Hr(o))break;for(r=t.position;o!==0&&!Je(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&oh(t),Gn.call(Sx,n)?Sx[n](t,n,i):sa(t,'unknown document directive "'+n+'"')}if(Te(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,Te(t,!0,-1)):s&&_t(t,"directives end mark is expected"),Si(t,t.lineIndent-1,gc,!1,!0),Te(t,!0,-1),t.checkLineBreaks&&i6.test(t.input.slice(e,t.position))&&sa(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&_a(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,Te(t,!0,-1));return}if(t.position<t.length-1)_t(t,"end of the stream or a document separator is expected");else return}v(Nv,"readDocument");function jp(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
478
- `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new yv(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,_t(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;)Nv(r);return r.documents}v(jp,"loadDocuments");function o6(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=jp(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(o6,"loadAll$1");function jv(t,e){var r=jp(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new dr("expected a single document in the stream, but found more")}}v(jv,"load$1");var a6=jv,l6={load:a6},Lv=Object.prototype.toString,Bv=Object.prototype.hasOwnProperty,Lp=65279,c6=9,oa=10,h6=13,u6=32,d6=33,f6=34,Bd=35,p6=37,m6=38,g6=39,x6=42,Av=44,y6=45,xc=58,b6=61,C6=62,k6=63,v6=64,Mv=91,Iv=93,w6=96,Fv=123,S6=124,Pv=125,Xe={};Xe[0]="\\0";Xe[7]="\\a";Xe[8]="\\b";Xe[9]="\\t";Xe[10]="\\n";Xe[11]="\\v";Xe[12]="\\f";Xe[13]="\\r";Xe[27]="\\e";Xe[34]='\\"';Xe[92]="\\\\";Xe[133]="\\N";Xe[160]="\\_";Xe[8232]="\\L";Xe[8233]="\\P";var T6=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],_6=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Dv(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&&Bv.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}v(Dv,"compileStyleMap");function Ov(t){var e,r,n;if(e=t.toString(16).toUpperCase(),t<=255)r="x",n=2;else if(t<=65535)r="u",n=4;else if(t<=4294967295)r="U",n=8;else throw new dr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Fe.repeat("0",n-e.length)+e}v(Ov,"encodeHex");var E6=1,aa=2;function $v(t){this.schema=t.schema||av,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=Dv(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==='"'?aa:E6,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($v,"State");function Ad(t,e){for(var r=Fe.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
479
- `,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
480
- `&&(s+=r),s+=o;return s}v(Ad,"indentString");function yc(t,e){return`
481
- `+Fe.repeat(" ",t.indent*e)}v(yc,"generateNextLine");function Rv(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(Rv,"testImplicitResolving");function la(t){return t===u6||t===c6}v(la,"isWhitespace");function Os(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==Lp||65536<=t&&t<=1114111}v(Os,"isPrintable");function Md(t){return Os(t)&&t!==Lp&&t!==h6&&t!==oa}v(Md,"isNsCharOrWhitespace");function Id(t,e,r){var n=Md(t),i=n&&!la(t);return(r?n:n&&t!==Av&&t!==Mv&&t!==Iv&&t!==Fv&&t!==Pv)&&t!==Bd&&!(e===xc&&!i)||Md(e)&&!la(e)&&t===Bd||e===xc&&i}v(Id,"isPlainSafe");function zv(t){return Os(t)&&t!==Lp&&!la(t)&&t!==y6&&t!==k6&&t!==xc&&t!==Av&&t!==Mv&&t!==Iv&&t!==Fv&&t!==Pv&&t!==Bd&&t!==m6&&t!==x6&&t!==d6&&t!==S6&&t!==b6&&t!==C6&&t!==g6&&t!==f6&&t!==p6&&t!==v6&&t!==w6}v(zv,"isPlainSafeFirst");function Wv(t){return!la(t)&&t!==xc}v(Wv,"isPlainSafeLast");function ss(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(ss,"codePointAt");function Bp(t){var e=/^\n* /;return e.test(t)}v(Bp,"needIndentIndicator");var qv=1,Fd=2,Hv=3,Uv=4,rs=5;function Gv(t,e,r,n,i,s,o,a){var l,c=0,u=null,d=!1,p=!1,f=n!==-1,m=-1,x=zv(ss(t,0))&&Wv(ss(t,t.length-1));if(e||o)for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=ss(t,l),!Os(c))return rs;x=x&&Id(c,u,a),u=c}else{for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=ss(t,l),c===oa)d=!0,f&&(p=p||l-m-1>n&&t[m+1]!==" ",m=l);else if(!Os(c))return rs;x=x&&Id(c,u,a),u=c}p=p||f&&l-m-1>n&&t[m+1]!==" "}return!d&&!p?x&&!o&&!i(t)?qv:s===aa?rs:Fd:r>9&&Bp(t)?rs:o?s===aa?rs:Fd:p?Uv:Hv}v(Gv,"chooseScalarStyle");function Vv(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===aa?'""':"''";if(!t.noCompatMode&&(T6.indexOf(e)!==-1||_6.test(e)))return t.quotingType===aa?'"'+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(c){return Rv(t,c)}switch(v(l,"testAmbiguity"),Gv(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case qv:return e;case Fd:return"'"+e.replace(/'/g,"''")+"'";case Hv:return"|"+Pd(e,t.indent)+Dd(Ad(e,s));case Uv:return">"+Pd(e,t.indent)+Dd(Ad(Yv(e,o),s));case rs:return'"'+Xv(e)+'"';default:throw new dr("impossible error: invalid scalar style")}})()}v(Vv,"writeScalar");function Pd(t,e){var r=Bp(t)?String(e):"",n=t[t.length-1]===`
482
- `,i=n&&(t[t.length-2]===`
483
- `||t===`
484
- `),s=i?"+":n?"":"-";return r+s+`
485
- `}v(Pd,"blockHeader");function Dd(t){return t[t.length-1]===`
486
- `?t.slice(0,-1):t}v(Dd,"dropEndingNewline");function Yv(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var c=t.indexOf(`
487
- `);return c=c!==-1?c:t.length,r.lastIndex=c,Od(t.slice(0,c),e)})(),i=t[0]===`
488
- `||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
489
- `:"")+Od(l,e),i=s}return n}v(Yv,"foldString");function Od(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+=`
490
- `+t.slice(i,s),i=s+1),o=a;return l+=`
491
- `,t.length-i>e&&o>i?l+=t.slice(i,o)+`
492
- `+t.slice(o+1):l+=t.slice(i),l.slice(1)}v(Od,"foldLine");function Xv(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=ss(t,i),n=Xe[r],!n&&Os(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||Ov(r);return e}v(Xv,"escapeString");function Kv(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)),(on(t,e,a,!1,!1)||typeof a>"u"&&on(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}v(Kv,"writeFlowSequence");function $d(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)),(on(t,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&on(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=yc(t,e)),t.dump&&oa===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v($d,"writeBlockSequence");function Zv(t,e,r){var n="",i=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),on(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),on(t,e,c,!1,!1)&&(u+=t.dump,n+=u));t.tag=i,t.dump="{"+n+"}"}v(Zv,"writeFlowMapping");function Qv(t,e,r,n){var i="",s=t.tag,o=Object.keys(r),a,l,c,u,d,p;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new dr("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)p="",(!n||i!=="")&&(p+=yc(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),on(t,e+1,c,!0,!0,!0)&&(d=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,d&&(t.dump&&oa===t.dump.charCodeAt(0)?p+="?":p+="? "),p+=t.dump,d&&(p+=yc(t,e)),on(t,e+1,u,!0,d)&&(t.dump&&oa===t.dump.charCodeAt(0)?p+=":":p+=": ",p+=t.dump,i+=p));t.tag=s,t.dump=i||"{}"}v(Qv,"writeBlockMapping");function Rd(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,Lv.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(Bv.call(a.represent,l))n=a.represent[l](e,l);else throw new dr("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}v(Rd,"detectType");function on(t,e,r,n,i,s,o){t.tag=null,t.dump=r,Rd(t,r,!1)||Rd(t,r,!0);var a=Lv.call(t.dump),l=n,c;n&&(n=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",d,p;if(u&&(d=t.duplicates.indexOf(r),p=d!==-1),(t.tag!==null&&t.tag!=="?"||p||t.indent!==2&&e>0)&&(i=!1),p&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(u&&p&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),a==="[object Object]")n&&Object.keys(t.dump).length!==0?(Qv(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(Zv(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?$d(t,e-1,t.dump,i):$d(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(Kv(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Vv(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new dr("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}v(on,"writeNode");function Jv(t,e){var r=[],n=[],i,s;for(bc(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v(Jv,"getDuplicateReferences");function bc(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)bc(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)bc(t[n[i]],e,r)}v(bc,"inspectNode");function N6(t,e){e=e||{};var r=new $v(e);r.noRefs||Jv(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),on(r,0,n,!0,!0)?r.dump+`
493
- `:""}v(N6,"dump$1");function j6(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(j6,"renamed");var L6=Hk,B6=l6.load;/*! Bundled license information:
494
-
495
- js-yaml/dist/js-yaml.mjs:
496
- (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
497
- */var go=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"),He={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},Tx={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function Mo(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=ge(t),e=ge(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(Mo,"calculateDeltaAndAngle");var ge=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),A6=v(t=>({x:v(function(e,r,n){let i=0;const s=ge(n[0]).x<ge(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(He,t.arrowTypeStart)){const{angle:f,deltaX:m}=Mo(n[0],n[1]);i=He[t.arrowTypeStart]*Math.cos(f)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(He,t.arrowTypeEnd)){const{angle:f,deltaX:m}=Mo(n[n.length-1],n[n.length-2]);i=He[t.arrowTypeEnd]*Math.cos(f)*(m>=0?1:-1)}const o=Math.abs(ge(e).x-ge(n[n.length-1]).x),a=Math.abs(ge(e).y-ge(n[n.length-1]).y),l=Math.abs(ge(e).x-ge(n[0]).x),c=Math.abs(ge(e).y-ge(n[0]).y),u=He[t.arrowTypeStart],d=He[t.arrowTypeEnd],p=1;if(o<d&&o>0&&a<d){let f=d+p-o;f*=s==="right"?-1:1,i-=f}if(l<u&&l>0&&c<u){let f=u+p-l;f*=s==="right"?-1:1,i+=f}return ge(e).x+i},"x"),y:v(function(e,r,n){let i=0;const s=ge(n[0]).y<ge(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(He,t.arrowTypeStart)){const{angle:f,deltaY:m}=Mo(n[0],n[1]);i=He[t.arrowTypeStart]*Math.abs(Math.sin(f))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(He,t.arrowTypeEnd)){const{angle:f,deltaY:m}=Mo(n[n.length-1],n[n.length-2]);i=He[t.arrowTypeEnd]*Math.abs(Math.sin(f))*(m>=0?1:-1)}const o=Math.abs(ge(e).y-ge(n[n.length-1]).y),a=Math.abs(ge(e).x-ge(n[n.length-1]).x),l=Math.abs(ge(e).y-ge(n[0]).y),c=Math.abs(ge(e).x-ge(n[0]).x),u=He[t.arrowTypeStart],d=He[t.arrowTypeEnd],p=1;if(o<d&&o>0&&a<d){let f=d+p-o;f*=s==="up"?-1:1,i-=f}if(l<u&&l>0&&c<u){let f=u+p-l;f*=s==="up"?-1:1,i+=f}return ge(e).y+i},"y")}),"getLineFunctionsWithOffset"),nl={},Me={},_x;function M6(){return _x||(_x=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=/^.+(:|&colon;)/gim,Me.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,Me.relativeFirstCharacters=[".","/"],Me.BLANK_URL="about:blank"),Me}var Ex;function I6(){if(Ex)return nl;Ex=1,Object.defineProperty(nl,"__esModule",{value:!0}),nl.sanitizeUrl=s;var t=M6();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,c){return String.fromCharCode(c)})}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 c=l;if(!c)return t.BLANK_URL;if(e(c))return c;var u=c.trimStart(),d=u.match(t.urlSchemeRegex);if(!d)return c;var p=d[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(p))return t.BLANK_URL;var f=u.replace(/\\/g,"/");if(p==="mailto:"||p.includes("://"))return f;if(p==="http:"||p==="https:"){if(!n(f))return t.BLANK_URL;var m=new URL(f);return m.protocol=m.protocol.toLowerCase(),m.hostname=m.hostname.toLowerCase(),m.toString()}return f}return nl}var F6=I6(),tw=typeof global=="object"&&global&&global.Object===Object&&global,P6=typeof self=="object"&&self&&self.Object===Object&&self,fn=tw||P6||Function("return this")(),Cc=fn.Symbol,ew=Object.prototype,D6=ew.hasOwnProperty,O6=ew.toString,xo=Cc?Cc.toStringTag:void 0;function $6(t){var e=D6.call(t,xo),r=t[xo];try{t[xo]=void 0;var n=!0}catch{}var i=O6.call(t);return n&&(e?t[xo]=r:delete t[xo]),i}var R6=Object.prototype,z6=R6.toString;function W6(t){return z6.call(t)}var q6="[object Null]",H6="[object Undefined]",Nx=Cc?Cc.toStringTag:void 0;function Hs(t){return t==null?t===void 0?H6:q6:Nx&&Nx in Object(t)?$6(t):W6(t)}function Mi(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var U6="[object AsyncFunction]",G6="[object Function]",V6="[object GeneratorFunction]",Y6="[object Proxy]";function Ap(t){if(!Mi(t))return!1;var e=Hs(t);return e==G6||e==V6||e==U6||e==Y6}var yu=fn["__core-js_shared__"],jx=(function(){var t=/[^.]+$/.exec(yu&&yu.keys&&yu.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function X6(t){return!!jx&&jx in t}var K6=Function.prototype,Z6=K6.toString;function Ii(t){if(t!=null){try{return Z6.call(t)}catch{}try{return t+""}catch{}}return""}var Q6=/[\\^$.*+?()[\]{}|]/g,J6=/^\[object .+?Constructor\]$/,t8=Function.prototype,e8=Object.prototype,r8=t8.toString,n8=e8.hasOwnProperty,i8=RegExp("^"+r8.call(n8).replace(Q6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function s8(t){if(!Mi(t)||X6(t))return!1;var e=Ap(t)?i8:J6;return e.test(Ii(t))}function o8(t,e){return t==null?void 0:t[e]}function Fi(t,e){var r=o8(t,e);return s8(r)?r:void 0}var ca=Fi(Object,"create");function a8(){this.__data__=ca?ca(null):{},this.size=0}function l8(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var c8="__lodash_hash_undefined__",h8=Object.prototype,u8=h8.hasOwnProperty;function d8(t){var e=this.__data__;if(ca){var r=e[t];return r===c8?void 0:r}return u8.call(e,t)?e[t]:void 0}var f8=Object.prototype,p8=f8.hasOwnProperty;function m8(t){var e=this.__data__;return ca?e[t]!==void 0:p8.call(e,t)}var g8="__lodash_hash_undefined__";function x8(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ca&&e===void 0?g8:e,this}function Ti(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ti.prototype.clear=a8;Ti.prototype.delete=l8;Ti.prototype.get=d8;Ti.prototype.has=m8;Ti.prototype.set=x8;function y8(){this.__data__=[],this.size=0}function lh(t,e){return t===e||t!==t&&e!==e}function ch(t,e){for(var r=t.length;r--;)if(lh(t[r][0],e))return r;return-1}var b8=Array.prototype,C8=b8.splice;function k8(t){var e=this.__data__,r=ch(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():C8.call(e,r,1),--this.size,!0}function v8(t){var e=this.__data__,r=ch(e,t);return r<0?void 0:e[r][1]}function w8(t){return ch(this.__data__,t)>-1}function S8(t,e){var r=this.__data__,n=ch(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function _n(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_n.prototype.clear=y8;_n.prototype.delete=k8;_n.prototype.get=v8;_n.prototype.has=w8;_n.prototype.set=S8;var ha=Fi(fn,"Map");function T8(){this.size=0,this.__data__={hash:new Ti,map:new(ha||_n),string:new Ti}}function _8(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function hh(t,e){var r=t.__data__;return _8(e)?r[typeof e=="string"?"string":"hash"]:r.map}function E8(t){var e=hh(this,t).delete(t);return this.size-=e?1:0,e}function N8(t){return hh(this,t).get(t)}function j8(t){return hh(this,t).has(t)}function L8(t,e){var r=hh(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}function ti(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ti.prototype.clear=T8;ti.prototype.delete=E8;ti.prototype.get=N8;ti.prototype.has=j8;ti.prototype.set=L8;var B8="Expected a function";function Ea(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(B8);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Ea.Cache||ti),r}Ea.Cache=ti;function A8(){this.__data__=new _n,this.size=0}function M8(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function I8(t){return this.__data__.get(t)}function F8(t){return this.__data__.has(t)}var P8=200;function D8(t,e){var r=this.__data__;if(r instanceof _n){var n=r.__data__;if(!ha||n.length<P8-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new ti(n)}return r.set(t,e),this.size=r.size,this}function Us(t){var e=this.__data__=new _n(t);this.size=e.size}Us.prototype.clear=A8;Us.prototype.delete=M8;Us.prototype.get=I8;Us.prototype.has=F8;Us.prototype.set=D8;var kc=(function(){try{var t=Fi(Object,"defineProperty");return t({},"",{}),t}catch{}})();function Mp(t,e,r){e=="__proto__"&&kc?kc(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function zd(t,e,r){(r!==void 0&&!lh(t[e],r)||r===void 0&&!(e in t))&&Mp(t,e,r)}function O8(t){return function(e,r,n){for(var i=-1,s=Object(e),o=n(e),a=o.length;a--;){var l=o[++i];if(r(s[l],l,s)===!1)break}return e}}var $8=O8(),rw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Lx=rw&&typeof module=="object"&&module&&!module.nodeType&&module,R8=Lx&&Lx.exports===rw,Bx=R8?fn.Buffer:void 0,Ax=Bx?Bx.allocUnsafe:void 0;function z8(t,e){if(e)return t.slice();var r=t.length,n=Ax?Ax(r):new t.constructor(r);return t.copy(n),n}var Mx=fn.Uint8Array;function W8(t){var e=new t.constructor(t.byteLength);return new Mx(e).set(new Mx(t)),e}function q8(t,e){var r=e?W8(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function H8(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Ix=Object.create,U8=(function(){function t(){}return function(e){if(!Mi(e))return{};if(Ix)return Ix(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})();function nw(t,e){return function(r){return t(e(r))}}var iw=nw(Object.getPrototypeOf,Object),G8=Object.prototype;function uh(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||G8;return t===r}function V8(t){return typeof t.constructor=="function"&&!uh(t)?U8(iw(t)):{}}function Na(t){return t!=null&&typeof t=="object"}var Y8="[object Arguments]";function Fx(t){return Na(t)&&Hs(t)==Y8}var sw=Object.prototype,X8=sw.hasOwnProperty,K8=sw.propertyIsEnumerable,vc=Fx((function(){return arguments})())?Fx:function(t){return Na(t)&&X8.call(t,"callee")&&!K8.call(t,"callee")},wc=Array.isArray,Z8=9007199254740991;function ow(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Z8}function dh(t){return t!=null&&ow(t.length)&&!Ap(t)}function Q8(t){return Na(t)&&dh(t)}function J8(){return!1}var aw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Px=aw&&typeof module=="object"&&module&&!module.nodeType&&module,tz=Px&&Px.exports===aw,Dx=tz?fn.Buffer:void 0,ez=Dx?Dx.isBuffer:void 0,Ip=ez||J8,rz="[object Object]",nz=Function.prototype,iz=Object.prototype,lw=nz.toString,sz=iz.hasOwnProperty,oz=lw.call(Object);function az(t){if(!Na(t)||Hs(t)!=rz)return!1;var e=iw(t);if(e===null)return!0;var r=sz.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&lw.call(r)==oz}var lz="[object Arguments]",cz="[object Array]",hz="[object Boolean]",uz="[object Date]",dz="[object Error]",fz="[object Function]",pz="[object Map]",mz="[object Number]",gz="[object Object]",xz="[object RegExp]",yz="[object Set]",bz="[object String]",Cz="[object WeakMap]",kz="[object ArrayBuffer]",vz="[object DataView]",wz="[object Float32Array]",Sz="[object Float64Array]",Tz="[object Int8Array]",_z="[object Int16Array]",Ez="[object Int32Array]",Nz="[object Uint8Array]",jz="[object Uint8ClampedArray]",Lz="[object Uint16Array]",Bz="[object Uint32Array]",fe={};fe[wz]=fe[Sz]=fe[Tz]=fe[_z]=fe[Ez]=fe[Nz]=fe[jz]=fe[Lz]=fe[Bz]=!0;fe[lz]=fe[cz]=fe[kz]=fe[hz]=fe[vz]=fe[uz]=fe[dz]=fe[fz]=fe[pz]=fe[mz]=fe[gz]=fe[xz]=fe[yz]=fe[bz]=fe[Cz]=!1;function Az(t){return Na(t)&&ow(t.length)&&!!fe[Hs(t)]}function Mz(t){return function(e){return t(e)}}var cw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Go=cw&&typeof module=="object"&&module&&!module.nodeType&&module,Iz=Go&&Go.exports===cw,bu=Iz&&tw.process,Ox=(function(){try{var t=Go&&Go.require&&Go.require("util").types;return t||bu&&bu.binding&&bu.binding("util")}catch{}})(),$x=Ox&&Ox.isTypedArray,Fp=$x?Mz($x):Az;function Wd(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var Fz=Object.prototype,Pz=Fz.hasOwnProperty;function Dz(t,e,r){var n=t[e];(!(Pz.call(t,e)&&lh(n,r))||r===void 0&&!(e in t))&&Mp(t,e,r)}function Oz(t,e,r,n){var i=!r;r||(r={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=void 0;l===void 0&&(l=t[a]),i?Mp(r,a,l):Dz(r,a,l)}return r}function $z(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Rz=9007199254740991,zz=/^(?:0|[1-9]\d*)$/;function hw(t,e){var r=typeof t;return e=e??Rz,!!e&&(r=="number"||r!="symbol"&&zz.test(t))&&t>-1&&t%1==0&&t<e}var Wz=Object.prototype,qz=Wz.hasOwnProperty;function Hz(t,e){var r=wc(t),n=!r&&vc(t),i=!r&&!n&&Ip(t),s=!r&&!n&&!i&&Fp(t),o=r||n||i||s,a=o?$z(t.length,String):[],l=a.length;for(var c in t)(e||qz.call(t,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||hw(c,l)))&&a.push(c);return a}function Uz(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Gz=Object.prototype,Vz=Gz.hasOwnProperty;function Yz(t){if(!Mi(t))return Uz(t);var e=uh(t),r=[];for(var n in t)n=="constructor"&&(e||!Vz.call(t,n))||r.push(n);return r}function uw(t){return dh(t)?Hz(t,!0):Yz(t)}function Xz(t){return Oz(t,uw(t))}function Kz(t,e,r,n,i,s,o){var a=Wd(t,r),l=Wd(e,r),c=o.get(l);if(c){zd(t,r,c);return}var u=s?s(a,l,r+"",t,e,o):void 0,d=u===void 0;if(d){var p=wc(l),f=!p&&Ip(l),m=!p&&!f&&Fp(l);u=l,p||f||m?wc(a)?u=a:Q8(a)?u=H8(a):f?(d=!1,u=z8(l,!0)):m?(d=!1,u=q8(l,!0)):u=[]:az(l)||vc(l)?(u=a,vc(a)?u=Xz(a):(!Mi(a)||Ap(a))&&(u=V8(l))):d=!1}d&&(o.set(l,u),i(u,l,n,s,o),o.delete(l)),zd(t,r,u)}function dw(t,e,r,n,i){t!==e&&$8(e,function(s,o){if(i||(i=new Us),Mi(s))Kz(t,e,o,r,dw,n,i);else{var a=n?n(Wd(t,o),s,o+"",t,e,i):void 0;a===void 0&&(a=s),zd(t,o,a)}},uw)}function fw(t){return t}function Zz(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Rx=Math.max;function Qz(t,e,r){return e=Rx(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,s=Rx(n.length-e,0),o=Array(s);++i<s;)o[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(o),Zz(t,this,a)}}function Jz(t){return function(){return t}}var t9=kc?function(t,e){return kc(t,"toString",{configurable:!0,enumerable:!1,value:Jz(e),writable:!0})}:fw,e9=800,r9=16,n9=Date.now;function i9(t){var e=0,r=0;return function(){var n=n9(),i=r9-(n-r);if(r=n,i>0){if(++e>=e9)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var s9=i9(t9);function o9(t,e){return s9(Qz(t,e,fw),t+"")}function a9(t,e,r){if(!Mi(r))return!1;var n=typeof e;return(n=="number"?dh(r)&&hw(e,r.length):n=="string"&&e in r)?lh(r[e],t):!1}function l9(t){return o9(function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,o&&a9(r[0],r[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,s)}return e})}var c9=l9(function(t,e,r){dw(t,e,r)}),h9="​",u9={curveBasis:Td,curveBasisClosed:gR,curveBasisOpen:xR,curveBumpX:JC,curveBumpY:tk,curveBundle:yR,curveCardinalClosed:bR,curveCardinalOpen:CR,curveCardinal:ik,curveCatmullRomClosed:kR,curveCatmullRomOpen:vR,curveCatmullRom:ok,curveLinear:Uo,curveLinearClosed:wR,curveMonotoneX:dk,curveMonotoneY:fk,curveNatural:mk,curveStep:gk,curveStepAfter:yk,curveStepBefore:xk},d9=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,f9=v(function(t,e){const r=pw(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);tc(o),n=Ie(n,[...o])}else n=r.args;if(!n)return;let i=op(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),pw=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${d9.source})(?=[}][%]{2}).*
498
- `,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),rt.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=qo.exec(t))!==null;)if(s.index===qo.lastIndex&&qo.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 rt.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),p9=v(function(t){return t.replace(qo,"")},"removeDirectives"),m9=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function Pp(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return u9[r]??e}v(Pp,"interpolateToCurve");function mw(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?F6.sanitizeUrl(r):r}v(mw,"formatUrl");var g9=v((t,...e)=>{const r=t.split("."),n=r.length-1,i=r[n];let s=window;for(let o=0;o<n;o++)if(s=s[r[o]],!s){rt.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function Dp(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(Dp,"distance");function gw(t){let e,r=0;t.forEach(i=>{r+=Dp(i,e),e=i});const n=r/2;return Op(t,n)}v(gw,"traverseEdge");function xw(t){return t.length===1?t[0]:gw(t)}v(xw,"calcLabelPosition");var zx=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),Op=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=Dp(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:zx((1-o)*r.x+o*i.x,5),y:zx((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),x9=v((t,e,r)=>{rt.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=Op(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 yw(t,e,r){const n=structuredClone(r);rt.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=Op(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(yw,"calcTerminalLabelPosition");function bw(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(bw,"getStylesFromArray");var Wx=0,y9=v(()=>(Wx++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Wx),"generateId");function Cw(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(Cw,"makeRandomHex");var b9=v(t=>Cw(t.length),"random"),C9=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"),k9=v(function(t,e){const r=e.text.replace(wa.lineBreakRegex," "),[,n]=fh(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"),v9=Ea((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),wa.lineBreakRegex.test(t)))return t;const n=t.split(" ").filter(Boolean),i=[];let s="";return n.forEach((o,a)=>{const l=wn(`${o} `,r),c=wn(s,r);if(l>e){const{hyphenatedStrings:p,remainingWord:f}=w9(o,e,"-",r);i.push(s,...p),s=f}else c+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}`),w9=Ea((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 c=`${o}${a}`;if(wn(c,n)>=e){const d=l+1,p=i.length===d,f=`${c}${r}`;s.push(p?c:f),o=""}else o=c}),{hyphenatedStrings:s,remainingWord:o}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function kw(t,e){return $p(t,e).height}v(kw,"calculateTextHeight");function wn(t,e){return $p(t,e).width}v(wn,"calculateTextWidth");var $p=Ea((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=fh(r),o=["sans-serif",n],a=t.split(wa.lineBreakRegex),l=[],c=Ut("body");if(!c.remove)return{width:0,height:0,lineHeight:0};const u=c.append("svg");for(const p of o){let f=0;const m={width:0,height:0,lineHeight:0};for(const x of a){const g=C9();g.text=x||h9;const y=k9(u,g).style("font-size",s).style("font-weight",i).style("font-family",p),b=(y._groups||y)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");m.width=Math.round(Math.max(m.width,b.width)),f=Math.round(b.height),m.height+=f,m.lineHeight=Math.round(Math.max(m.lineHeight,f))}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}`),Es,S9=(Es=class{constructor(e=!1,r){this.count=0,this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}},v(Es,"InitIDGenerator"),Es),il,T9=v(function(t){return il=il||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),il.innerHTML=t,unescape(il.textContent)},"entityDecode");function Rp(t){return"str"in t}v(Rp,"isDetailedError");var _9=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"),fh=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 zp(t,e){return c9({},t,e)}v(zp,"cleanAndMerge");var Wr={assignWithDepth:Ie,wrapLabel:v9,calculateTextHeight:kw,calculateTextWidth:wn,calculateTextDimensions:$p,cleanAndMerge:zp,detectInit:f9,detectDirective:pw,isSubstringInArray:m9,interpolateToCurve:Pp,calcLabelPosition:xw,calcCardinalityPosition:x9,calcTerminalLabelPosition:yw,formatUrl:mw,getStylesFromArray:bw,generateId:y9,random:b9,runFunc:g9,entityDecode:T9,insertTitle:_9,isLabelCoordinateInPath:vw,parseFontSize:fh,InitIDGenerator:S9},E9=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"),_i=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),mtt=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function Pe(t){return t??null}v(Pe,"handleUndefinedAttr");function vw(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(vw,"isLabelCoordinateInPath");var Wp=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 ww(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=te().fontSize?te().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[c=dC.fontSize]=fh(a),u=c*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(ww,"configureLabelImages");var N9=v(t=>{const{handDrawnSeed:e}=te();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Gs=v(t=>{const e=j9([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),j9=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"),Sw=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}=Gs(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];Sw(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}=te(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Gs(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:L9(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),L9=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 B9=Object.freeze({left:0,top:0,width:16,height:16}),Sc=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Tw=Object.freeze({...B9,...Sc}),A9=Object.freeze({...Tw,body:"",hidden:!1}),M9=Object.freeze({width:null,height:null}),I9=Object.freeze({...M9,...Sc}),F9=(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(),c={provider:i.length>0?i[0]:n,prefix:l,name:a};return Cu(c)?c:null}const s=i[0],o=s.split("-");if(o.length>1){const a={provider:n,prefix:o.shift(),name:o.join("-")};return Cu(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return Cu(a,r)?a:null}return null},Cu=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function P9(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 qx(t,e){const r=P9(t,e);for(const n in A9)n in Sc?n in t&&!(n in r)&&(r[n]=Sc[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function D9(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 Hx(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=qx(n[a]||i[a],s)}return o(e),r.forEach(o),qx(t,s)}function O9(t,e){if(t.icons[e])return Hx(t,e,[]);const r=D9(t,[e])[e];return r?Hx(t,e,r):null}const $9=/(-?[0-9.]*[0-9]+[0-9.]*)/g,R9=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ux(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($9);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=R9.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 z9(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 W9(t,e){return t?"<defs>"+t+"</defs>"+e:e}function q9(t,e,r){const n=z9(t);return W9(n.defs,e+n.content+r)}const H9=t=>t==="unset"||t==="undefined"||t==="none";function U9(t,e){const r={...Tw,...t},n={...I9,...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,b=x.vFlip;let k=x.rotate;y?b?k+=2:(g.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),g.push("scale(-1 1)"),i.top=i.left=0):b&&(g.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),g.push("scale(1 -1)"),i.top=i.left=0);let S;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:S=i.height/2+i.top,g.unshift("rotate(90 "+S.toString()+" "+S.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:S=i.width/2+i.left,g.unshift("rotate(-90 "+S.toString()+" "+S.toString()+")");break}k%2===1&&(i.left!==i.top&&(S=i.left,i.left=i.top,i.top=S),i.width!==i.height&&(S=i.width,i.width=i.height,i.height=S)),g.length&&(s=q9(s,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=n.width,a=n.height,l=i.width,c=i.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?c:a,u=Ux(d,l/c)):(u=o==="auto"?l:o,d=a===null?Ux(u,c/l):a==="auto"?c:a);const p={},f=(x,g)=>{H9(g)||(p[x]=g.toString())};f("width",u),f("height",d);const m=[i.left,i.top,l,c];return p.viewBox=m.join(" "),{attributes:p,viewBox:m,body:s}}const G9=/\sid="(\S+)"/g,Gx=new Map;function V9(t){t=t.replace(/[0-9]+$/,"")||"a";const e=Gx.get(t)||0;return Gx.set(t,e+1),e?`${t}${e}`:t}function Y9(t){const e=[];let r;for(;r=G9.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=V9(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 X9(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 qp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pi=qp();function _w(t){Pi=t}var Vo={exec:()=>null};function ee(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(tr.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var K9=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),tr={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")},Z9=/^(?:[ \t]*(?:\n|$))+/,Q9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,J9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ja=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,t7=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hp=/(?:[*+-]|\d{1,9}[.)])/,Ew=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Nw=ee(Ew).replace(/bull/g,Hp).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(),e7=ee(Ew).replace(/bull/g,Hp).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(),Up=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,r7=/^[^\n]+/,Gp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,n7=ee(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Gp).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),i7=ee(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hp).getRegex(),ph="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",Vp=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,s7=ee("^ {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",Vp).replace("tag",ph).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jw=ee(Up).replace("hr",ja).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",ph).getRegex(),o7=ee(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jw).getRegex(),Yp={blockquote:o7,code:Q9,def:n7,fences:J9,heading:t7,hr:ja,html:s7,lheading:Nw,list:i7,newline:Z9,paragraph:jw,table:Vo,text:r7},Vx=ee("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ja).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",ph).getRegex(),a7={...Yp,lheading:e7,table:Vx,paragraph:ee(Up).replace("hr",ja).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vx).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",ph).getRegex()},l7={...Yp,html:ee(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Vp).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:Vo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ee(Up).replace("hr",ja).replace("heading",` *#{1,6} *[^
499
- ]`).replace("lheading",Nw).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},c7=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,h7=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Lw=/^( {2,}|\\)\n(?!\s*$)/,u7=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,mh=/[\p{P}\p{S}]/u,Xp=/[\s\p{P}\p{S}]/u,Bw=/[^\s\p{P}\p{S}]/u,d7=ee(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xp).getRegex(),Aw=/(?!~)[\p{P}\p{S}]/u,f7=/(?!~)[\s\p{P}\p{S}]/u,p7=/(?:[^\s\p{P}\p{S}]|~)/u,m7=ee(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",K9?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Mw=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,g7=ee(Mw,"u").replace(/punct/g,mh).getRegex(),x7=ee(Mw,"u").replace(/punct/g,Aw).getRegex(),Iw="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",y7=ee(Iw,"gu").replace(/notPunctSpace/g,Bw).replace(/punctSpace/g,Xp).replace(/punct/g,mh).getRegex(),b7=ee(Iw,"gu").replace(/notPunctSpace/g,p7).replace(/punctSpace/g,f7).replace(/punct/g,Aw).getRegex(),C7=ee("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Bw).replace(/punctSpace/g,Xp).replace(/punct/g,mh).getRegex(),k7=ee(/\\(punct)/,"gu").replace(/punct/g,mh).getRegex(),v7=ee(/^<(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(),w7=ee(Vp).replace("(?:-->|$)","-->").getRegex(),S7=ee("^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",w7).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Tc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,T7=ee(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Tc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fw=ee(/^!?\[(label)\]\[(ref)\]/).replace("label",Tc).replace("ref",Gp).getRegex(),Pw=ee(/^!?\[(ref)\](?:\[\])?/).replace("ref",Gp).getRegex(),_7=ee("reflink|nolink(?!\\()","g").replace("reflink",Fw).replace("nolink",Pw).getRegex(),Yx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Kp={_backpedal:Vo,anyPunctuation:k7,autolink:v7,blockSkip:m7,br:Lw,code:h7,del:Vo,emStrongLDelim:g7,emStrongRDelimAst:y7,emStrongRDelimUnd:C7,escape:c7,link:T7,nolink:Pw,punctuation:d7,reflink:Fw,reflinkSearch:_7,tag:S7,text:u7,url:Vo},E7={...Kp,link:ee(/^!?\[(label)\]\((.*?)\)/).replace("label",Tc).getRegex(),reflink:ee(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Tc).getRegex()},qd={...Kp,emStrongRDelimAst:b7,emStrongLDelim:x7,url:ee(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Yx).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:ee(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Yx).getRegex()},N7={...qd,br:ee(Lw).replace("{2,}","*").getRegex(),text:ee(qd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},sl={normal:Yp,gfm:a7,pedantic:l7},yo={normal:Kp,gfm:qd,breaks:N7,pedantic:E7},j7={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xx=t=>j7[t];function Qr(t,e){if(e){if(tr.escapeTest.test(t))return t.replace(tr.escapeReplace,Xx)}else if(tr.escapeTestNoEncode.test(t))return t.replace(tr.escapeReplaceNoEncode,Xx);return t}function Kx(t){try{t=encodeURI(t).replace(tr.percentDecode,"%")}catch{return null}return t}function Zx(t,e){var s;let r=t.replace(tr.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(tr.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(tr.slashPipe,"|");return n}function bo(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 L7(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 Qx(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 B7(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
500
- `).map(s=>{let o=s.match(r.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
501
- `)}var _c=class{constructor(e){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=e||Pi}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:bo(n,`
502
- `)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=B7(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=bo(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:bo(r[0],`
503
- `)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=bo(r[0],`
504
- `).split(`
505
- `),i="",s="",o=[];for(;n.length>0;){let a=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),a=!0;else if(!a)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
506
- `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
507
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
508
- ${u}`:u,s=s?`${s}
509
- ${d}`:d;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=p,n.length===0)break;let f=o.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let m=f,x=m.raw+`
510
- `+n.join(`
511
- `),g=this.blockquote(x);o[o.length-1]=g,i=i.substring(0,i.length-m.raw.length)+g.raw,s=s.substring(0,s.length-m.text.length)+g.text;break}else if((f==null?void 0:f.type)==="list"){let m=f,x=m.raw+`
512
- `+n.join(`
513
- `),g=this.list(x);o[o.length-1]=g,i=i.substring(0,i.length-f.raw.length)+g.raw,s=s.substring(0,s.length-m.raw.length)+g.raw,n=x.substring(o.at(-1).raw.length).split(`
514
- `);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){let r=this.rules.block.list.exec(e);if(r){let n=r[1].trim(),i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;e;){let c=!1,u="",d="";if(!(r=o.exec(e))||this.rules.block.hr.test(e))break;u=r[0],e=e.substring(u.length);let p=r[2].split(`
515
- `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),f=e.split(`
516
- `,1)[0],m=!p.trim(),x=0;if(this.options.pedantic?(x=2,d=p.trimStart()):m?x=r[1].length+1:(x=r[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=p.slice(x),x+=r[1].length),m&&this.rules.other.blankLine.test(f)&&(u+=f+`
517
- `,e=e.substring(f.length+1),c=!0),!c){let b=this.rules.other.nextBulletRegex(x),k=this.rules.other.hrRegex(x),S=this.rules.other.fencesBeginRegex(x),E=this.rules.other.headingBeginRegex(x),w=this.rules.other.htmlBeginRegex(x);for(;e;){let T=e.split(`
518
- `,1)[0],N;if(f=T,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),N=f):N=f.replace(this.rules.other.tabCharGlobal," "),S.test(f)||E.test(f)||w.test(f)||b.test(f)||k.test(f))break;if(N.search(this.rules.other.nonSpaceChar)>=x||!f.trim())d+=`
519
- `+N.slice(x);else{if(m||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(p)||E.test(p)||k.test(p))break;d+=`
520
- `+f}!m&&!f.trim()&&(m=!0),u+=T+`
521
- `,e=e.substring(T.length+1),p=N.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 c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){let u=s.items[c].tokens.filter(p=>p.type==="space"),d=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));s.loose=d}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].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=Zx(r[1]),i=r[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(a=r[3])!=null&&a.trim()?r[3].replace(this.rules.other.tableRowBlankLine,"").split(`
522
- `):[],o={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let 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(Zx(l,o.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:o.align[u]})));return o}}lheading(e){let r=this.rules.block.lheading.exec(e);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(e){let r=this.rules.block.paragraph.exec(e);if(r){let n=r[1].charAt(r[1].length-1)===`
523
- `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let r=this.rules.block.text.exec(e);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(e){let r=this.rules.inline.escape.exec(e);if(r)return{type:"escape",raw:r[0],text:r[1]}}tag(e){let r=this.rules.inline.tag.exec(e);if(r)return!this.lexer.state.inLink&&this.rules.other.startATag.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(e){let r=this.rules.inline.link.exec(e);if(r){let n=r[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=bo(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=L7(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)),Qx(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 Qx(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,c=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)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let d=[...i[0]][0].length,p=e.slice(0,s+i.index+d+a);if(Math.min(s,a)%2){let m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let f=p.slice(2,-2);return{type:"strong",raw:p,text:f,tokens:this.lexer.inlineTokens(f)}}}}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}}}},$r=class Hd{constructor(e){ne(this,"tokens");ne(this,"options");ne(this,"state");ne(this,"tokenizer");ne(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Pi,this.options.tokenizer=this.options.tokenizer||new _c,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:tr,block:sl.normal,inline:yo.normal};this.options.pedantic?(r.block=sl.pedantic,r.inline=yo.pedantic):this.options.gfm&&(r.block=sl.gfm,this.options.breaks?r.inline=yo.breaks:r.inline=yo.gfm),this.tokenizer.rules=r}static get rules(){return{block:sl,inline:yo}}static lex(e,r){return new Hd(r).lex(e)}static lexInline(e,r){return new Hd(r).inlineTokens(e)}lex(e){e=e.replace(tr.carriageReturn,`
524
- `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var i,s,o;for(this.options.pedantic&&(e=e.replace(tr.tabCharGlobal," ").replace(tr.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(c=>(a=c.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 c=r.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
525
- `:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
526
- `)?"":`
527
- `)+a.raw,c.text+=`
528
- `+a.text,this.inlineQueue.at(-1).src=c.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 c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
529
- `)?"":`
530
- `)+a.raw,c.text+=`
531
- `+a.raw,this.inlineQueue.at(-1).src=c.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 c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=r.at(-1);n&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
532
- `)?"":`
533
- `)+a.raw,c.text+=`
534
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.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 c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
535
- `)?"":`
536
- `)+a.raw,c.text+=`
537
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var l,c,u,d,p;let n=e,i=null;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)f.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=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},n))??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let f;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(x=>(f=x.call({lexer:this},e,r))?(e=e.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.escape(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.tag(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.link(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(f.raw.length);let x=r.at(-1);f.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=f.raw,x.text+=f.text):r.push(f);continue}if(f=this.tokenizer.emStrong(e,n,a)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.codespan(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.br(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.del(e)){e=e.substring(f.raw.length),r.push(f);continue}if(f=this.tokenizer.autolink(e)){e=e.substring(f.raw.length),r.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(e))){e=e.substring(f.raw.length),r.push(f);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let x=1/0,g=e.slice(1),y;this.options.extensions.startInline.forEach(b=>{y=b.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(f=this.tokenizer.inlineText(m)){e=e.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(a=f.raw.slice(-1)),o=!0;let x=r.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=f.raw,x.text+=f.text):r.push(f);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}},Ec=class{constructor(e){ne(this,"options");ne(this,"parser");this.options=e||Pi}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(tr.notSpaceStart))==null?void 0:o[0],s=e.replace(tr.endingNewline,"")+`
538
- `;return i?'<pre><code class="language-'+Qr(i)+'">'+(n?s:Qr(s,!0))+`</code></pre>
539
- `:"<pre><code>"+(n?s:Qr(s,!0))+`</code></pre>
540
- `}blockquote({tokens:e}){return`<blockquote>
541
- ${this.parser.parse(e)}</blockquote>
542
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
543
- `}hr(e){return`<hr>
544
- `}list(e){let r=e.ordered,n=e.start,i="";for(let a=0;a<e.items.length;a++){let l=e.items[a];i+=this.listitem(l)}let s=r?"ol":"ul",o=r&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
545
- `+i+"</"+s+`>
546
- `}listitem(e){var n;let r="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+Qr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):r+=i+" "}return r+=this.parser.parse(e.tokens,!!e.loose),`<li>${r}</li>
547
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
548
- `}table(e){let r="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);r+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let a=0;a<o.length;a++)n+=this.tablecell(o[a]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
549
- <thead>
550
- `+r+`</thead>
551
- `+i+`</table>
552
- `}tablerow({text:e}){return`<tr>
553
- ${e}</tr>
554
- `}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
555
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Qr(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=Kx(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return r&&(o+=' title="'+Qr(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=Kx(e);if(s===null)return Qr(n);e=s;let o=`<img src="${e}" alt="${n}"`;return r&&(o+=` title="${Qr(r)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Qr(e.text)}},Zp=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""}},Rr=class Ud{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Pi,this.options.renderer=this.options.renderer||new Ec,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zp}static parse(e,r){return new Ud(r).parse(e)}static parseInline(e,r){return new Ud(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 c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.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 c=l,u=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],u+=`
556
- `+this.renderer.text(c);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 c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}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 c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=c||"";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 c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},wl,Io=(wl=class{constructor(e){ne(this,"options");ne(this,"block");this.options=e||Pi}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?$r.lex:$r.lexInline}provideParser(){return this.block?Rr.parse:Rr.parseInline}},ne(wl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ne(wl,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),wl),A7=class{constructor(...e){ne(this,"defaults",qp());ne(this,"options",this.setOptions);ne(this,"parse",this.parseMarkdown(!0));ne(this,"parseInline",this.parseMarkdown(!1));ne(this,"Parser",Rr);ne(this,"Renderer",Ec);ne(this,"TextRenderer",Zp);ne(this,"Lexer",$r);ne(this,"Tokenizer",_c);ne(this,"Hooks",Io);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 c of l)n=n.concat(this.walkTokens(c.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 c=a[l].flat(1/0);n=n.concat(this.walkTokens(c,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 Ec(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],c=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new _c(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],c=s[a];s[a]=(...u)=>{let d=l.apply(s,u);return d===!1&&(d=c.apply(s,u)),d}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Io;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],c=s[a];Io.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&Io.passThroughHooksRespectAsync.has(o))return(async()=>{let p=await l.call(s,u);return c.call(s,p)})();let d=l.call(s,u);return c.call(s,d)}:s[a]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(s,u);return p===!1&&(p=await c.apply(s,u)),p})();let d=l.apply(s,u);return d===!1&&(d=c.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 $r.lex(e,r??this.defaults)}parser(e,r){return Rr.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?$r.lex:$r.lexInline)(a,s),c=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():e?Rr.parse:Rr.parseInline)(c,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?$r.lex:$r.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?Rr.parse:Rr.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+=`
557
- Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+Qr(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},Ei=new A7;function ie(t,e){return Ei.parse(t,e)}ie.options=ie.setOptions=function(t){return Ei.setOptions(t),ie.defaults=Ei.defaults,_w(ie.defaults),ie};ie.getDefaults=qp;ie.defaults=Pi;ie.use=function(...t){return Ei.use(...t),ie.defaults=Ei.defaults,_w(ie.defaults),ie};ie.walkTokens=function(t,e){return Ei.walkTokens(t,e)};ie.parseInline=Ei.parseInline;ie.Parser=Rr;ie.parser=Rr.parse;ie.Renderer=Ec;ie.TextRenderer=Zp;ie.Lexer=$r;ie.lexer=$r.lex;ie.Tokenizer=_c;ie.Hooks=Io;ie.parse=ie;ie.options;ie.setOptions;ie.use;ie.walkTokens;ie.parseInline;Rr.parse;$r.lex;function Dw(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 c=l.match(/\n([\t ]+|(?!\s).)/g);return c?a.concat(c.map(function(u){var d,p;return(p=(d=u.match(/[\t ]/g))===null||d===void 0?void 0:d.length)!==null&&p!==void 0?p:0})):a},[]);if(i.length){var s=new RegExp(`
558
- [ ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(a){return a.replace(s,`
559
- `)})}n[0]=n[0].replace(/^\r?\n/,"");var o=n[0];return e.forEach(function(a,l){var c=o.match(/(?:^|\n)( *)$/),u=c?c[1]:"",d=a;typeof a=="string"&&a.includes(`
560
- `)&&(d=String(a).split(`
561
- `).map(function(p,f){return f===0?p:""+u+p}).join(`
562
- `)),o+=d+n[l+1]}),o}var M7={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},Gd=new Map,Ow=new Map,I7=v(t=>{for(const e of t){if(!e.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(rt.debug("Registering icon pack:",e.name),"loader"in e)Ow.set(e.name,e.loader);else if("icons"in e)Gd.set(e.name,e.icons);else throw rt.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),$w=v(async(t,e)=>{const r=F9(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=Gd.get(n);if(!i){const o=Ow.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},Gd.set(n,i)}catch(a){throw rt.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=O9(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),F7=v(async t=>{try{return await $w(t),!0}catch{return!1}},"isIconAvailable"),La=v(async(t,e,r)=>{let n;try{n=await $w(t,e==null?void 0:e.fallbackPrefix)}catch(o){rt.error(o),n=M7}const i=U9(n,e),s=X9(Y9(i.body),{...i.attributes,...r});return Gr(s,be())},"getIconSVG");function Rw(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
563
- `).replace(/\n{2,}/g,`
564
- `);return Dw(n)}v(Rw,"preprocessMarkdown");function zw(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(zw,"nonMarkdownToLines");function Ww(t,e={}){const r=Rw(t,e),n=ie.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
565
- `).forEach((u,d)=>{d!==0&&(s++,i.push([])),u.split(" ").forEach(p=>{p=p.replace(/&#39;/g,"'"),p&&i[s].push({content:p,type:l})})}):a.type==="strong"||a.type==="em"?a.tokens.forEach(c=>{o(c,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(c=>{o(c)}):a.type==="html"?i[s].push({content:a.text,type:"normal"}):i[s].push({content:a.raw,type:"normal"})}),i}v(Ww,"markdownToLines");function qw(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(qw,"nonMarkdownToHTML");function Hw(t,{markdownAutoWrap:e}={}){const r=ie.lexer(t);function n(i){var s,o,a;return i.type==="text"?e===!1?i.text.replace(/\n */g,"<br/>").replace(/ /g,"&nbsp;"):i.text.replace(/\n */g,"<br/>"):i.type==="strong"?`<strong>${(s=i.tokens)==null?void 0:s.map(n).join("")}</strong>`:i.type==="em"?`<em>${(o=i.tokens)==null?void 0:o.map(n).join("")}</em>`:i.type==="paragraph"?`<p>${(a=i.tokens)==null?void 0:a.map(n).join("")}</p>`:i.type==="space"?"":i.type==="html"?`${i.text}`:i.type==="escape"?i.text:(rt.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(Hw,"markdownToHTML");function Uw(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(Uw,"splitTextToChars");function Gw(t,e){const r=Uw(e.content);return Qp(t,[],r,e.type)}v(Gw,"splitWordToFitWidth");function Qp(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}])?Qp(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v(Qp,"splitWordToFitWidthRecursion");function Vw(t,e){if(t.some(({content:r})=>r.includes(`
566
- `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return Nc(t,e)}v(Vw,"splitLineToFitWidth");function Nc(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 Nc(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=Gw(e,s);r.push([a]),l.content&&t.unshift(l)}return Nc(t,e,r)}v(Nc,"splitLineToFitWidthRecursion");function Vd(t,e){e&&t.attr("style",e)}v(Vd,"applyStyle");var Jx=16384;async function Yw(t,e,r,n,i=!1,s=be()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,Jx)}px`),o.attr("height",`${Math.min(10*r,Jx)}px`);const a=o.append("xhtml:div"),l=ta(e.label)?await kC(e.label.replace(wa.lineBreakRegex,`
567
- `),s):Gr(e.label,s),c=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),Vd(u,e.labelStyle),u.attr("class",`${c} ${n}`),Vd(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(Yw,"addHtmlSpan");function gh(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(gh,"createTspan");function Xw(t,e,r){const n=t.append("text"),i=gh(n,1,e);xh(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(Xw,"computeWidthOfText");function P7(t,e,r){var o;const n=t.append("text"),i=gh(n,1,e);xh(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(P7,"computeDimensionOfText");function Kw(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 c=0;for(const u of r){const d=v(f=>Xw(o,1.1,f)<=t,"checkWidth"),p=d(u)?[u]:Vw(u,d);for(const f of p){const m=gh(l,c,1.1,i);xh(m,f),c++}}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(Kw,"createFormattedText");function Yd(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(Yd,"decodeHTMLEntities");function xh(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(Yd(r.content)):i.text(" "+Yd(r.content))})}v(xh,"updateTextContentAndStyles");async function Zw(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await F7(a)?await La(a,void 0,{class:"label-icon"}):`<i class='${Gr(i,e).replace(":"," ")}'></i>`})()),i));const n=await Promise.all(r);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}v(Zw,"replaceIconSubstring");var En=v(async(t,e="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:s=!0,markdown:o=!0,isNode:a=!0,width:l=200,addSvgBackground:c=!1}={},u)=>{if(rt.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",c),s){const d=o?Hw(e,u):qw(e),p=await Zw(_i(d),u),f=e.replace(/\\\\/g,"\\"),m={isNode:a,label:ta(e)?f:p,labelStyle:r.replace("fill:","color:")};return await Yw(t,m,l,i,c,u)}else{const d=_i(e.replace(/<br\s*\/?>/g,"<br/>")),p=o?Ww(d.replace("<br>","<br/>"),u):zw(d),f=Kw(l,t,p,e?c:!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:");Ut(f).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Ut(f).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:");Ut(f).select("text").attr("style",x)}return n?Ut(f).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Ut(f).selectAll("tspan.text-outer-tspan").classed("row",!0),f}},"createText");function ku(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[c,u]=l;l[0]=(c-n)*o-(u-i)*a+n,l[1]=(c-n)*a+(u-i)*o+i}}}function D7(t,e){return t[0]===e[0]&&t[1]===e[1]}function O7(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 c of o)ku(c,a,i);const l=(function(c,u,d){const p=[];for(const b of c){const k=[...b];D7(k[0],k[k.length-1])||k.push([k[0][0],k[0][1]]),k.length>2&&p.push(k)}const f=[];u=Math.max(u,.1);const m=[];for(const b of p)for(let k=0;k<b.length-1;k++){const S=b[k],E=b[k+1];if(S[1]!==E[1]){const w=Math.min(S[1],E[1]);m.push({ymin:w,ymax:Math.max(S[1],E[1]),x:w===S[1]?S[0]:E[0],islope:(E[0]-S[0])/(E[1]-S[1])})}}if(m.sort(((b,k)=>b.ymin<k.ymin?-1:b.ymin>k.ymin?1:b.x<k.x?-1:b.x>k.x?1:b.ymax===k.ymax?0:(b.ymax-k.ymax)/Math.abs(b.ymax-k.ymax))),!m.length)return f;let x=[],g=m[0].ymin,y=0;for(;x.length||m.length;){if(m.length){let b=-1;for(let k=0;k<m.length&&!(m[k].ymin>g);k++)b=k;m.splice(0,b+1).forEach((k=>{x.push({s:g,edge:k})}))}if(x=x.filter((b=>!(b.edge.ymax<=g))),x.sort(((b,k)=>b.edge.x===k.edge.x?0:(b.edge.x-k.edge.x)/Math.abs(b.edge.x-k.edge.x))),(d!==1||y%u==0)&&x.length>1)for(let b=0;b<x.length;b+=2){const k=b+1;if(k>=x.length)break;const S=x[b].edge,E=x[k].edge;f.push([[Math.round(S.x),g],[Math.round(E.x),g]])}g+=d,x.forEach((b=>{b.edge.x=b.edge.x+d*b.edge.islope})),y++}return f})(o,s,n);if(i){for(const c of o)ku(c,a,-i);(function(c,u,d){const p=[];c.forEach((f=>p.push(...f))),ku(p,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),O7(t,i,n,s||1)}class Jp{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 yh(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 $7 extends Jp{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[c,u]of i)yh([c,u])&&o.push([[c[0]-a,c[1]+l],[...u]],[[c[0]+a,c[1]-l],[...u]]);return{type:"fillSketch",ops:this.renderLines(o,r)}}}class R7 extends Jp{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 z7{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=yh(a),c=l/i,u=Math.ceil(c)-1,d=l-u*i,p=(a[0][0]+a[1][0])/2-i/4,f=Math.min(a[0][1],a[1][1]);for(let m=0;m<u;m++){const x=f+d+m*i,g=p-o+2*Math.random()*o,y=x-o+2*Math.random()*o,b=this.helper.ellipse(g,y,s,s,r);n.push(...b.ops)}}return{type:"fillSketch",ops:n}}}class W7{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=yh(o),l=Math.floor(a/(n+i)),c=(a+i-l*(n+i))/2;let u=o[0],d=o[1];u[0]>d[0]&&(u=o[1],d=o[0]);const p=Math.atan((d[1]-u[1])/(d[0]-u[0]));for(let f=0;f<l;f++){const m=f*(n+i),x=m+n,g=[u[0]+m*Math.cos(p)+c*Math.cos(p),u[1]+m*Math.sin(p)+c*Math.sin(p)],y=[u[0]+x*Math.cos(p)+c*Math.cos(p),u[1]+x*Math.sin(p)+c*Math.sin(p)];s.push(...this.helper.doubleLineOps(g[0],g[1],y[0],y[1],r))}})),s}}class q7{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=yh(s),a=Math.round(o/(2*r));let l=s[0],c=s[1];l[0]>c[0]&&(l=s[1],c=s[0]);const u=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let d=0;d<a;d++){const p=2*d*r,f=2*(d+1)*r,m=Math.sqrt(2*Math.pow(r,2)),x=[l[0]+p*Math.cos(u),l[1]+p*Math.sin(u)],g=[l[0]+f*Math.cos(u),l[1]+f*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 lr={};class H7{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const U7=0,vu=1,t0=2,ol={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 wu(t,e){return t.type===e}function tm(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:U7,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:vu,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:t0,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!wu(s,t0);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return tm("M0,0"+t);i++,o=ol[s.text],n=s.text}else wu(s,vu)?o=ol[n]:(i++,o=ol[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 c=r[l];if(!wu(c,vu))throw new Error("Param not a number: "+n+","+c.text);a[a.length]=+c.text}if(typeof ol[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 Qw(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(((c,u)=>u%2?c+r:c+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(((c,u)=>u%2?c+r:c+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(((c,u)=>u%2?c+r:c+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 Jw(t){const e=[];let r="",n=0,i=0,s=0,o=0,a=0,l=0;for(const{key:c,data:u}of t){switch(c){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,p=0;r==="C"||r==="S"?(d=n+(n-a),p=i+(i-l)):(d=n,p=i),e.push({key:"C",data:[d,p,...u]}),a=u[0],l=u[1],n=u[2],i=u[3];break}case"T":{const[d,p]=u;let f=0,m=0;r==="Q"||r==="T"?(f=n+(n-a),m=i+(i-l)):(f=n,m=i);const x=n+2*(f-n)/3,g=i+2*(m-i)/3,y=d+2*(f-d)/3,b=p+2*(m-p)/3;e.push({key:"C",data:[x,g,y,b,d,p]}),a=f,l=m,n=d,i=p;break}case"Q":{const[d,p,f,m]=u,x=n+2*(d-n)/3,g=i+2*(p-i)/3,y=f+2*(d-f)/3,b=m+2*(p-m)/3;e.push({key:"C",data:[x,g,y,b,f,m]}),a=d,l=p,n=f,i=m;break}case"A":{const d=Math.abs(u[0]),p=Math.abs(u[1]),f=u[2],m=u[3],x=u[4],g=u[5],y=u[6];d===0||p===0?(e.push({key:"C",data:[n,i,g,y,g,y]}),n=g,i=y):(n!==g||i!==y)&&(t2(n,i,g,y,d,p,f,m,x).forEach((function(b){e.push({key:"C",data:b})})),n=g,i=y);break}case"Z":e.push({key:"Z",data:[]}),n=s,i=o}r=c}return e}function Co(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function t2(t,e,r,n,i,s,o,a,l,c){const u=(d=o,Math.PI*d/180);var d;let p=[],f=0,m=0,x=0,g=0;if(c)[f,m,x,g]=c;else{[t,e]=Co(t,e,-u),[r,n]=Co(r,n,-u);const G=(t-r)/2,O=(e-n)/2;let I=G*G/(i*i)+O*O/(s*s);I>1&&(I=Math.sqrt(I),i*=I,s*=I);const M=i*i,P=s*s,$=M*P-M*O*O-P*G*G,D=M*O*O+P*G*G,_=(a===l?-1:1)*Math.sqrt(Math.abs($/D));x=_*i*O/s+(t+r)/2,g=_*-s*G/i+(e+n)/2,f=Math.asin(parseFloat(((e-g)/s).toFixed(9))),m=Math.asin(parseFloat(((n-g)/s).toFixed(9))),t<x&&(f=Math.PI-f),r<x&&(m=Math.PI-m),f<0&&(f=2*Math.PI+f),m<0&&(m=2*Math.PI+m),l&&f>m&&(f-=2*Math.PI),!l&&m>f&&(m-=2*Math.PI)}let y=m-f;if(Math.abs(y)>120*Math.PI/180){const G=m,O=r,I=n;m=l&&m>f?f+120*Math.PI/180*1:f+120*Math.PI/180*-1,p=t2(r=x+i*Math.cos(m),n=g+s*Math.sin(m),O,I,i,s,o,0,l,[m,G,x,g])}y=m-f;const b=Math.cos(f),k=Math.sin(f),S=Math.cos(m),E=Math.sin(m),w=Math.tan(y/4),T=4/3*i*w,N=4/3*s*w,F=[t,e],L=[t+T*k,e-N*b],B=[r+T*E,n-N*S],W=[r,n];if(L[0]=2*F[0]-L[0],L[1]=2*F[1]-L[1],c)return[L,B,W].concat(p);{p=[L,B,W].concat(p);const G=[];for(let O=0;O<p.length;O+=3){const I=Co(p[O][0],p[O][1],u),M=Co(p[O+1][0],p[O+1][1],u),P=Co(p[O+2][0],p[O+2][1],u);G.push([I[0],I[1],M[0],M[1],P[0],P[1]])}return G}}const G7={randOffset:function(t,e){return Ft(t,e)},randOffsetWithRange:function(t,e,r){return jc(t,e,r)},ellipse:function(t,e,r,n,i){const s=r2(r,n,i);return Xd(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Vn(t,e,r,n,i,!0)}};function e2(t,e,r,n,i){return{type:"path",ops:Vn(t,e,r,n,i)}}function Ml(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Vn(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Vn(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?e2(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function V7(t,e,r,n,i){return(function(s,o){return Ml(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function e0(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=al(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:al(r[0],1.5*(1+.22*e.roughness),i0(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=al(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:al(o,1.5*(1+.22*e.roughness),i0(e));for(const c of a)c.op!=="move"&&n.push(c);for(const c of l)c.op!=="move"&&i.push(c)}}return{type:"path",ops:n.concat(i)}}return{type:"path",ops:[]}}function r2(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+=Ft(o*l,r),a+=Ft(a*l,r),{increment:s,rx:o,ry:a}}function Xd(t,e,r,n){const[i,s]=s0(n.increment,t,e,n.rx,n.ry,1,n.increment*jc(.1,jc(.4,1,r),r),r);let o=Lc(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=s0(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=Lc(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function r0(t,e,r,n,i,s,o,a,l){const c=t,u=e;let d=Math.abs(r/2),p=Math.abs(n/2);d+=Ft(.01*d,l),p+=Ft(.01*p,l);let f=i,m=s;for(;f<0;)f+=2*Math.PI,m+=2*Math.PI;m-f>2*Math.PI&&(f=0,m=2*Math.PI);const x=2*Math.PI/l.curveStepCount,g=Math.min(x/2,(m-f)/2),y=o0(g,c,u,d,p,f,m,1,l);if(!l.disableMultiStroke){const b=o0(g,c,u,d,p,f,m,1.5,l);y.push(...b)}return o&&(a?y.push(...Vn(c,u,c+d*Math.cos(f),u+p*Math.sin(f),l),...Vn(c,u,c+d*Math.cos(m),u+p*Math.sin(m),l)):y.push({op:"lineTo",data:[c,u]},{op:"lineTo",data:[c+d*Math.cos(f),u+p*Math.sin(f)]})),{type:"path",ops:y}}function n0(t,e){const r=Jw(Qw(tm(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(...Vn(s[0],s[1],a[0],a[1],e)),s=[a[0],a[1]];break;case"C":{const[l,c,u,d,p,f]=a;n.push(...Y7(l,c,u,d,p,f,s,e)),s=[p,f];break}case"Z":n.push(...Vn(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function Su(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]+Ft(i,e),n[0][1]+Ft(i,e)]});for(let o=1;o<s;o++)r.push({op:"lineTo",data:[n[o][0]+Ft(i,e),n[o][1]+Ft(i,e)]})}}return{type:"fillPath",ops:r}}function Hi(t,e){return(function(r,n){let i=r.fillStyle||"hachure";if(!lr[i])switch(i){case"zigzag":lr[i]||(lr[i]=new $7(n));break;case"cross-hatch":lr[i]||(lr[i]=new R7(n));break;case"dots":lr[i]||(lr[i]=new z7(n));break;case"dashed":lr[i]||(lr[i]=new W7(n));break;case"zigzag-line":lr[i]||(lr[i]=new q7(n));break;default:i="hachure",lr[i]||(lr[i]=new Jp(n))}return lr[i]})(e,G7).fillPolygons(t,e)}function i0(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function n2(t){return t.randomizer||(t.randomizer=new H7(t.seed||0)),t.randomizer.next()}function jc(t,e,r,n=1){return r.roughness*n*(n2(r)*(e-t)+t)}function Ft(t,e,r=1){return jc(-t,t,e,r)}function Vn(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=Kd(t,e,r,n,i,!0,!1);if(o)return a;const l=Kd(t,e,r,n,i,!0,!0);return a.concat(l)}function Kd(t,e,r,n,i,s,o){const a=Math.pow(t-r,2)+Math.pow(e-n,2),l=Math.sqrt(a);let c=1;c=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,p=.2+.2*n2(i);let f=i.bowing*i.maxRandomnessOffset*(n-e)/200,m=i.bowing*i.maxRandomnessOffset*(t-r)/200;f=Ft(f,i,c),m=Ft(m,i,c);const x=[],g=()=>Ft(d,i,c),y=()=>Ft(u,i,c),b=i.preserveVertices;return o?x.push({op:"move",data:[t+(b?0:g()),e+(b?0:g())]}):x.push({op:"move",data:[t+(b?0:Ft(u,i,c)),e+(b?0:Ft(u,i,c))]}),o?x.push({op:"bcurveTo",data:[f+t+(r-t)*p+g(),m+e+(n-e)*p+g(),f+t+2*(r-t)*p+g(),m+e+2*(n-e)*p+g(),r+(b?0:g()),n+(b?0:g())]}):x.push({op:"bcurveTo",data:[f+t+(r-t)*p+y(),m+e+(n-e)*p+y(),f+t+2*(r-t)*p+y(),m+e+2*(n-e)*p+y(),r+(b?0:y()),n+(b?0:y())]}),x}function al(t,e,r){if(!t.length)return[];const n=[];n.push([t[0][0]+Ft(e,r),t[0][1]+Ft(e,r)]),n.push([t[0][0]+Ft(e,r),t[0][1]+Ft(e,r)]);for(let i=1;i<t.length;i++)n.push([t[i][0]+Ft(e,r),t[i][1]+Ft(e,r)]),i===t.length-1&&n.push([t[i][0]+Ft(e,r),t[i][1]+Ft(e,r)]);return Lc(n,null,r)}function Lc(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(...Kd(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function s0(t,e,r,n,i,s,o,a){const l=[],c=[];if(a.roughness===0){t/=4,c.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),c.push(d)}c.push([e+n*Math.cos(0),r+i*Math.sin(0)]),c.push([e+n*Math.cos(t),r+i*Math.sin(t)])}else{const u=Ft(.5,a)-Math.PI/2;c.push([Ft(s,a)+e+.9*n*Math.cos(u-t),Ft(s,a)+r+.9*i*Math.sin(u-t)]);const d=2*Math.PI+u-.01;for(let p=u;p<d;p+=t){const f=[Ft(s,a)+e+n*Math.cos(p),Ft(s,a)+r+i*Math.sin(p)];l.push(f),c.push(f)}c.push([Ft(s,a)+e+n*Math.cos(u+2*Math.PI+.5*o),Ft(s,a)+r+i*Math.sin(u+2*Math.PI+.5*o)]),c.push([Ft(s,a)+e+.98*n*Math.cos(u+o),Ft(s,a)+r+.98*i*Math.sin(u+o)]),c.push([Ft(s,a)+e+.9*n*Math.cos(u+.5*o),Ft(s,a)+r+.9*i*Math.sin(u+.5*o)])}return[c,l]}function o0(t,e,r,n,i,s,o,a,l){const c=s+Ft(.1,l),u=[];u.push([Ft(a,l)+e+.9*n*Math.cos(c-t),Ft(a,l)+r+.9*i*Math.sin(c-t)]);for(let d=c;d<=o;d+=t)u.push([Ft(a,l)+e+n*Math.cos(d),Ft(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)]),Lc(u,null,l)}function Y7(t,e,r,n,i,s,o,a){const l=[],c=[a.maxRandomnessOffset||1,(a.maxRandomnessOffset||1)+.3];let u=[0,0];const d=a.disableMultiStroke?1:2,p=a.preserveVertices;for(let f=0;f<d;f++)f===0?l.push({op:"move",data:[o[0],o[1]]}):l.push({op:"move",data:[o[0]+(p?0:Ft(c[0],a)),o[1]+(p?0:Ft(c[0],a))]}),u=p?[i,s]:[i+Ft(c[f],a),s+Ft(c[f],a)],l.push({op:"bcurveTo",data:[t+Ft(c[f],a),e+Ft(c[f],a),r+Ft(c[f],a),n+Ft(c[f],a),u[0],u[1]]});return l}function ko(t){return[...t]}function a0(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(ko(t[0]),ko(t[1]),ko(t[2]),ko(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(ko(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 Il(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function X7(t,e,r){const n=Il(e,r);if(n===0)return Il(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)),Il(t,hi(e,r,i))}function hi(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function Zd(t,e,r,n){const i=n||[];if((function(a,l){const c=a[l+0],u=a[l+1],d=a[l+2],p=a[l+3];let f=3*u[0]-2*c[0]-p[0];f*=f;let m=3*u[1]-2*c[1]-p[1];m*=m;let x=3*d[0]-2*p[0]-c[0];x*=x;let g=3*d[1]-2*p[1]-c[1];return g*=g,f<x&&(f=x),m<g&&(m=g),f+m})(t,e)<r){const a=t[e+0];i.length?(s=i[i.length-1],o=a,Math.sqrt(Il(s,o))>1&&i.push(a)):i.push(a),i.push(t[e+3])}else{const l=t[e+0],c=t[e+1],u=t[e+2],d=t[e+3],p=hi(l,c,.5),f=hi(c,u,.5),m=hi(u,d,.5),x=hi(p,f,.5),g=hi(f,m,.5),y=hi(x,g,.5);Zd([l,p,x,y],0,r,i),Zd([y,g,m,d],0,r,i)}var s,o;return i}function K7(t,e){return Bc(t,0,t.length,e)}function Bc(t,e,r,n,i){const s=i||[],o=t[e],a=t[r-1];let l=0,c=1;for(let u=e+1;u<r-1;++u){const d=X7(t[u],o,a);d>l&&(l=d,c=u)}return Math.sqrt(l)>n?(Bc(t,e,c+1,n,s),Bc(t,c,r,n,s)):(s.length||s.push(o),s.push(a)),s}function Tu(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)Zd(t,3*s,e,n);return r&&r>0?Bc(n,0,n.length,r):n}const wr="none";class Ac{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",[e2(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=V7(e,r,n,i,o);if(o.fill){const c=[[e,r],[e+n,r],[e+n,r+i],[e,r+i]];o.fillStyle==="solid"?a.push(Su([c],o)):a.push(Hi([c],o))}return o.stroke!==wr&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=r2(n,i,o),c=Xd(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=Xd(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push(Hi([c.estimatedPoints],o));return o.stroke!==wr&&a.push(c.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",[Ml(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,l){const c=this._o(l),u=[],d=r0(e,r,n,i,s,o,a,!0,c);if(a&&c.fill)if(c.fillStyle==="solid"){const p=Object.assign({},c);p.disableMultiStroke=!0;const f=r0(e,r,n,i,s,o,!0,!1,p);f.type="fillPath",u.push(f)}else u.push((function(p,f,m,x,g,y,b){const k=p,S=f;let E=Math.abs(m/2),w=Math.abs(x/2);E+=Ft(.01*E,b),w+=Ft(.01*w,b);let T=g,N=y;for(;T<0;)T+=2*Math.PI,N+=2*Math.PI;N-T>2*Math.PI&&(T=0,N=2*Math.PI);const F=(N-T)/b.curveStepCount,L=[];for(let B=T;B<=N;B+=F)L.push([k+E*Math.cos(B),S+w*Math.sin(B)]);return L.push([k+E*Math.cos(N),S+w*Math.sin(N)]),L.push([k,S]),Hi([L],b)})(e,r,n,i,s,o,c));return c.stroke!==wr&&u.push(d),this._d("arc",u,c)}curve(e,r){const n=this._o(r),i=[],s=e0(e,n);if(n.fill&&n.fill!==wr)if(n.fillStyle==="solid"){const o=e0(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 c of l)c.length<3?o.push(...c):c.length===3?o.push(...Tu(a0([c[0],c[0],c[1],c[2]]),10,(1+n.roughness)/2)):o.push(...Tu(a0(c),10,(1+n.roughness)/2))}o.length&&i.push(Hi([o],n))}return n.stroke!==wr&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=Ml(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(Su([e],n)):i.push(Hi([e],n))),n.stroke!==wr&&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!==wr,o=n.stroke!==wr,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,p){const f=Jw(Qw(tm(u))),m=[];let x=[],g=[0,0],y=[];const b=()=>{y.length>=4&&x.push(...Tu(y,d)),y=[]},k=()=>{b(),x.length&&(m.push(x),x=[])};for(const{key:E,data:w}of f)switch(E){case"M":k(),g=[w[0],w[1]],x.push(g);break;case"L":b(),x.push([w[0],w[1]]);break;case"C":if(!y.length){const T=x.length?x[x.length-1]:g;y.push([T[0],T[1]])}y.push([w[0],w[1]]),y.push([w[2],w[3]]),y.push([w[4],w[5]]);break;case"Z":b(),x.push([g[0],g[1]])}if(k(),!p)return m;const S=[];for(const E of m){const w=K7(E,p);w.length&&S.push(w)}return S})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),c=n0(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=n0(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(Su(l,n));else i.push(Hi(l,n));return o&&(a?l.forEach((u=>{i.push(Ml(u,!1,n))})):i.push(c)),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:wr};break;case"fillPath":o={d:this.opsToPath(s),stroke:wr,strokeWidth:0,fill:n.fill||wr};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||wr,strokeWidth:n,fill:wr}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class Z7{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new Ac(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 c=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(c),c}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 ll="http://www.w3.org/2000/svg";class Q7{constructor(e,r){this.svg=e,this.gen=new Ac(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(ll,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(ll,"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(ll,"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(ll,"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 c=this.gen.arc(e,r,n,i,s,o,a,l);return this.draw(c)}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 xt={canvas:(t,e)=>new Z7(t,e),svg:(t,e)=>new Q7(t,e),generator:t=>new Ac(t),newSeed:()=>Ac.newSeed()},It=v(async(t,e,r)=>{var f,m;let n;const i=e.useHtmlLabels||Tn((f=te())==null?void 0:f.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",Pe(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,c=e.labelType==="markdown",u=await En(o,Gr(_i(a),te()),{useHtmlLabels:i,width:e.width||((m=te().flowchart)==null?void 0:m.wrappingWidth),classes:c?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:c},te());let d=u.getBBox();const p=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=Ut(u);await ww(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:p,label:o}},"labelHelper"),_u=v(async(t,e,r)=>{var l,c;const n=r.useHtmlLabels??ir(te()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await En(i,Gr(_i(e),te()),{useHtmlLabels:n,width:r.width||((c=(l=te())==null?void 0:l.flowchart)==null?void 0:c.wrappingWidth),style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img});let o=s.getBBox();const a=r.padding/2;if(ir(te())){const u=s.children[0],d=Ut(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"),At=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Zt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Zt,"createPathFromPoints");function Yn(t,e,r,n,i,s){const o=[],l=r-t,c=n-e,u=l/s,d=2*Math.PI/u,p=e+c/2;for(let f=0;f<=50;f++){const m=f/50,x=t+m*l,g=p+i*Math.sin(d*(x-t));o.push({x,y:g})}return o}v(Yn,"generateFullSineWavePoints");function ua(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 p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(ua,"generateCirclePoints");function Qd(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,c)=>(l==null?void 0:l.getAttribute(c))??void 0,"getAttr");if(i){const l={fill:o(i,"fill"),"fill-opacity":o(i,"fill-opacity")??"1"};Object.entries(l).forEach(([c,u])=>{u&&r.setAttribute(c,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(([c,u])=>{u&&r.setAttribute(c,u)})}const a=document.createElementNS("http://www.w3.org/2000/svg","g");return a.appendChild(r),a}v(Qd,"mergePaths");var J7=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,c;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),l=s===0?0:a*i/s,c=a):(i<0&&(o=-o),l=o,c=i===0?0:o*s/i),{x:r+l,y:n+c}},"intersectRect"),Vs=J7,tW=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=te(),a=ir(o);return await En(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),On=tW,ei=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"),i2=v(async(t,e)=>{rt.info("Creating subgraph rect for ",e.id,e);const r=te(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=Ct(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=ir(r),f=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await En(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width}):m=await On(f,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(ir(r)){const T=m.children[0],N=Ut(m);x=T.getBoundingClientRect(),N.attr("width",x.width),N.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,b=e.x-g/2,k=e.y-y/2;rt.trace("Data ",e,JSON.stringify(e));let S;if(e.look==="handDrawn"){const T=xt.svg(d),N=bt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),F=T.path(ei(b,k,g,y,0),N);S=d.insert(()=>(rt.debug("Rough node insert CXC",F),F),":first-child"),S.select("path:nth-child(2)").attr("style",c.join(";")),S.select("path").attr("style",u.join(";").replace("fill","stroke"))}else S=d.insert("rect",":first-child"),S.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",k).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:E}=Wp(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+E})`),a){const T=f.select("span");T&&T.attr("style",a)}const w=S.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(T){return Vs(e,T)},{cluster:d,labelBBox:x}},"rect"),eW=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 Vs(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),rW=v(async(t,e)=>{const r=te(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:s,compositeBackground:o,compositeTitleBackground:a,nodeBorder:l}=n,c=t.insert("g").attr("class",e.cssClasses).attr("id",e.domId).attr("data-id",e.id).attr("data-look",e.look),u=c.insert("g",":first-child"),d=c.insert("g").attr("class","cluster-label");let p=c.append("rect");const f=await On(d,e.label,e.labelStyle,void 0,!0);let m=f.getBBox();if(ir(r)){const F=f.children[0],L=Ut(f);m=F.getBoundingClientRect(),L.attr("width",m.width),L.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 b=e.height+x,k=e.height+x-m.height-6,S=e.x-y/2,E=e.y-b/2;e.width=y;const w=e.y-e.height/2-g+m.height+2;let T;if(e.look==="handDrawn"){const F=e.cssClasses.includes("statediagram-cluster-alt"),L=xt.svg(c),B=e.rx||e.ry?L.path(ei(S,E,y,b,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):L.rectangle(S,E,y,b,{seed:i});T=c.insert(()=>B,":first-child");const W=L.rectangle(S,w,y,k,{fill:F?s:o,fillStyle:F?"hachure":"solid",stroke:l,seed:i});T=c.insert(()=>B,":first-child"),p=c.insert(()=>W)}else T=u.insert("rect",":first-child"),T.attr("class","outer").attr("x",S).attr("y",E).attr("width",y).attr("height",b).attr("data-look",e.look),p.attr("class","inner").attr("x",S).attr("y",w).attr("width",y).attr("height",k);d.attr("transform",`translate(${e.x-m.width/2}, ${E+1-(ir(r)?0:3)})`);const N=T.node().getBBox();return e.height=N.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(F){return Vs(e,F)},{cluster:c,labelBBox:m}},"roundedWithTitle"),nW=v(async(t,e)=>{rt.info("Creating subgraph rect for ",e.id,e);const r=te(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=Ct(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=ir(r),f=d.insert("g").attr("class","cluster-label "),m=await En(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width});let x=m.getBBox();if(ir(r)){const T=m.children[0],N=Ut(m);x=T.getBoundingClientRect(),N.attr("width",x.width),N.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,b=e.x-g/2,k=e.y-y/2;rt.trace("Data ",e,JSON.stringify(e));let S;if(e.look==="handDrawn"){const T=xt.svg(d),N=bt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),F=T.path(ei(b,k,g,y,e.rx),N);S=d.insert(()=>(rt.debug("Rough node insert CXC",F),F),":first-child"),S.select("path:nth-child(2)").attr("style",c.join(";")),S.select("path").attr("style",u.join(";").replace("fill","stroke"))}else S=d.insert("rect",":first-child"),S.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",k).attr("width",g).attr("height",y);const{subGraphTitleTopMargin:E}=Wp(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+E})`),a){const T=f.select("span");T&&T.attr("style",a)}const w=S.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(T){return Vs(e,T)},{cluster:d,labelBBox:x}},"kanbanSection"),iW=v((t,e)=>{const r=te(),{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,c=e.width+l;e.diff=-e.padding;const u=e.height+l,d=e.x-c/2,p=e.y-u/2;e.width=c;let f;if(e.look==="handDrawn"){const g=xt.svg(o).rectangle(d,p,c,u,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:s,seed:i});f=o.insert(()=>g,":first-child")}else{f=a.insert("rect",":first-child");let x="outer";e.look,x="divider",f.attr("class",x).attr("x",d).attr("y",p).attr("width",c).attr("height",u).attr("data-look",e.look)}const m=f.node().getBBox();return e.height=m.height,e.offsetX=0,e.offsetY=0,e.intersect=function(x){return Vs(e,x)},{cluster:o,labelBBox:{}}},"divider"),sW=i2,oW={rect:i2,squareRect:sW,roundedWithTitle:rW,noteGroup:eW,divider:iW,kanbanSection:nW},s2=new Map,aW=v(async(t,e)=>{const r=e.shape||"rect",n=await oW[r](t,e);return s2.set(e.id,n),n},"insertCluster"),ktt=v(()=>{s2=new Map},"clear");function o2(t,e){return t.intersect(e)}v(o2,"intersectNode");var lW=o2;function a2(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),c=Math.abs(e*r*o/l);n.x<i&&(c=-c);var u=Math.abs(e*r*a/l);return n.y<s&&(u=-u),{x:i+c,y:s+u}}v(a2,"intersectEllipse");var l2=a2;function c2(t,e,r){return l2(t,e,e,r)}v(c2,"intersectCircle");var cW=c2;function h2(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,c=1e-6;if(a!==0&&l!==0&&Jd(a,l))return;const u=n.y-r.y,d=r.x-n.x,p=n.x*r.y-r.x*n.y,f=u*t.x+d*t.y+p,m=u*e.x+d*e.y+p;if(Math.abs(f)<c&&Math.abs(m)<c&&Jd(f,m))return;const x=i*d-u*s;if(x===0)return;const g=Math.abs(x/2);let y=s*p-d*o;const b=y<0?(y-g)/x:(y+g)/x;y=u*o-i*p;const k=y<0?(y-g)/x:(y+g)/x;return{x:b,y:k}}}v(h2,"intersectLine");function Jd(t,e){return t*e>0}v(Jd,"sameSign");var hW=h2;function u2(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,c=i-t.height/2-a;for(let u=0;u<e.length;u++){let d=e[u],p=e[u<e.length-1?u+1:0],f=hW(t,r,{x:l+d.x,y:c+d.y},{x:l+p.x,y:c+p.y});f&&s.push(f)}return s.length?(s.length>1&&s.sort(function(u,d){let p=u.x-r.x,f=u.y-r.y,m=Math.sqrt(p*p+f*f),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(u2,"intersectPolygon");var uW=u2,dt={node:lW,circle:cW,ellipse:l2,polygon:uW,rect:Vs};function d2(t,e){const{labelStyles:r}=Ct(e);e.labelStyle=r;const n=At(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=xt.svg(s),c=bt(e,{fill:"black",stroke:"none",fillStyle:"solid"});e.look!=="handDrawn"&&(c.roughness=0);const u=l.circle(0,0,o*2,c),d=s.insert(()=>u,":first-child");return d.attr("class","anchor").attr("style",Pe(a)),kt(e,d),e.intersect=function(p){return rt.info("Circle intersect",e,o,p),dt.circle(e,o,p)},s}v(d2,"anchor");function tf(t,e,r,n,i,s,o){const l=(t+r)/2,c=(e+n)/2,u=Math.atan2(n-e,r-t),d=(r-t)/2,p=(n-e)/2,f=d/i,m=p/s,x=Math.sqrt(f**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),b=c-g*i*Math.cos(u)*(o?-1:1),k=Math.atan2((e-b)/s,(t-y)/i);let E=Math.atan2((n-b)/s,(r-y)/i)-k;o&&E<0&&(E+=2*Math.PI),!o&&E>0&&(E-=2*Math.PI);const w=[];for(let T=0;T<20;T++){const N=T/19,F=k+N*E,L=y+i*Math.cos(F),B=b+s*Math.sin(F);w.push({x:L,y:B})}return w}v(tf,"generateArcPoints");function f2(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(f2,"calculateArcSagitta");async function p2(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(F=>F+o,"calcTotalHeight"),l=v(F=>{const L=F/2;return[L/(2.5+F/50),L]},"calcEllipseRadius"),{shapeSvg:c,bbox:u}=await It(t,e,At(e)),d=a(e!=null&&e.height?e==null?void 0:e.height:u.height),[p,f]=l(d),m=f2(d,p,f),g=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2+m-m,y=d,{cssStyles:b}=e,k=[{x:g/2,y:-y/2},{x:-g/2,y:-y/2},...tf(-g/2,-y/2,-g/2,y/2,p,f,!1),{x:g/2,y:y/2},...tf(g/2,y/2,g/2,-y/2,p,f,!0)],S=xt.svg(c),E=bt(e,{});e.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");const w=Zt(k),T=S.path(w,E),N=c.insert(()=>T,":first-child");return N.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),N.attr("transform",`translate(${p/2}, 0)`),kt(e,N),e.intersect=function(F){return dt.polygon(e,k,F)},c}v(p2,"bowTieRect");function Nn(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(Nn,"insertPolygonShape");var cl=12;async function m2(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 It(t,e,At(e)),c=((e==null?void 0:e.width)??l.width)+(e.look==="neo"?s*2:s+cl),u=((e==null?void 0:e.height)??l.height)+(e.look==="neo"?o*2:o),d=0,p=c,f=-u,m=0,x=[{x:d+cl,y:f},{x:p,y:f},{x:p,y:m},{x:d,y:m},{x:d,y:f+cl},{x:d+cl,y:f}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const b=xt.svg(a),k=bt(e,{}),S=Zt(x),E=b.path(S,k);g=a.insert(()=>E,":first-child").attr("transform",`translate(${-c/2}, ${u/2})`),y&&g.attr("style",y)}else g=Nn(a,c,u,x);return n&&g.attr("style",n),kt(e,g),e.intersect=function(b){return dt.polygon(e,x,b)},a}v(m2,"card");function g2(t,e){const{nodeStyles:r}=Ct(e);e.label="";const n=t.insert("g").attr("class",At(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=xt.svg(n),l=bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Zt(o),u=a.path(c,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(p){return dt.polygon(e,o,p)},n}v(g2,"choice");async function em(t,e,r){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{shapeSvg:s,bbox:o,halfPadding:a}=await It(t,e,At(e)),l=16,c=(r==null?void 0:r.padding)??a,u=e.look==="neo"?o.width/2+l*2:o.width/2+c;let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const f=xt.svg(s),m=bt(e,{}),x=f.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",Pe(p))}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(f,m){const x=f.width/2;return dt.circle(f,x,m)},e.intersect=function(f){return rt.info("Circle intersect",e,u,f),dt.circle(e,u,f)},s}v(em,"circle");function x2(t){const e=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=t*2,i={x:n/2*e,y:n/2*r},s={x:-(n/2)*e,y:n/2*r},o={x:-(n/2)*e,y:-(n/2)*r},a={x:n/2*e,y:-(n/2)*r};return`M ${s.x},${s.y} L ${a.x},${a.y}
568
- M ${i.x},${i.y} L ${o.x},${o.y}`}v(x2,"createLine");function y2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r,e.label="";const i=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),s=Math.max(30,(e==null?void 0:e.width)??0),{cssStyles:o}=e,a=xt.svg(i),l=bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=a.circle(0,0,s*2,l),u=x2(s),d=a.path(u,l),p=i.insert(()=>c,":first-child");return p.insert(()=>d),p.attr("class","outer-path"),o&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",o),n&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",n),kt(e,p),e.intersect=function(f){return rt.info("crossedCircle intersect",e,{radius:s,point:f}),dt.circle(e,s,f)},i}v(y2,"crossedCircle");function xn(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 p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(xn,"generateCirclePoints");async function b2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await It(t,e,At(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+a,u=s.height+l,d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...xn(c/2,-u/2,d,30,-90,0),{x:-c/2-d,y:d},...xn(c/2+d*2,-d,d,20,-180,-270),...xn(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:-u/2},...xn(c/2,u/2,d,20,0,90)],m=[{x:c/2,y:-u/2-d},{x:-c/2,y:-u/2-d},...xn(c/2,-u/2,d,20,-90,0),{x:-c/2-d,y:-d},...xn(c/2+c*.1,-d,d,20,-180,-270),...xn(c/2+c*.1,d,d,20,-90,-180),{x:-c/2-d,y:u/2},...xn(c/2,u/2,d,20,0,90),{x:-c/2,y:u/2+d},{x:c/2,y:u/2+d}],x=xt.svg(i),g=bt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Zt(f).replace("Z",""),k=x.path(b,g),S=Zt(m),E=x.path(S,{...g}),w=i.insert("g",":first-child");return w.insert(()=>E,":first-child").attr("stroke-opacity",0),w.insert(()=>k,":first-child"),w.attr("class","text"),p&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${d}, 0)`),o.attr("transform",`translate(${-c/2+d-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),kt(e,w),e.intersect=function(T){return dt.polygon(e,m,T)},i}v(b2,"curlyBraceLeft");function yn(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 p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:f,y:m})}return o}v(yn,"generateCirclePoints");async function C2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await It(t,e,At(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...yn(c/2,-u/2,d,20,-90,0),{x:c/2+d,y:-d},...yn(c/2+d*2,-d,d,20,-180,-270),...yn(c/2+d*2,d,d,20,-90,-180),{x:c/2+d,y:u/2},...yn(c/2,u/2,d,20,0,90)],m=[{x:-c/2,y:-u/2-d},{x:c/2,y:-u/2-d},...yn(c/2,-u/2,d,20,-90,0),{x:c/2+d,y:-d},...yn(c/2+d*2,-d,d,20,-180,-270),...yn(c/2+d*2,d,d,20,-90,-180),{x:c/2+d,y:u/2},...yn(c/2,u/2,d,20,0,90),{x:c/2,y:u/2+d},{x:-c/2,y:u/2+d}],x=xt.svg(i),g=bt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Zt(f).replace("Z",""),k=x.path(b,g),S=Zt(m),E=x.path(S,{...g}),w=i.insert("g",":first-child");return w.insert(()=>E,":first-child").attr("stroke-opacity",0),w.insert(()=>k,":first-child"),w.attr("class","text"),p&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&w.selectAll("path").attr("style",n),w.attr("transform",`translate(${-d}, 0)`),o.attr("transform",`translate(${-c/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),kt(e,w),e.intersect=function(T){return dt.polygon(e,m,T)},i}v(C2,"curlyBraceRight");function Oe(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 p=a+d*u,f=t+r*Math.cos(p),m=e+r*Math.sin(p);o.push({x:-f,y:-m})}return o}v(Oe,"generateCirclePoints");async function k2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await It(t,e,At(e)),a=e.look==="neo"?18:e.padding??0,l=e.look==="neo"?12:e.padding??0,c=s.width+(e.look==="neo"?a*2:a),u=s.height+(e.look==="neo"?l*2:l),d=Math.max(5,u*.1),{cssStyles:p}=e,f=[...Oe(c/2,-u/2,d,30,-90,0),{x:-c/2-d,y:d},...Oe(c/2+d*2,-d,d,20,-180,-270),...Oe(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:-u/2},...Oe(c/2,u/2,d,20,0,90)],m=[...Oe(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...Oe(-c/2-d/2,-d,d,20,0,90),...Oe(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...Oe(-c/2+d+d/2,u/2,d,30,-180,-270)],x=[{x:c/2,y:-u/2-d},{x:-c/2,y:-u/2-d},...Oe(c/2,-u/2,d,20,-90,0),{x:-c/2-d,y:-d},...Oe(c/2+d*2,-d,d,20,-180,-270),...Oe(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:u/2},...Oe(c/2,u/2,d,20,0,90),{x:-c/2,y:u/2+d},{x:c/2-d-d/2,y:u/2+d},...Oe(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...Oe(-c/2-d/2,-d,d,20,0,90),...Oe(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...Oe(-c/2+d+d/2,u/2,d,30,-180,-270)],g=xt.svg(i),y=bt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const k=Zt(f).replace("Z",""),S=g.path(k,y),w=Zt(m).replace("Z",""),T=g.path(w,y),N=Zt(x),F=g.path(N,{...y}),L=i.insert("g",":first-child");return L.insert(()=>F,":first-child").attr("stroke-opacity",0),L.insert(()=>S,":first-child"),L.insert(()=>T,":first-child"),L.attr("class","text"),p&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),L.attr("transform",`translate(${d-d/4}, 0)`),o.attr("transform",`translate(${-c/2+(e.padding??0)/2-(s.x-(s.left??0))},${-u/2+(e.padding??0)/2-(s.y-(s.top??0))})`),kt(e,L),e.intersect=function(B){return dt.polygon(e,x,B)},i}v(k2,"curlyBraces");async function v2(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:c,bbox:u}=await It(t,e,At(e)),d=Math.max(a,(u.width+s*2)*1.25,(e==null?void 0:e.width)??0),p=Math.max(l,u.height+o*2,(e==null?void 0:e.height)??0),f=p/2,{cssStyles:m}=e,x=xt.svg(c),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,b=p,k=y-f,S=b/4,E=[{x:k,y:0},{x:S,y:0},{x:0,y:b/2},{x:S,y:b},{x:k,y:b},...ua(-k,-b/2,f,50,270,90)],w=Zt(E),T=x.path(w,g),N=c.insert(()=>T,":first-child");return N.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&N.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&N.selectChildren("path").attr("style",n),N.attr("transform",`translate(${-d/2}, ${-p/2})`),kt(e,N),e.intersect=function(F){return dt.polygon(e,E,F)},c}v(v2,"curvedTrapezoid");var dW=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"),fW=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"),pW=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),l0=8,c0=8;async function w2(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<c0&&(e.width=c0);const b=g/2/(2.5+g/50);e.height=(e.height??0)-s-b*3,e.height<l0&&(e.height=l0)}const{shapeSvg:a,bbox:l,label:c}=await It(t,e,At(e)),u=(e.width?e.width:l.width)+o,d=u/2,p=d/(2.5+u/50),f=(e.height?e.height:l.height)+s+p;let m;const{cssStyles:x}=e;if(e.look==="handDrawn"){const g=xt.svg(a),y=fW(0,0,u,f,d,p),b=pW(0,p,u,f,d,p),k=bt(e,{}),S=g.path(y,k),E=g.path(b,bt(e,{fill:"none"}));m=a.insert(()=>E,":first-child"),m=a.insert(()=>S,":first-child"),m.attr("class","basic label-container"),x&&m.attr("style",x)}else{const g=dW(0,0,u,f,d,p);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",Pe(x)).attr("style",n)}return m.attr("label-offset-y",p),m.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),kt(e,m),c.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=dt.rect(e,g),b=y.x-(e.x??0);if(d!=0&&(Math.abs(b)<(e.width??0)/2||Math.abs(b)==(e.width??0)/2&&Math.abs(y.y-(e.y??0))>(e.height??0)/2-p)){let k=p*p*(1-b*b/(d*d));k>0&&(k=Math.sqrt(k)),k=p-k,g.y-(e.y??0)>0&&(k=-k),y.y+=k}return y},a}v(w2,"cylinder");async function S2(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 It(t,e,At(e)),c=a.width+i,u=a.height+s,d=u*.2,p=-c/2,f=-u/2-d/2,{cssStyles:m}=e,x=xt.svg(o),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:p,y:f+d},{x:-p,y:f+d},{x:-p,y:-f},{x:p,y:-f},{x:p,y:f},{x:-p,y:f},{x:-p,y:f+d}],b=x.polygon(y.map(S=>[S.x,S.y]),g),k=o.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),l.attr("transform",`translate(${p+(e.padding??0)/2-(a.x-(a.left??0))}, ${f+d+(e.padding??0)/2-(a.y-(a.top??0))})`),kt(e,k),e.intersect=function(S){return dt.rect(e,S)},o}v(S2,"dividedRectangle");async function T2(t,e){var f,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 It(t,e,At(e)),c=(e!=null&&e.width?(e==null?void 0:e.width)/2:l.width/2)+(o??0),u=c-i;let d;const{cssStyles:p}=e;if(e.look==="handDrawn"){const x=xt.svg(a),g=bt(e,{roughness:.2,strokeWidth:2.5}),y=bt(e,{roughness:.2,strokeWidth:1.5}),b=x.circle(0,0,c*2,g),k=x.circle(0,0,u*2,y);d=a.insert("g",":first-child"),d.attr("class",Pe(e.cssClasses)).attr("style",Pe(p)),(f=d.node())==null||f.appendChild(b),(m=d.node())==null||m.appendChild(k)}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",c).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 rt.info("DoubleCircle intersect",e,c,x),dt.circle(e,c,x)},a}v(T2,"doublecircle");function _2(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=Ct(e);e.label="",e.labelStyle=n;const s=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),o=7,{cssStyles:a}=e,l=xt.svg(s),{nodeBorder:c}=r,u=bt(e,{fillStyle:"solid"});e.look!=="handDrawn"&&(u.roughness=0);const d=l.circle(0,0,o*2,u),p=s.insert(()=>d,":first-child");return p.selectAll("path").attr("style",`fill: ${c} !important;`),a&&a.length>0&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",a),i&&e.look!=="handDrawn"&&p.selectAll("path").attr("style",i),kt(e,p),e.intersect=function(f){return rt.info("filledCircle intersect",e,{radius:o,point:f}),dt.circle(e,o,f)},s}v(_2,"filledCircle");var h0=10,u0=10;async function E2(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<h0&&(e.height=h0),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<u0&&(e.width=u0));const{shapeSvg:o,bbox:a,label:l}=await It(t,e,At(e)),c=(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:c+a.height,d=u,p=[{x:0,y:-u},{x:d,y:-u},{x:d/2,y:0}],{cssStyles:f}=e,m=xt.svg(o),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Zt(p),y=m.path(g,x),b=o.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`).attr("class","outer-path");return f&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&b.selectChildren("path").attr("style",n),e.width=c,e.height=u,kt(e,b),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(k){return rt.info("Triangle intersect",e,p,k),dt.polygon(e,p,k)},o}v(E2,"flippedTriangle");function N2(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=Ct(e);e.label="";const o=t.insert("g").attr("class",At(e)).attr("id",e.domId??e.id),{cssStyles:a}=e;let l=Math.max(70,(e==null?void 0:e.width)??0),c=Math.max(10,(e==null?void 0:e.height)??0);r==="LR"&&(l=Math.max(10,(e==null?void 0:e.width)??0),c=Math.max(70,(e==null?void 0:e.height)??0));const u=-1*l/2,d=-1*c/2,p=xt.svg(o),f=bt(e,{stroke:i.lineColor,fill:i.lineColor});e.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");const m=p.rectangle(u,d,l,c,f),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 dt.rect(e,y)},o}v(N2,"forkJoin");async function j2(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:c}=await It(t,e,At(e)),u=(e!=null&&e.width?e==null?void 0:e.width:Math.max(i,c.width))+o*2,d=(e!=null&&e.height?e==null?void 0:e.height:Math.max(s,c.height))+a*2,p=d/2,{cssStyles:f}=e,m=xt.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-p,y:-d/2},...ua(-u/2+p,0,p,50,90,270),{x:u/2-p,y:d/2},{x:-u/2,y:d/2}],y=Zt(g),b=m.path(y,x),k=l.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),kt(e,k),e.intersect=function(S){return rt.info("Pill intersect",e,{radius:p,point:S}),dt.polygon(e,g,S)},l}v(j2,"halfRoundedRectangle");var mW=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 L2(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,c=e.look==="neo"?a:s;if(e.width||e.height){const k=(e.height??0)/i;e.width=((e==null?void 0:e.width)??0)-2*k-c,e.height=(e.height??0)-l}const{shapeSvg:u,bbox:d}=await It(t,e,At(e)),p=(e!=null&&e.height?e==null?void 0:e.height:d.height)+l,f=p/i,m=(e!=null&&e.width?e==null?void 0:e.width:d.width)+2*f+c,x=[{x:f,y:0},{x:m-f,y:0},{x:m,y:-p/2},{x:m-f,y:-p},{x:f,y:-p},{x:0,y:-p/2}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const b=xt.svg(u),k=bt(e,{}),S=mW(0,0,m,p,f),E=b.path(S,k);g=u.insert(()=>E,":first-child").attr("transform",`translate(${-m/2}, ${p/2})`),y&&g.attr("style",y)}else g=Nn(u,m,p,x);return n&&g.attr("style",n),e.width=m,e.height=p,kt(e,g),e.intersect=function(b){return dt.polygon(e,x,b)},u}v(L2,"hexagon");async function B2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.label="",e.labelStyle=r;const{shapeSvg:i}=await It(t,e,At(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=xt.svg(i),c=bt(e,{});e.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");const u=[{x:0,y:0},{x:s,y:0},{x:0,y:o},{x:s,y:o}],d=Zt(u),p=l.path(d,c),f=i.insert(()=>p,":first-child");return f.attr("class","basic label-container outer-path"),a&&e.look!=="handDrawn"&&f.selectChildren("path").attr("style",a),n&&e.look!=="handDrawn"&&f.selectChildren("path").attr("style",n),f.attr("transform",`translate(${-s/2}, ${-o/2})`),kt(e,f),e.intersect=function(m){return rt.info("Pill intersect",e,{points:u}),dt.polygon(e,u,m)},i}v(B2,"hourglass");async function A2(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:c,bbox:u,label:d}=await It(t,e,"icon-shape default"),p=e.pos==="t",f=a,m=a,{nodeBorder:x}=r,{stylesMap:g}=Gs(e),y=-m/2,b=-f/2,k=e.label?8:0,S=xt.svg(c),E=bt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");const w=S.rectangle(y,b,m,f,E),T=Math.max(m,u.width),N=f+u.height+k,F=S.rectangle(-T/2,-N/2,T,N,{...E,fill:"transparent",stroke:"none"}),L=c.insert(()=>w,":first-child"),B=c.insert(()=>F);if(e.icon){const W=c.append("g");W.html(`<g>${await La(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const G=W.node().getBBox(),O=G.width,I=G.height,M=G.x,P=G.y;W.attr("transform",`translate(${-O/2-M},${p?u.height/2+k/2-I/2-P:-u.height/2-k/2-I/2-P})`),W.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-N/2:N/2-u.height})`),L.attr("transform",`translate(0,${p?u.height/2+k/2:-u.height/2-k/2})`),kt(e,B),e.intersect=function(W){if(rt.info("iconSquare intersect",e,W),!e.label)return dt.rect(e,W);const G=e.x??0,O=e.y??0,I=e.height??0;let M=[];return p?M=[{x:G-u.width/2,y:O-I/2},{x:G+u.width/2,y:O-I/2},{x:G+u.width/2,y:O-I/2+u.height+k},{x:G+m/2,y:O-I/2+u.height+k},{x:G+m/2,y:O+I/2},{x:G-m/2,y:O+I/2},{x:G-m/2,y:O-I/2+u.height+k},{x:G-u.width/2,y:O-I/2+u.height+k}]:M=[{x:G-m/2,y:O-I/2},{x:G+m/2,y:O-I/2},{x:G+m/2,y:O-I/2+f},{x:G+u.width/2,y:O-I/2+f},{x:G+u.width/2/2,y:O+I/2},{x:G-u.width/2,y:O+I/2},{x:G-u.width/2,y:O-I/2+f},{x:G-m/2,y:O-I/2+f}],dt.polygon(e,M,W)},c}v(A2,"icon");async function M2(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:c,bbox:u,label:d}=await It(t,e,"icon-shape default"),p=20,f=e.label?8:0,m=e.pos==="t",{nodeBorder:x,mainBkg:g}=r,{stylesMap:y}=Gs(e),b=xt.svg(c),k=bt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const S=y.get("fill");k.stroke=S??g;const E=c.append("g");e.icon&&E.html(`<g>${await La(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const w=E.node().getBBox(),T=w.width,N=w.height,F=w.x,L=w.y,B=Math.max(T,N)*Math.SQRT2+p*2,W=b.circle(0,0,B,k),G=Math.max(B,u.width),O=B+u.height+f,I=b.rectangle(-G/2,-O/2,G,O,{...k,fill:"transparent",stroke:"none"}),M=c.insert(()=>W,":first-child"),P=c.insert(()=>I);return E.attr("transform",`translate(${-T/2-F},${m?u.height/2+f/2-N/2-L:-u.height/2-f/2-N/2-L})`),E.attr("style",`color: ${y.get("stroke")??x};`),d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${m?-O/2:O/2-u.height})`),M.attr("transform",`translate(0,${m?u.height/2+f/2:-u.height/2-f/2})`),kt(e,P),e.intersect=function($){return rt.info("iconSquare intersect",e,$),dt.rect(e,$)},c}v(M2,"iconCircle");async function I2(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:c,bbox:u,halfPadding:d,label:p}=await It(t,e,"icon-shape default"),f=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:b}=Gs(e),k=-x/2,S=-m/2,E=e.label?8:0,w=xt.svg(c),T=bt(e,{});e.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const N=b.get("fill");T.stroke=N??y;const F=w.path(ei(k,S,x,m,5),T),L=Math.max(x,u.width),B=m+u.height+E,W=w.rectangle(-L/2,-B/2,L,B,{...T,fill:"transparent",stroke:"none"}),G=c.insert(()=>F,":first-child").attr("class","icon-shape2"),O=c.insert(()=>W);if(e.icon){const I=c.append("g");I.html(`<g>${await La(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const M=I.node().getBBox(),P=M.width,$=M.height,D=M.x,_=M.y;I.attr("transform",`translate(${-P/2-D},${f?u.height/2+E/2-$/2-_:-u.height/2-E/2-$/2-_})`),I.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-B/2:B/2-u.height})`),G.attr("transform",`translate(0,${f?u.height/2+E/2:-u.height/2-E/2})`),kt(e,O),e.intersect=function(I){if(rt.info("iconSquare intersect",e,I),!e.label)return dt.rect(e,I);const M=e.x??0,P=e.y??0,$=e.height??0;let D=[];return f?D=[{x:M-u.width/2,y:P-$/2},{x:M+u.width/2,y:P-$/2},{x:M+u.width/2,y:P-$/2+u.height+E},{x:M+x/2,y:P-$/2+u.height+E},{x:M+x/2,y:P+$/2},{x:M-x/2,y:P+$/2},{x:M-x/2,y:P-$/2+u.height+E},{x:M-u.width/2,y:P-$/2+u.height+E}]:D=[{x:M-x/2,y:P-$/2},{x:M+x/2,y:P-$/2},{x:M+x/2,y:P-$/2+m},{x:M+u.width/2,y:P-$/2+m},{x:M+u.width/2/2,y:P+$/2},{x:M-u.width/2,y:P+$/2},{x:M-u.width/2,y:P-$/2+m},{x:M-x/2,y:P-$/2+m}],dt.polygon(e,D,I)},c}v(I2,"iconRounded");async function F2(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:c,bbox:u,halfPadding:d,label:p}=await It(t,e,"icon-shape default"),f=e.pos==="t",m=a+d*2,x=a+d*2,{nodeBorder:g,mainBkg:y}=r,{stylesMap:b}=Gs(e),k=-x/2,S=-m/2,E=e.label?8:0,w=xt.svg(c),T=bt(e,{});e.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const N=b.get("fill");T.stroke=N??y;const F=w.path(ei(k,S,x,m,.1),T),L=Math.max(x,u.width),B=m+u.height+E,W=w.rectangle(-L/2,-B/2,L,B,{...T,fill:"transparent",stroke:"none"}),G=c.insert(()=>F,":first-child"),O=c.insert(()=>W);if(e.icon){const I=c.append("g");I.html(`<g>${await La(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const M=I.node().getBBox(),P=M.width,$=M.height,D=M.x,_=M.y;I.attr("transform",`translate(${-P/2-D},${f?u.height/2+E/2-$/2-_:-u.height/2-E/2-$/2-_})`),I.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-B/2:B/2-u.height})`),G.attr("transform",`translate(0,${f?u.height/2+E/2:-u.height/2-E/2})`),kt(e,O),e.intersect=function(I){if(rt.info("iconSquare intersect",e,I),!e.label)return dt.rect(e,I);const M=e.x??0,P=e.y??0,$=e.height??0;let D=[];return f?D=[{x:M-u.width/2,y:P-$/2},{x:M+u.width/2,y:P-$/2},{x:M+u.width/2,y:P-$/2+u.height+E},{x:M+x/2,y:P-$/2+u.height+E},{x:M+x/2,y:P+$/2},{x:M-x/2,y:P+$/2},{x:M-x/2,y:P-$/2+u.height+E},{x:M-u.width/2,y:P-$/2+u.height+E}]:D=[{x:M-x/2,y:P-$/2},{x:M+x/2,y:P-$/2},{x:M+x/2,y:P-$/2+m},{x:M+u.width/2,y:P-$/2+m},{x:M+u.width/2/2,y:P+$/2},{x:M-u.width/2,y:P+$/2},{x:M-u.width/2,y:P-$/2+m},{x:M-x/2,y:P-$/2+m}],dt.polygon(e,D,I)},c}v(F2,"iconSquare");async function P2(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),c=e.constraint==="on"&&e!=null&&e.assetHeight?e.assetHeight*e.imageAspectRatio:l,u=e.constraint==="on"?c/e.imageAspectRatio:(e==null?void 0:e.assetHeight)??s;e.width=Math.max(c,a??0);const{shapeSvg:d,bbox:p,label:f}=await It(t,e,"image-shape default"),m=e.pos==="t",x=-c/2,g=-u/2,y=e.label?8:0,b=xt.svg(d),k=bt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const S=b.rectangle(x,g,c,u,k),E=Math.max(c,p.width),w=u+p.height+y,T=b.rectangle(-E/2,-w/2,E,w,{...k,fill:"none",stroke:"none"}),N=d.insert(()=>S,":first-child"),F=d.insert(()=>T);if(e.img){const L=d.append("image");L.attr("href",e.img),L.attr("width",c),L.attr("height",u),L.attr("preserveAspectRatio","none"),L.attr("transform",`translate(${-c/2},${m?w/2-u:-w/2})`)}return f.attr("transform",`translate(${-p.width/2-(p.x-(p.left??0))},${m?-u/2-p.height/2-y/2:u/2-p.height/2+y/2})`),N.attr("transform",`translate(0,${m?p.height/2+y/2:-p.height/2-y/2})`),kt(e,F),e.intersect=function(L){if(rt.info("iconSquare intersect",e,L),!e.label)return dt.rect(e,L);const B=e.x??0,W=e.y??0,G=e.height??0;let O=[];return m?O=[{x:B-p.width/2,y:W-G/2},{x:B+p.width/2,y:W-G/2},{x:B+p.width/2,y:W-G/2+p.height+y},{x:B+c/2,y:W-G/2+p.height+y},{x:B+c/2,y:W+G/2},{x:B-c/2,y:W+G/2},{x:B-c/2,y:W-G/2+p.height+y},{x:B-p.width/2,y:W-G/2+p.height+y}]:O=[{x:B-c/2,y:W-G/2},{x:B+c/2,y:W-G/2},{x:B+c/2,y:W-G/2+u},{x:B+p.width/2,y:W-G/2+u},{x:B+p.width/2/2,y:W+G/2},{x:B-p.width/2,y:W+G/2},{x:B-p.width/2,y:W-G/2+u},{x:B-c/2,y:W-G/2+u}],dt.polygon(e,O,L)},d}v(P2,"imageSquare");async function D2(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 It(t,e,At(e)),c=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:c,y:0},{x:c+3*u/6,y:-u},{x:-3*u/6,y:-u}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Zt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${u/2})`),f&&p.attr("style",f)}else p=Nn(a,c,u,d);return n&&p.attr("style",n),e.width=c,e.height=u,kt(e,p),e.intersect=function(m){return dt.polygon(e,d,m)},a}v(D2,"inv_trapezoid");async function Aa(t,e,r){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{shapeSvg:s,bbox:o}=await It(t,e,At(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),c=-a/2,u=-l/2;let d,{rx:p,ry:f}=e;const{cssStyles:m}=e;if(r!=null&&r.rx&&r.ry&&(p=r.rx,f=r.ry),e.look==="handDrawn"){const x=xt.svg(s),g=bt(e,{}),y=p||f?x.path(ei(c,u,a,l,p||0),g):x.rectangle(c,u,a,l,g);d=s.insert(()=>y,":first-child"),d.attr("class","basic label-container").attr("style",Pe(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",Pe(p)).attr("ry",Pe(f)).attr("x",c).attr("y",u).attr("width",a).attr("height",l);return kt(e,d),e.calcIntersect=function(x,g){return dt.rect(x,g)},e.intersect=function(x){return dt.rect(e,x)},s}v(Aa,"drawRect");async function O2(t,e){const{shapeSvg:r,bbox:n,label:i}=await It(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 dt.rect(e,l)},r}v(O2,"labelRect");async function $2(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 It(t,e,At(e)),c=((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*c/6,y:0},{x:u,y:-c},{x:-(3*c)/6,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Zt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=Nn(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,kt(e,p),e.intersect=function(m){return dt.polygon(e,d,m)},a}v($2,"lean_left");async function R2(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 It(t,e,At(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*c/6,y:0},{x:u,y:0},{x:u+3*c/6,y:-c},{x:0,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Zt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=Nn(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,kt(e,p),e.intersect=function(m){return dt.polygon(e,d,m)},a}v(R2,"lean_right");function z2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.label="",e.labelStyle=r;const i=t.insert("g").attr("class",At(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,c=[{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=xt.svg(i),d=bt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const p=Zt(c),f=u.path(p,d),m=i.insert(()=>f,":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 rt.info("lightningBolt intersect",e,x),dt.polygon(e,c,x)},i}v(z2,"lightningBolt");var gW=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"),xW=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"),yW=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),d0=10,f0=10;async function W2(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<f0&&(e.width=f0);const k=y/2/(2.5+y/50);e.height=(e.height??0)-o-k*3,e.height<d0&&(e.height=d0)}const{shapeSvg:a,bbox:l,label:c}=await It(t,e,At(e)),u=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2,d=u/2,p=d/(2.5+u/50),f=(e!=null&&e.height?e==null?void 0:e.height:l.height)+p+o*2,m=f*.1;let x;const{cssStyles:g}=e;if(e.look==="handDrawn"){const y=xt.svg(a),b=xW(0,0,u,f,d,p,m),k=yW(0,p,u,f,d,p),S=bt(e,{}),E=y.path(b,S),w=y.path(k,S);a.insert(()=>w,":first-child").attr("class","line"),x=a.insert(()=>E,":first-child"),x.attr("class","basic label-container"),g&&x.attr("style",g)}else{const y=gW(0,0,u,f,d,p,m);x=a.insert("path",":first-child").attr("d",y).attr("class","basic label-container outer-path").attr("style",Pe(g)).attr("style",n)}return x.attr("label-offset-y",p),x.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),kt(e,x),c.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)+p-(l.y-(l.top??0))})`),e.intersect=function(y){const b=dt.rect(e,y),k=b.x-(e.x??0);if(d!=0&&(Math.abs(k)<(e.width??0)/2||Math.abs(k)==(e.width??0)/2&&Math.abs(b.y-(e.y??0))>(e.height??0)/2-p)){let S=p*p*(1-k*k/(d*d));S>0&&(S=Math.sqrt(S)),S=p-S,y.y-(e.y??0)>0&&(S=-S),b.y+=S}return b},a}v(W2,"linedCylinder");async function q2(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 S=e.width;e.width=(S??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:c}=await It(t,e,At(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,p=e.look==="neo"?d/4:d/8,f=d+p,{cssStyles:m}=e,x=xt.svg(a),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=[{x:-u/2-u/2*.1,y:-f/2},{x:-u/2-u/2*.1,y:f/2},...Yn(-u/2-u/2*.1,f/2,u/2+u/2*.1,f/2,p,.8),{x:u/2+u/2*.1,y:-f/2},{x:-u/2-u/2*.1,y:-f/2},{x:-u/2,y:-f/2},{x:-u/2,y:f/2*1.1},{x:-u/2,y:-f/2}],b=x.polygon(y.map(S=>[S.x,S.y]),g),k=a.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),k.attr("transform",`translate(0,${-p/2})`),c.attr("transform",`translate(${-u/2+(e.padding??0)+u/2*.1/2-(l.x-(l.left??0))},${-d/2+(e.padding??0)-p/2-(l.y-(l.top??0))})`),kt(e,k),e.intersect=function(S){return dt.polygon(e,y,S)},a}v(q2,"linedWaveEdgedRect");async function H2(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:c,label:u}=await It(t,e,At(e)),d=(e!=null&&e.width?e==null?void 0:e.width:c.width)+s*2+2*a,p=(e!=null&&e.height?e==null?void 0:e.height:c.height)+o*2+2*a,f=d-2*a,m=p-2*a,x=-f/2,g=-m/2,{cssStyles:y}=e,b=xt.svg(l),k=bt(e,{}),S=[{x:x-a,y:g+a},{x:x-a,y:g+m+a},{x:x+f-a,y:g+m+a},{x:x+f-a,y:g+m},{x:x+f,y:g+m},{x:x+f,y:g+m-a},{x:x+f+a,y:g+m-a},{x:x+f+a,y:g-a},{x:x+a,y:g-a},{x:x+a,y:g},{x,y:g},{x,y:g+a}],E=[{x,y:g+a},{x:x+f-a,y:g+a},{x:x+f-a,y:g+m},{x:x+f,y:g+m},{x:x+f,y:g},{x,y:g}];e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const w=Zt(S);let T=b.path(w,k);const N=Zt(E);let F=b.path(N,k);e.look!=="handDrawn"&&(T=Qd(T),F=Qd(F));const L=l.insert("g",":first-child");return L.insert(()=>T),L.insert(()=>F),L.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),u.attr("transform",`translate(${-(c.width/2)-a-(c.x-(c.left??0))}, ${-(c.height/2)+a-(c.y-(c.top??0))})`),kt(e,L),e.intersect=function(B){return dt.polygon(e,S,B)},l}v(H2,"multiRect");async function U2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await It(t,e,At(e)),a=e.padding??0,l=e.look==="neo"?16:a,c=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)-c*3);const d=Math.max(s.width,(e==null?void 0:e.width)??0)+l*2,p=Math.max(s.height,(e==null?void 0:e.height)??0)+c*3,f=e.look==="neo"?p/4:p/8,m=p+(u?f/2:-f/2),x=-d/2,g=-m/2,y=10,{cssStyles:b}=e,k=Yn(x-y,g+m+y,x+d-y,g+m+y,f,.8),S=k==null?void 0:k[k.length-1],E=[{x:x-y,y:g+y},{x:x-y,y:g+m+y},...k,{x:x+d-y,y:S.y-y},{x:x+d,y:S.y-y},{x:x+d,y:S.y-2*y},{x:x+d+y,y:S.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}],w=[{x,y:g+y},{x:x+d-y,y:g+y},{x:x+d-y,y:S.y-y},{x:x+d,y:S.y-y},{x:x+d,y:g},{x,y:g}],T=xt.svg(i),N=bt(e,{});e.look!=="handDrawn"&&(N.roughness=0,N.fillStyle="solid");const F=Zt(E),L=T.path(F,N),B=Zt(w),W=T.path(B,N),G=i.insert(()=>L,":first-child");return G.insert(()=>W),G.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&G.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&G.selectAll("path").attr("style",n),G.attr("transform",`translate(0,${-f/2})`),o.attr("transform",`translate(${-(s.width/2)-y-(s.x-(s.left??0))}, ${-(s.height/2)+y-f/2-(s.y-(s.top??0))})`),kt(e,G),e.intersect=function(O){return dt.polygon(e,E,O)},i}v(U2,"multiWaveEdgedRectangle");async function G2(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n,e.useHtmlLabels||ir(be())||(e.centerLabel=!0);const{shapeSvg:o,bbox:a,label:l}=await It(t,e,At(e)),c=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=-c/2,p=-u/2,{cssStyles:f}=e,m=xt.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,p,c,u,x),y=o.insert(()=>g,":first-child");return y.attr("class","basic label-container outer-path"),l.attr("class","label noteLabel"),f&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",f),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(b){return dt.rect(e,b)},o}v(G2,"note");var bW=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 V2(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await It(t,e,At(e)),o=s.width+(e.padding??0),a=s.height+(e.padding??0),l=o+a,c=.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:p}=e;if(e.look==="handDrawn"){const f=xt.svg(i),m=bt(e,{}),x=bW(0,0,l),g=f.path(x,m);d=i.insert(()=>g,":first-child").attr("transform",`translate(${-l/2+c}, ${l/2})`),p&&d.attr("style",p)}else d=Nn(i,l,l,u),d.attr("transform",`translate(${-l/2+c}, ${l/2})`);return n&&d.attr("style",n),kt(e,d),e.calcIntersect=function(f,m){const x=f.width,g=[{x:x/2,y:0},{x,y:-x/2},{x:x/2,y:-x},{x:0,y:-x/2}],y=dt.polygon(f,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(f){return this.calcIntersect(e,f)},i}v(V2,"question");async function Y2(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:c}=await It(t,e,At(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),p=-u/2,f=-d/2,m=f/2,x=[{x:p+m,y:f},{x:p,y:0},{x:p+m,y:-f},{x:-p,y:-f},{x:-p,y:f}],{cssStyles:g}=e,y=xt.svg(a),b=bt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const k=Zt(x),S=y.path(k,b),E=a.insert(()=>S,":first-child");return E.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",g),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),E.attr("transform",`translate(${-m/2},0)`),c.attr("transform",`translate(${-m/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),kt(e,E),e.intersect=function(w){return dt.polygon(e,x,w)},a}v(Y2,"rect_left_inv_arrow");async function X2(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,c=e.label,u=await On(a,c,e.labelStyle,!0,!0);let d={width:0,height:0};if(ir(te())){const N=u.children[0],F=Ut(u);d=N.getBoundingClientRect(),F.attr("width",d.width),F.attr("height",d.height)}rt.info("Text 2",l);const p=l||[],f=u.getBBox(),m=await On(a,Array.isArray(p)?p.join("<br/>"):p,e.labelStyle,!0,!0),x=m.children[0],g=Ut(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;Ut(m).attr("transform","translate( "+(d.width>f.width?0:(f.width-d.width)/2)+", "+(f.height+y+5)+")"),Ut(u).attr("transform","translate( "+(d.width<f.width?0:-(f.width-d.width)/2)+", 0)"),d=a.node().getBBox(),a.attr("transform","translate("+-d.width/2+", "+(-d.height/2-y+3)+")");const b=d.width+(e.padding||0),k=d.height+(e.padding||0),S=-d.width/2-y,E=-d.height/2-y;let w,T;if(e.look==="handDrawn"){const N=xt.svg(s),F=bt(e,{}),L=N.path(ei(S,E,b,k,e.rx||0),F),B=N.line(-d.width/2-y,-d.height/2-y+f.height+y,d.width/2+y,-d.height/2-y+f.height+y,F);T=s.insert(()=>(rt.debug("Rough node insert CXC",L),B),":first-child"),w=s.insert(()=>(rt.debug("Rough node insert CXC",L),L),":first-child")}else w=o.insert("rect",":first-child"),T=o.insert("line"),w.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)),T.attr("class","divider").attr("x1",-d.width/2-y).attr("x2",d.width/2+y).attr("y1",-d.height/2-y+f.height+y).attr("y2",-d.height/2-y+f.height+y);return kt(e,w),e.intersect=function(N){return dt.rect(e,N)},s}v(X2,"rectWithTitle");async function K2(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 Aa(t,e,i)}v(K2,"roundedRect");var li=8;async function Z2(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 It(t,e,At(e)),c=((e==null?void 0:e.width)??a.width)+i*2+(e.look==="neo"?li:li*2),u=((e==null?void 0:e.height)??a.height)+s*2,d=c-li,p=u,f=li-c/2,m=-u/2,{cssStyles:x}=e,g=xt.svg(o),y=bt(e,{});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const b=[{x:f,y:m},{x:f+d,y:m},{x:f+d,y:m+p},{x:f-li,y:m+p},{x:f-li,y:m},{x:f,y:m},{x:f,y:m+p}],k=g.polygon(b.map(E=>[E.x,E.y]),y),S=o.insert(()=>k,":first-child");return S.attr("class","basic label-container outer-path").attr("style",Pe(x)),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),l.attr("transform",`translate(${li/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),kt(e,S),e.intersect=function(E){return dt.rect(e,E)},o}v(Z2,"shadedProcess");async function Q2(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:c}=await It(t,e,At(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,p=u,f=d/1.5,m=-p/2,x=-f/2,{cssStyles:g}=e,y=xt.svg(a),b=bt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const k=[{x:m,y:x},{x:m,y:x+f},{x:m+p,y:x+f},{x:m+p,y:x-f/2}],S=Zt(k),E=y.path(S,b),w=a.insert(()=>E,":first-child");return w.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&w.selectChildren("path").attr("style",g),n&&e.look!=="handDrawn"&&w.selectChildren("path").attr("style",n),w.attr("transform",`translate(0, ${f/4})`),c.attr("transform",`translate(${-p/2+(e.padding??0)-(l.x-(l.left??0))}, ${-f/4+(e.padding??0)-(l.y-(l.top??0))})`),kt(e,w),e.intersect=function(T){return dt.polygon(e,k,T)},a}v(Q2,"slopedRect");async function J2(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 Aa(t,e,s)}v(J2,"squareRect");async function tS(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 It(t,e,At(e)),c=l.height+(e.look==="neo"?o*2:o),u=l.width+c/4+(e.look==="neo"?s*2:s),d=c/2,{cssStyles:p}=e,f=xt.svg(a),m=bt(e,{});e.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");const x=[{x:-u/2+d,y:-c/2},{x:u/2-d,y:-c/2},...ua(-u/2+d,0,d,50,90,270),{x:u/2-d,y:c/2},...ua(u/2-d,0,d,50,270,450)],g=Zt(x),y=f.path(g,m),b=a.insert(()=>y,":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(k){return dt.polygon(e,x,k)},a}v(tS,"stadium");async function eS(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return Aa(t,e,r)}v(eS,"state");function rS(t,e,{config:{themeVariables:r}}){var b,k;const{labelStyles:n,nodeStyles:i}=Ct(e);e.labelStyle=n;const{cssStyles:s}=e,{lineColor:o,stateBorder:a,nodeBorder:l,nodeShadow:c}=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=xt.svg(u),p=bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");const f=d.circle(0,0,e.width,{...p,stroke:o,strokeWidth:2}),m=a??l,x=(e.width??0)*5/14,g=d.circle(0,0,x,{...p,fill:m,stroke:m,strokeWidth:2,fillStyle:"solid"}),y=u.insert(()=>f,":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&&c&&e.look!=="handDrawn"){const S=((k=(b=t.node())==null?void 0:b.ownerSVGElement)==null?void 0:k.id)??"",E=S?`${S}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${E})`)}return kt(e,y),e.intersect=function(S){return dt.circle(e,(e.width??0)/2,S)},u}v(rS,"stateEnd");function nS(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=xt.svg(s).circle(0,0,e.width,N9(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 c=((l=(a=t.node())==null?void 0:a.ownerSVGElement)==null?void 0:l.id)??"",u=c?`${c}-drop-shadow-small`:"drop-shadow-small";o.attr("style",`filter:url(#${u})`)}return kt(e,o),e.intersect=function(c){return dt.circle(e,(e.width??7)/2,c)},s}v(nS,"stateStart");var Ui=8;async function iS(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 It(t,e,At(e)),c=((e==null?void 0:e.width)??l.width)+2*Ui+s,u=((e==null?void 0:e.height)??l.height)+o,d=c-2*Ui,p=u,f=-c/2,m=-u/2,x=[{x:0,y:0},{x:d,y:0},{x:d,y:-p},{x:0,y:-p},{x:0,y:0},{x:-8,y:0},{x:d+8,y:0},{x:d+8,y:-p},{x:-8,y:-p},{x:-8,y:0}];if(e.look==="handDrawn"){const g=xt.svg(a),y=bt(e,{}),b=g.rectangle(f,m,d+16,p,y),k=g.line(f+Ui,m,f+Ui,m+p,y),S=g.line(f+Ui+d,m,f+Ui+d,m+p,y);a.insert(()=>k,":first-child"),a.insert(()=>S,":first-child");const E=a.insert(()=>b,":first-child"),{cssStyles:w}=e;E.attr("class","basic label-container").attr("style",Pe(w)),kt(e,E)}else{const g=Nn(a,d,p,x);n&&g.attr("style",n),kt(e,g)}return e.intersect=function(g){return dt.polygon(e,x,g)},a}v(iS,"subroutine");var Eu=.2;async function sS(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-Eu*(e.height+o*2),10));const{shapeSvg:a,bbox:l}=await It(t,e,At(e)),c=(e!=null&&e.height?e==null?void 0:e.height:l.height)+o*2,u=Eu*c,d=Eu*c,f=(e!=null&&e.width?e==null?void 0:e.width:l.width)+s*2+u-u,m=c,x=-f/2,g=-m/2,{cssStyles:y}=e,b=xt.svg(a),k=bt(e,{}),S=[{x:x-u/2,y:g},{x:x+f+u/2,y:g},{x:x+f+u/2,y:g+m},{x:x-u/2,y:g+m}],E=[{x:x+f-u/2,y:g+m},{x:x+f+u/2,y:g+m},{x:x+f+u/2,y:g+m-d}];e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const w=Zt(S),T=b.path(w,k),N=Zt(E),F=b.path(N,{...k,fillStyle:"solid"}),L=a.insert(()=>F,":first-child");return L.insert(()=>T,":first-child"),L.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&L.selectAll("path").attr("style",n),kt(e,L),e.intersect=function(B){return dt.polygon(e,S,B)},a}v(sS,"taggedRect");async function oS(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,label:o}=await It(t,e,At(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),c=l/8,u=.2*a,d=.2*l,p=l+c,{cssStyles:f}=e,m=xt.svg(i),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:p/2},...Yn(-a/2-a/2*.1,p/2,a/2+a/2*.1,p/2,c,.8),{x:a/2+a/2*.1,y:-p/2},{x:-a/2-a/2*.1,y:-p/2}],y=-a/2+a/2*.1,b=-p/2-d*.4,k=[{x:y+a-u,y:(b+l)*1.3},{x:y+a,y:b+l-d},{x:y+a,y:(b+l)*.9},...Yn(y+a,(b+l)*1.25,y+a-u,(b+l)*1.3,-l*.02,.5)],S=Zt(g),E=m.path(S,x),w=Zt(k),T=m.path(w,{...x,fillStyle:"solid"}),N=i.insert(()=>T,":first-child");return N.insert(()=>E,":first-child"),N.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),N.attr("transform",`translate(0,${-c/2})`),o.attr("transform",`translate(${-a/2+(e.padding??0)-(s.x-(s.left??0))},${-l/2+(e.padding??0)-c/2-(s.y-(s.top??0))})`),kt(e,N),e.intersect=function(F){return dt.polygon(e,g,F)},i}v(oS,"taggedWaveEdgedRectangle");async function aS(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s}=await It(t,e,At(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,c=-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",c).attr("width",o).attr("height",a),kt(e,u),e.intersect=function(d){return dt.rect(e,d)},i}v(aS,"text");var CW=v((t,e,r,n,i,s)=>`M${t},${e}
569
- a${i},${s} 0,0,1 0,${-n}
570
- l${r},0
571
- a${i},${s} 0,0,1 0,${n}
572
- M${r},${-n}
573
- a${i},${s} 0,0,0 0,${n}
574
- l${-r},0`,"createCylinderPathD"),kW=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"),vW=v((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),p0=5,m0=10;async function lS(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<p0&&(e.height=p0);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<m0&&(e.width=m0)}const{shapeSvg:o,bbox:a,label:l}=await It(t,e,At(e)),c=(e.height?e.height:a.height)+s,u=c/2,d=u/(2.5+c/50),p=(e.width?e.width:a.width)+d+s,{cssStyles:f}=e;let m;if(e.look==="handDrawn"){const x=xt.svg(o),g=kW(0,0,p,c,d,u),y=vW(0,0,p,c,d,u),b=x.path(g,bt(e,{})),k=x.path(y,bt(e,{fill:"none"}));m=o.insert(()=>k,":first-child"),m=o.insert(()=>b,":first-child"),m.attr("class","basic label-container"),f&&m.attr("style",f)}else{const x=CW(0,0,p,c,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",Pe(f)).attr("style",n),m.attr("class","basic label-container outer-path"),f&&m.selectAll("path").attr("style",f),n&&m.selectAll("path").attr("style",n)}return m.attr("label-offset-x",d),m.attr("transform",`translate(${-p/2}, ${c/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=dt.rect(e,x),y=g.y-(e.y??0);if(u!=0&&(Math.abs(y)<(e.height??0)/2||Math.abs(y)==(e.height??0)/2&&Math.abs(g.x-(e.x??0))>(e.width??0)/2-d)){let b=d*d*(1-y*y/(u*u));b!=0&&(b=Math.sqrt(Math.abs(b))),b=d-b,x.x-(e.x??0)>0&&(b=-b),g.x+=b}return g},o}v(lS,"tiltedCylinder");async function cS(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 It(t,e,At(e)),c=((e==null?void 0:e.height)??l.height)+s,u=((e==null?void 0:e.width)??l.width)+o,d=[{x:-3*c/6,y:0},{x:u+3*c/6,y:0},{x:u,y:-c},{x:0,y:-c}];let p;const{cssStyles:f}=e;if(e.look==="handDrawn"){const m=xt.svg(a),x=bt(e,{}),g=Zt(d),y=m.path(g,x);p=a.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${c/2})`),f&&p.attr("style",f)}else p=Nn(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,kt(e,p),e.intersect=function(m){return dt.polygon(e,d,m)},a}v(cS,"trapezoid");async function hS(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:c,bbox:u}=await It(t,e,At(e)),d=(e!=null&&e.width?e==null?void 0:e.width:u.width)+s*2,p=(e!=null&&e.height?e==null?void 0:e.height:u.height)+o*2,{cssStyles:f}=e,m=xt.svg(c),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-d/2*.8,y:-p/2},{x:d/2*.8,y:-p/2},{x:d/2,y:-p/2*.6},{x:d/2,y:p/2},{x:-d/2,y:p/2},{x:-d/2,y:-p/2*.6}],y=Zt(g),b=m.path(y,x),k=c.insert(()=>b,":first-child");return k.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),kt(e,k),e.intersect=function(S){return dt.polygon(e,g,S)},c}v(hS,"trapezoidalPentagon");var g0=10,x0=10;async function uS(t,e){var S;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<x0&&(e.width=x0),e.height=(e==null?void 0:e.height)??0,e.height<g0&&(e.height=g0));const{shapeSvg:o,bbox:a,label:l}=await It(t,e,At(e)),c=Tn((S=te().flowchart)==null?void 0:S.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,p=d,f=[{x:0,y:0},{x:p,y:0},{x:p/2,y:-d}],{cssStyles:m}=e,x=xt.svg(o),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Zt(f),b=x.path(y,g),k=o.insert(()=>b,":first-child").attr("transform",`translate(${-d/2}, ${d/2})`).attr("class","outer-path");return m&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),e.width=u,e.height=d,kt(e,k),l.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${d/2-(a.height+(e.padding??0)/(c?2:1)-(a.y-(a.top??0)))})`),e.intersect=function(E){return rt.info("Triangle intersect",e,f,E),dt.polygon(e,f,E)},o}v(uS,"triangle");async function dS(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:c,label:u}=await It(t,e,At(e)),d=(e!=null&&e.width?e==null?void 0:e.width:c.width)+(s??0)*2,p=(e!=null&&e.height?e==null?void 0:e.height:c.height)+(o??0)*2,f=e.look==="neo"?p/4:p/8,m=p+(a?f:-f),{cssStyles:x}=e,y=14-d,b=y>0?y/2:0,k=xt.svg(l),S=bt(e,{});e.look!=="handDrawn"&&(S.roughness=0,S.fillStyle="solid");const E=[{x:-d/2-b,y:m/2},...Yn(-d/2-b,m/2,d/2+b,m/2,f,.8),{x:d/2+b,y:-m/2},{x:-d/2-b,y:-m/2}],w=Zt(E),T=k.path(w,S),N=l.insert(()=>T,":first-child");return N.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),N.attr("transform",`translate(0,${-f/2})`),u.attr("transform",`translate(${-d/2+(e.padding??0)-(c.x-(c.left??0))},${-p/2+(e.padding??0)-f-(c.y-(c.top??0))})`),kt(e,N),e.intersect=function(F){return dt.polygon(e,E,F)},l}v(dS,"waveEdgedRectangle");async function fS(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 S=Math.min(e.height*.2,e.height/4);e.height=Math.ceil(e.height-o-S*(20/9)),e.width=e.width-s*2}const{shapeSvg:a,bbox:l}=await It(t,e,At(e)),c=(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,p=u+d*2,{cssStyles:f}=e,m=xt.svg(a),x=bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-c/2,y:p/2},...Yn(-c/2,p/2,c/2,p/2,d,1),{x:c/2,y:-p/2},...Yn(c/2,-p/2,-c/2,-p/2,d,-1)],y=Zt(g),b=m.path(y,x),k=a.insert(()=>b,":first-child");return k.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),kt(e,k),e.intersect=function(S){return dt.polygon(e,g,S)},a}v(fS,"waveRectangle");var Ce=10;async function pS(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-Ce,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-Ce,10));const{shapeSvg:o,bbox:a,label:l}=await It(t,e,At(e)),c=(e!=null&&e.width?e==null?void 0:e.width:a.width)+i*2+Ce,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+Ce,d=c-Ce,p=u-Ce,f=-d/2,m=-p/2,{cssStyles:x}=e,g=xt.svg(o),y=bt(e,{}),b=[{x:f-Ce,y:m-Ce},{x:f-Ce,y:m+p},{x:f+d,y:m+p},{x:f+d,y:m-Ce}],k=`M${f-Ce},${m-Ce} L${f+d},${m-Ce} L${f+d},${m+p} L${f-Ce},${m+p} L${f-Ce},${m-Ce}
575
- M${f-Ce},${m} L${f+d},${m}
576
- M${f},${m-Ce} L${f},${m+p}`;e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const S=g.path(k,y),E=o.insert(()=>S,":first-child");return E.attr("transform",`translate(${Ce/2}, ${Ce/2})`),E.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&E.selectAll("path").attr("style",n),l.attr("transform",`translate(${-(a.width/2)+Ce/2-(a.x-(a.left??0))}, ${-(a.height/2)+Ce/2-(a.y-(a.top??0))})`),kt(e,E),e.intersect=function(w){return dt.polygon(e,b,w)},o}v(pS,"windowPane");var y0=new Set(["redux-color","redux-dark-color"]),wW=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function rm(t,e){var J,yt,Ot,lt;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=be(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:Z}=be(),{background:at}=Z,vt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${at}`]};await rm(t,vt)}const c=be();e.useHtmlLabels=c.htmlLabels;let u=((J=c.er)==null?void 0:J.diagramPadding)??10,d=((yt=c.er)==null?void 0:yt.entityPadding)??6;const{cssStyles:p}=e,{labelStyles:f,nodeStyles:m}=Ct(e);if(r.attributes.length===0&&e.label){const Z={rx:0,ry:0,labelPaddingX:u,labelPaddingY:u*1.5};wn(e.label,c)+Z.labelPaddingX*2<c.er.minEntityWidth&&(e.width=c.er.minEntityWidth);const at=await Aa(t,e,Z);if(n!=null&&y0.has(n)){const vt=r.colorIndex??0;at.attr("data-color-id",`color-${vt%l.length}`)}if(!Tn(c.htmlLabels)){const vt=at.select("text"),Et=(Ot=vt.node())==null?void 0:Ot.getBBox();vt.attr("transform",`translate(${-Et.width/2}, 0)`)}return at}c.htmlLabels||(u*=1.25,d*=1.25);let x=At(e);x||(x="node default");const g=t.insert("g").attr("class",x).attr("id",e.domId||e.id),y=await ns(g,e.label??"",c,0,0,["name"],f);y.height+=d;let b=0;const k=[],S=[];let E=0,w=0,T=0,N=0,F=!0,L=!0;for(const Z of r.attributes){const at=await ns(g,Z.type,c,0,b,["attribute-type"],f);E=Math.max(E,at.width+u);const vt=await ns(g,Z.name,c,0,b,["attribute-name"],f);w=Math.max(w,vt.width+u);const Et=await ns(g,Z.keys.join(),c,0,b,["attribute-keys"],f);T=Math.max(T,Et.width+u);const Mt=await ns(g,Z.comment,c,0,b,["attribute-comment"],f);N=Math.max(N,Mt.width+u);const re=Math.max(at.height,vt.height,Et.height,Mt.height)+d;S.push({yOffset:b,rowHeight:re}),b+=re}let B=4;T<=u&&(F=!1,T=0,B--),N<=u&&(L=!1,N=0,B--);const W=g.node().getBBox();if(y.width+u*2-(E+w+T+N)>0){const Z=y.width+u*2-(E+w+T+N);E+=Z/B,w+=Z/B,T>0&&(T+=Z/B),N>0&&(N+=Z/B)}const G=E+w+T+N,O=xt.svg(g),I=bt(e,{});e.look!=="handDrawn"&&(I.roughness=0,I.fillStyle="solid");let M=0;S.length>0&&(M=S.reduce((Z,at)=>Z+((at==null?void 0:at.rowHeight)??0),0));const P=Math.max(W.width+u*2,(e==null?void 0:e.width)||0,G),$=Math.max((M??0)+y.height,(e==null?void 0:e.height)||0),D=-P/2,_=-$/2;if(g.selectAll("g:not(:first-child)").each((Z,at,vt)=>{const Et=Ut(vt[at]),Mt=Et.attr("transform");let re=0,xe=0;if(Mt){const Kt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Mt);Kt&&(re=parseFloat(Kt[1]),xe=parseFloat(Kt[2]),Et.attr("class").includes("attribute-name")?re+=E:Et.attr("class").includes("attribute-keys")?re+=E+w:Et.attr("class").includes("attribute-comment")&&(re+=E+w+T))}Et.attr("transform",`translate(${D+u/2+re}, ${xe+_+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(_+d/2)+")"),n!=null&&y0.has(n)){const Z=r.colorIndex??0;g.attr("data-color-id",`color-${Z%l.length}`)}const R=O.rectangle(D,_,P,$,I),X=g.insert(()=>R,":first-child").attr("class","outer-path").attr("style",p.join(""));k.push(0);for(const[Z,at]of S.entries()){const Et=(Z+1)%2===0&&at.yOffset!==0,Mt=O.rectangle(D,y.height+_+(at==null?void 0:at.yOffset),P,at==null?void 0:at.rowHeight,{...I,fill:Et?s:o,stroke:a});g.insert(()=>Mt,"g.label").attr("style",p.join("")).attr("class",`row-rect-${Et?"even":"odd"}`)}const A=1e-4;let ct=is(D,y.height+_,P+D,y.height+_,A),st=O.polygon(ct.map(Z=>[Z.x,Z.y]),I);if(g.insert(()=>st).attr("class","divider"),ct=is(E+D,y.height+_,E+D,$+_,A),st=O.polygon(ct.map(Z=>[Z.x,Z.y]),I),g.insert(()=>st).attr("class","divider"),F){const Z=E+w+D;ct=is(Z,y.height+_,Z,$+_,A),st=O.polygon(ct.map(at=>[at.x,at.y]),I),g.insert(()=>st).attr("class","divider")}if(L){const Z=E+w+T+D;ct=is(Z,y.height+_,Z,$+_,A),st=O.polygon(ct.map(at=>[at.x,at.y]),I),g.insert(()=>st).attr("class","divider")}for(const Z of k){const at=y.height+_+Z;ct=is(D,at,P+D,at,A),st=O.polygon(ct.map(vt=>[vt.x,vt.y]),I),g.insert(()=>st).attr("class","divider")}if(kt(e,X),m&&e.look!=="handDrawn")if(n!=null&&wW.has(n))g.selectAll("path").attr("style",m);else{const Z=m.split(";"),at=(lt=Z==null?void 0:Z.filter(vt=>vt.includes("stroke")))==null?void 0:lt.map(vt=>`${vt}`).join("; ");g.selectAll("path").attr("style",at??""),g.selectAll(".row-rect-even path").attr("style",m)}return e.intersect=function(Z){return dt.rect(e,Z)},g}v(rm,"erBox");async function ns(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!==Qg(e)&&(e=Qg(e),e=e.replaceAll("<","&lt;").replaceAll(">","&gt;"));const l=a.node().appendChild(await En(a,e,{width:wn(e,r)+100,style:o,useHtmlLabels:r.htmlLabels},r));if(e.includes("&lt;")||e.includes("&gt;")){let u=l.children[0];for(u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">");u.childNodes[0];)u=u.childNodes[0],u.textContent=u.textContent.replaceAll("&lt;","<").replaceAll("&gt;",">")}let c=l.getBBox();if(Tn(r.htmlLabels)){const u=l.children[0];u.style.textAlign="start";const d=Ut(l);c=u.getBoundingClientRect(),d.attr("width",c.width),d.attr("height",c.height)}return c}v(ns,"addText");function is(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(is,"lineToPolygon");async function mS(t,e,r,n,i=r.class.padding??12){const s=n?0:3,o=t.insert("g").attr("class",At(e)).attr("id",e.domId||e.id);let a=null,l=null,c=null,u=null,d=0,p=0,f=0;if(a=o.insert("g").attr("class","annotation-group text"),e.annotations.length>0){const b=e.annotations[0];await Fo(a,{text:`«${b}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await Fo(l,e,0,["font-weight: bolder"]);const m=l.node().getBBox();p=m.height,c=o.insert("g").attr("class","members-group text");let x=0;for(const b of e.members){const k=await Fo(c,b,x,[b.parseClassifier()]);x+=k+s}f=c.node().getBBox().height,f<=0&&(f=i/2),u=o.insert("g").attr("class","methods-group text");let g=0;for(const b of e.methods){const k=await Fo(u,b,g,[b.parseClassifier()]);g+=k+s}let y=o.node().getBBox();if(a!==null){const b=a.node().getBBox();a.attr("transform",`translate(${-b.width/2})`)}return l.attr("transform",`translate(${-m.width/2}, ${d})`),y=o.node().getBBox(),c.attr("transform",`translate(0, ${d+p+i*2})`),y=o.node().getBBox(),u.attr("transform",`translate(0, ${d+p+(f?f+i*4:i*2)})`),y=o.node().getBBox(),{shapeSvg:o,bbox:y}}v(mS,"textHelper");async function Fo(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=be();let o="useHtmlLabels"in e?e.useHtmlLabels:Tn(s.htmlLabels)??!0,a="";"text"in e?a=e.text:a=e.label,!o&&a.startsWith("\\")&&(a=a.substring(1)),ta(a)&&(o=!0);const l=await En(i,up(_i(a)),{width:wn(a,s)+50,classes:"markdown-node-label",useHtmlLabels:o},s);let c,u=1;if(o){const d=l.children[0],p=Ut(l);u=d.innerHTML.split("<br>").length,d.innerHTML.includes("</math>")&&(u+=d.innerHTML.split("<mrow>").length-1);const f=d.getElementsByTagName("img");if(f){const m=a.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...f].map(x=>new Promise(g=>{function y(){var b;if(x.style.display="flex",x.style.flexDirection="column",m){const k=((b=s.fontSize)==null?void 0:b.toString())??window.getComputedStyle(document.body).fontSize,E=parseInt(k,10)*5+"px";x.style.minWidth=E,x.style.maxWidth=E}else x.style.width="100%";g(x)}v(y,"setupImage"),setTimeout(()=>{x.complete&&y()}),x.addEventListener("error",y),x.addEventListener("load",y)})))}c=d.getBoundingClientRect(),p.attr("width",c.width),p.attr("height",c.height)}else{n.includes("font-weight: bolder")&&Ut(l).selectAll("tspan").attr("font-weight",""),u=l.children.length;const d=l.children[0];(l.textContent===""||l.textContent.includes("&gt"))&&(d.textContent=a[0]+a.substring(1).replaceAll("&gt;",">").replaceAll("&lt;","<").trim(),a[1]===" "&&(d.textContent=d.textContent[0]+" "+d.textContent.substring(1))),d.textContent==="undefined"&&(d.textContent=""),c=l.getBBox()}return i.attr("transform","translate(0,"+(-c.height/(2*u)+r)+")"),c.height}v(Fo,"addText");async function gS(t,e){var O,I;const r=te(),{themeVariables:n}=r,{useGradient:i}=n,s=r.class.padding??12,o=s,a=e.useHtmlLabels??Tn(r.htmlLabels)??!0,l=e;l.annotations=l.annotations??[],l.members=l.members??[],l.methods=l.methods??[];const{shapeSvg:c,bbox:u}=await mS(t,e,r,a,o),{labelStyles:d,nodeStyles:p}=Ct(e);e.labelStyle=d,e.cssStyles=l.styles||"";const f=((O=l.styles)==null?void 0:O.join(";"))||p||"";e.cssStyles||(e.cssStyles=f.replaceAll("!important","").split(";"));const m=l.members.length===0&&l.methods.length===0&&!((I=r.class)!=null&&I.hideEmptyMembersBox),x=xt.svg(c),g=bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Math.max(e.width??0,u.width);let b=Math.max(e.height??0,u.height);const k=(e.height??0)>u.height;l.members.length===0&&l.methods.length===0?b+=o:l.members.length>0&&l.methods.length===0&&(b+=o*2);const S=-y/2,E=-b/2;let w=m?s*2:l.members.length===0&&l.methods.length===0?-s:0;k&&(w=s*2);const T=x.rectangle(S-s,E-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0),y+2*s,b+2*s+w,g),N=c.insert(()=>T,":first-child");N.attr("class","basic label-container outer-path");const F=N.node().getBBox(),L=c.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,B=c.select(".label-group").node().getBBox().height-(m?s/2:0)||0,W=c.select(".members-group").node().getBBox().height-(m?s/2:0)||0,G=(L+B+E+s-(E-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(c.selectAll(".text").each((M,P,$)=>{var ct,st;const D=Ut($[P]),_=D.attr("transform");let R=0;if(_){const yt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(_);yt&&(R=parseFloat(yt[2]))}let X=R+E+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(D.attr("class").includes("methods-group")){const J=Math.max(W,o/2);k?X=Math.max(G,L+B+J+E+o*2+s)+o*2:X=L+B+J+E+o*4+s}l.members.length===0&&l.methods.length===0&&((ct=r.class)!=null&&ct.hideEmptyMembersBox)&&(l.annotations.length>0?X=R-o:X=R),a||(X-=4);let A=S;(D.attr("class").includes("label-group")||D.attr("class").includes("annotation-group"))&&(A=-((st=D.node())==null?void 0:st.getBBox().width)/2||0,c.selectAll("text").each(function(J,yt,Ot){window.getComputedStyle(Ot[yt]).textAnchor==="middle"&&(A=0)})),D.attr("transform",`translate(${A}, ${X})`)}),l.members.length>0||l.methods.length>0||m){const M=L+B+E+s,P=x.line(F.x,M,F.x+F.width,M+.001,g);c.insert(()=>P).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(m||l.members.length>0||l.methods.length>0){const M=L+B+W+E+o*2+s,P=x.line(F.x,k?Math.max(G,M):M,F.x+F.width,(k?Math.max(G,M):M)+.001,g);c.insert(()=>P).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(l.look!=="handDrawn"&&c.selectAll("path").attr("style",f),N.select(":nth-child(2)").attr("style",f),c.selectAll(".divider").select("path").attr("style",f),e.labelStyle?c.selectAll("span").attr("style",e.labelStyle):c.selectAll("span").attr("style",f),!a){const M=RegExp(/color\s*:\s*([^;]*)/),P=M.exec(f);if(P){const $=P[0].replace("color","fill");c.selectAll("tspan").attr("style",$)}else if(d){const $=M.exec(d);if($){const D=$[0].replace("color","fill");c.selectAll("tspan").attr("style",D)}}}return kt(e,N),e.intersect=function(M){return dt.rect(e,M)},c}v(gS,"classBox");async function xS(t,e){var F,L;const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,c=At(e),{themeVariables:u}=te(),{borderColorArray:d,requirementEdgeLabelBackground:p}=u,f=t.insert("g").attr("class",c).attr("id",e.domId??e.id);let m;l?m=await Jr(f,`&lt;&lt;${i.type}&gt;&gt;`,0,e.labelStyle):m=await Jr(f,"&lt;&lt;Element&gt;&gt;",0,e.labelStyle);let x=m;const g=await Jr(f,i.name,x,e.labelStyle+"; font-weight: bold;");if(x+=g+a,l){const B=await Jr(f,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=B;const W=await Jr(f,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=W;const G=await Jr(f,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=G,await Jr(f,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const B=await Jr(f,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=B,await Jr(f,`${s.docRef?`Doc Ref: ${s.docRef}`:""}`,x,e.labelStyle)}const y=(((F=f.node())==null?void 0:F.getBBox().width)??200)+o,b=(((L=f.node())==null?void 0:L.getBBox().height)??200)+o,k=-y/2,S=-b/2,E=xt.svg(f),w=bt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const T=E.rectangle(k,S,y,b,w),N=f.insert(()=>T,":first-child");if(N.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const B=e.colorIndex??0;f.attr("data-color-id",`color-${B%d.length}`)}if(f.selectAll(".label").each((B,W,G)=>{const O=Ut(G[W]),I=O.attr("transform");let M=0,P=0;if(I){const R=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(I);R&&(M=parseFloat(R[1]),P=parseFloat(R[2]))}const $=P-b/2;let D=k+o/2;(W===0||W===1)&&(D=M),O.attr("transform",`translate(${D}, ${$+o})`)}),x>m+g+a){const B=S+m+g+a;let W;if(e.look==="neo"){const I=[[k,B],[k+y,B],[k+y,B+.001],[k,B+.001]];W=E.polygon(I,w)}else W=E.line(k,B,k+y,B,w);f.insert(()=>W).attr("class","divider")}return kt(e,N),e.intersect=function(B){return dt.rect(e,B)},n&&e.look!=="handDrawn"&&(p||d!=null&&d.length)&&f.selectAll("path").attr("style",n),f}v(xS,"requirementBox");async function Jr(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=te(),o=s.htmlLabels??!0,a=await En(i,up(_i(e)),{width:wn(e,s)+50,classes:"markdown-node-label",useHtmlLabels:o,style:n},s);let l;if(o){const c=a.children[0],u=Ut(a);l=c.getBoundingClientRect(),u.attr("width",l.width),u.attr("height",l.height)}else{const c=a.children[0];for(const u of c.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(Jr,"addText");var SW=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 yS(t,e,{config:r}){var W,G;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:c}=await It(t,e,At(e)),u=e.padding||10;let d="",p;"ticket"in e&&e.ticket&&((W=r==null?void 0:r.kanban)!=null&&W.ticketBaseUrl)&&(d=(G=r==null?void 0:r.kanban)==null?void 0:G.ticketBaseUrl.replace("#TICKET#",e.ticket),p=a.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",d).attr("target","_blank"));const f={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1};let m,x;p?{label:m,bbox:x}=await _u(p,"ticket"in e&&e.ticket||"",f):{label:m,bbox:x}=await _u(a,"ticket"in e&&e.ticket||"",f);const{label:g,bbox:y}=await _u(a,"assigned"in e&&e.assigned||"",f);e.width=o;const b=10,k=(e==null?void 0:e.width)||0,S=Math.max(x.height,y.height)/2,E=Math.max(l.height+b*2,(e==null?void 0:e.height)||0)+S,w=-k/2,T=-E/2;c.attr("transform","translate("+(u-k/2)+", "+(-S-l.height/2)+")"),m.attr("transform","translate("+(u-k/2)+", "+(-S+l.height/2)+")"),g.attr("transform","translate("+(u+k/2-y.width-2*s)+", "+(-S+l.height/2)+")");let N;const{rx:F,ry:L}=e,{cssStyles:B}=e;if(e.look==="handDrawn"){const O=xt.svg(a),I=bt(e,{}),M=F||L?O.path(ei(w,T,k,E,F||0),I):O.rectangle(w,T,k,E,I);N=a.insert(()=>M,":first-child"),N.attr("class","basic label-container").attr("style",B||null)}else{N=a.insert("rect",":first-child"),N.attr("class","basic label-container __APA__").attr("style",i).attr("rx",F??5).attr("ry",L??5).attr("x",w).attr("y",T).attr("width",k).attr("height",E);const O="priority"in e&&e.priority;if(O){const I=a.append("line"),M=w+2,P=T+Math.floor((F??0)/2),$=T+E-Math.floor((F??0)/2);I.attr("x1",M).attr("y1",P).attr("x2",M).attr("y2",$).attr("stroke-width","4").attr("stroke",SW(O))}}return kt(e,N),e.height=E,e.intersect=function(O){return dt.rect(e,O)},a}v(yS,"kanbanItem");async function bS(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await It(t,e,At(e)),l=s.width+10*o,c=s.height+8*o,u=.15*l,{cssStyles:d}=e,p=s.width+20,f=s.height+20,m=Math.max(l,p),x=Math.max(c,f);a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`);let g;const y=`M0 0
577
- a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
578
- a${u},${u} 1 0,0 ${m*.25},0
579
- a${u},${u} 1 0,0 ${m*.25},0
580
- a${u},${u} 1 0,0 ${m*.25},${x*.1}
581
-
582
- a${u},${u} 1 0,0 ${m*.15},${x*.33}
583
- a${u*.8},${u*.8} 1 0,0 0,${x*.34}
584
- a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
585
-
586
- a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
587
- a${u},${u} 1 0,0 ${-1*m*.25},0
588
- a${u},${u} 1 0,0 ${-1*m*.25},0
589
- a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
590
-
591
- a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
592
- a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
593
- a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
594
- H0 V0 Z`;if(e.look==="handDrawn"){const b=xt.svg(i),k=bt(e,{}),S=b.path(y,k);g=i.insert(()=>S,":first-child"),g.attr("class","basic label-container").attr("style",Pe(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(b,k){return dt.rect(b,k)},e.intersect=function(b){return rt.info("Bang intersect",e,b),dt.rect(e,b)},i}v(bS,"bang");async function CS(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await It(t,e,At(e)),l=s.width+2*o,c=s.height+2*o,u=.15*l,d=.25*l,p=.35*l,f=.2*l,{cssStyles:m}=e;let x;const g=`M0 0
595
- a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
596
- a${p},${p} 1 0,1 ${l*.4},${-1*l*.1}
597
- a${d},${d} 1 0,1 ${l*.35},${l*.2}
598
-
599
- a${u},${u} 1 0,1 ${l*.15},${c*.35}
600
- a${f},${f} 1 0,1 ${-1*l*.15},${c*.65}
601
-
602
- a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
603
- a${p},${p} 1 0,1 ${-1*l*.5},0
604
- a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
605
-
606
- a${u},${u} 1 0,1 ${-1*l*.1},${-1*c*.35}
607
- a${f},${f} 1 0,1 ${l*.1},${-1*c*.65}
608
- H0 V0 Z`;if(e.look==="handDrawn"){const y=xt.svg(i),b=bt(e,{}),k=y.path(g,b);x=i.insert(()=>k,":first-child"),x.attr("class","basic label-container").attr("style",Pe(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}, ${-c/2})`),kt(e,x),e.calcIntersect=function(y,b){return dt.rect(y,b)},e.intersect=function(y){return rt.info("Cloud intersect",e,y),dt.rect(e,y)},i}v(CS,"cloud");async function kS(t,e){const{labelStyles:r,nodeStyles:n}=Ct(e);e.labelStyle=r;const{shapeSvg:i,bbox:s,halfPadding:o,label:a}=await It(t,e,At(e)),l=s.width+8*o,c=s.height+2*o,u=5,d=e.look==="neo"?`
609
- M${-l/2} ${c/2-u}
610
- v${-c+2*u}
611
- q0,-${u} ${u},-${u}
612
- h${l-2*u}
613
- q${u},0 ${u},${u}
614
- v${c-u}
615
- H${-l/2}
616
- Z
617
- `:`
618
- M${-l/2} ${c/2-u}
619
- v${-c+2*u}
620
- q0,-${u} ${u},-${u}
621
- h${l-2*u}
622
- q${u},0 ${u},${u}
623
- v${c-2*u}
624
- q0,${u} ${-u},${u}
625
- h${-(l-2*u)}
626
- q${-u},0 ${-u},${-u}
627
- Z
628
- `;if(!e.domId)throw new Error(`defaultMindmapNode: node "${e.id}" is missing a domId — was render.ts domId prefixing skipped?`);const p=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",c/2).attr("x2",l/2).attr("y2",c/2),a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),i.append(()=>a.node()),kt(e,p),e.calcIntersect=function(f,m){return dt.rect(f,m)},e.intersect=function(f){return dt.rect(e,f)},i}v(kS,"defaultMindmapNode");async function vS(t,e){const r={padding:e.padding??0};return em(t,e,r)}v(vS,"mindmapCircle");var TW=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:J2},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:K2},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:tS},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:iS},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:w2},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:em},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:bS},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:CS},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:V2},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:L2},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:R2},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:$2},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:cS},{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:D2},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:T2},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:aS},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:m2},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Z2},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:nS},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:rS},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:N2},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:B2},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:b2},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:C2},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:k2},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:z2},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:dS},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:j2},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:lS},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:W2},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:v2},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:S2},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:uS},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:pS},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:_2},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:hS},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:E2},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Q2},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:U2},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:H2},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:p2},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:y2},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:oS},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:sS},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:fS},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Y2},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:q2}],_W=v(()=>{const e=[...Object.entries({state:eS,choice:g2,note:G2,rectWithTitle:X2,labelRect:O2,iconSquare:F2,iconCircle:M2,icon:A2,iconRounded:I2,imageSquare:P2,anchor:d2,kanbanItem:yS,mindmapCircle:vS,defaultMindmapNode:kS,classBox:gS,erBox:rm,requirementBox:xS}),...TW.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),wS=_W();function EW(t){return t in wS}v(EW,"isValidShape");var bh=new Map;async function SS(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?wS[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",Pe(e.look)),e.tooltip&&i.attr("title",e.tooltip),bh.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(SS,"insertNode");var vtt=v((t,e)=>{bh.set(e.id,t)},"setNodeElem"),wtt=v(()=>{bh.clear()},"clear"),Stt=v(t=>{const e=bh.get(t.id);rt.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const r=8,n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-r)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},"positionNode"),NW=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&b0(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&b0(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),jW={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}},LW=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],b0=v((t,e,r,n,i,s,o=!1,a)=>{var m;const l=jW[r],c=l&&LW.includes(l.type);if(!l){rt.warn(`Unknown arrow type: ${r}`);return}const u=l.type,f=`${i}_${s}-${u}${e==="start"?"Start":"End"}${o&&c?"-margin":""}`;if(a&&a.trim()!==""){const x=a.replace(/[^\dA-Za-z]/g,"_"),g=`${f}_${x}`;if(!document.getElementById(g)){const y=document.getElementById(f);if(y){const b=y.cloneNode(!0);b.id=g,b.querySelectorAll("path, circle, line").forEach(S=>{S.setAttribute("stroke",a),l.fill&&S.setAttribute("fill",a)}),(m=y.parentNode)==null||m.appendChild(b)}}t.attr(`marker-${e}`,`url(${n}#${g})`)}else t.attr(`marker-${e}`,`url(${n}#${f})`)},"addEdgeMarker"),BW=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=te())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),Mc=new Map,$e=new Map,Ttt=v(()=>{Mc.clear(),$e.clear()},"clear"),vo=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),AW=v(async(t,e)=>{const r=te();let n=ir(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",c=await En(t,e.label,{style:vo(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(c),rt.info("abc82",e,e.labelType);let u=c.getBBox(),d=u;if(n){const f=c.children[0],m=Ut(c);u=f.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const f=Ut(c).select("text").node();f&&typeof f.getBBox=="function"&&(d=f.getBBox())}o.attr("transform",go(d,n)),Mc.set(e.id,s),e.width=u.width,e.height=u.height;let p;if(e.startLabelLeft){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await On(m,e.startLabelLeft,vo(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Ut(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).startLeft=f,Po(p,e.startLabelLeft)}if(e.startLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await On(m,e.startLabelRight,vo(e.labelStyle)||"",!1,!1);p=x,m.node().appendChild(x);let g=x.getBBox();if(n){const y=x.children[0],b=Ut(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).startRight=f,Po(p,e.startLabelRight)}if(e.endLabelLeft){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await On(m,e.endLabelLeft,vo(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Ut(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),f.node().appendChild(x),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).endLeft=f,Po(p,e.endLabelLeft)}if(e.endLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await On(m,e.endLabelRight,vo(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Ut(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),f.node().appendChild(x),$e.get(e.id)||$e.set(e.id,{}),$e.get(e.id).endRight=f,Po(p,e.endLabelRight)}return c},"insertEdgeLabel");function Po(t,e){ir(te())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v(Po,"setTerminalWidth");var MW=v((t,e)=>{rt.debug("Moving label abc88 ",t.id,t.label,Mc.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=te(),{subGraphTitleTotalMargin:i}=Wp(n);if(t.label){const s=Mc.get(t.id);let o=t.x,a=t.y;if(r){const l=Wr.calcLabelPosition(r);rt.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=$e.get(t.id).startLeft;let o=t.x,a=t.y;if(r){const l=Wr.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=$e.get(t.id).startRight;let o=t.x,a=t.y;if(r){const l=Wr.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=$e.get(t.id).endLeft;let o=t.x,a=t.y;if(r){const l=Wr.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=$e.get(t.id).endRight;let o=t.x,a=t.y;if(r){const l=Wr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}},"positionEdgeLabel"),IW=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"),FW=v((t,e,r)=>{rt.debug(`intersection calc abc89:
629
- outsidePoint: ${JSON.stringify(e)}
630
- insidePoint : ${JSON.stringify(r)}
631
- node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const n=t.x,i=t.y,s=Math.abs(n-r.x),o=t.width/2;let a=r.x<e.x?o-s:o+s;const l=t.height/2,c=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/c;const p={x:r.x<e.x?r.x+a:r.x-u+a,y:r.y<e.y?r.y+c-d:r.y-c+d};return a===0&&(p.x=e.x,p.y=e.y),u===0&&(p.x=e.x),c===0&&(p.y=e.y),rt.debug(`abc89 top/bottom calc, Q ${c}, q ${d}, R ${u}, r ${a}`,p),p}else{r.x<e.x?a=e.x-o-n:a=n-o-e.x;let d=c*a/u,p=r.x<e.x?r.x+u-a:r.x-u+a,f=r.y<e.y?r.y+d:r.y-d;return rt.debug(`sides calc abc89, Q ${c}, q ${d}, R ${u}, r ${a}`,{_x:p,_y:f}),a===0&&(p=e.x,f=e.y),u===0&&(p=e.x),c===0&&(f=e.y),{x:p,y:f}}},"intersection"),C0=v((t,e)=>{rt.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(rt.info("abc88 checking point",s,e),!IW(e,s)&&!i){const o=FW(e,n,s);rt.debug("abc88 inside",s,n,o),rt.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)?rt.warn("abc88 no intersect",o,r):r.push(o),i=!0}else rt.warn("abc88 outside",s,n),n=s,i||r.push(s)}),rt.debug("returning points",r),r},"cutPathAtIntersect");function TS(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(TS,"extractCornerPoints");var k0=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"),PW=v(function(t){const{cornerPointPositions:e}=TS(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=k0(i,o,5),l=k0(s,o,5),c=l.x-a.x,u=l.y-a.y;r.push(a);const d=Math.sqrt(2)*2;let p={x:o.x,y:o.y};if(Math.abs(s.x-i.x)>10&&Math.abs(s.y-i.y)>=10){rt.debug("Corner point fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));const f=5;o.x===a.x?p={x:c<0?a.x-f+d:a.x+f-d,y:u<0?a.y-d:a.y+d}:p={x:c<0?a.x-d:a.x+d,y:u<0?a.y-f+d:a.y+f-d}}else rt.debug("Corner point skipping fixing",Math.abs(s.x-i.x),Math.abs(s.y-i.y));r.push(p,l)}else r.push(t[n]);return r},"fixCorners"),DW=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"),OW=v(function(t,e,r,n,i,s,o,a=!1){var P;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:l}=te();let c=e.points,u=!1;const d=i;var p=s;const f=[];for(const $ in e.cssCompiledStyles)Sw($)||f.push(e.cssCompiledStyles[$]);rt.debug("UIO intersect check",e.points,p.x,d.x),p.intersect&&d.intersect&&!a&&(c=c.slice(1,e.points.length-1),c.unshift(d.intersect(c[0])),rt.debug("Last point UIO",e.start,"-->",e.end,c[c.length-1],p,p.intersect(c[c.length-1])),c.push(p.intersect(c[c.length-1])));const m=btoa(JSON.stringify(c));e.toCluster&&(rt.info("to cluster abc88",r.get(e.toCluster)),c=C0(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(rt.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(c,null,2)),c=C0(c.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=c.filter($=>!Number.isNaN($.y));const g=BW(e.curve);g!=="rounded"&&(x=PW(x));let y=Uo;switch(g){case"linear":y=Uo;break;case"basis":y=Td;break;case"cardinal":y=ik;break;case"bumpX":y=JC;break;case"bumpY":y=tk;break;case"catmullRom":y=ok;break;case"monotoneX":y=dk;break;case"monotoneY":y=fk;break;case"natural":y=mk;break;case"step":y=gk;break;case"stepAfter":y=yk;break;case"stepBefore":y=xk;break;case"rounded":y=Uo;break;default:y=Td}const{x:b,y:k}=A6(e),S=mR().x(b).y(k).curve(y);let E;switch(e.thickness){case"normal":E="edge-thickness-normal";break;case"thick":E="edge-thickness-thick";break;case"invisible":E="edge-thickness-invisible";break;default:E="edge-thickness-normal"}switch(e.pattern){case"solid":E+=" edge-pattern-solid";break;case"dotted":E+=" edge-pattern-dotted";break;case"dashed":E+=" edge-pattern-dashed";break;default:E+=" edge-pattern-solid"}let w,T=g==="rounded"?_S(ES(x,e),5):S(x);const N=Array.isArray(e.style)?e.style:[e.style];let F=N.find($=>$==null?void 0:$.startsWith("stroke:")),L="";e.animate&&(L="edge-animation-fast"),e.animation&&(L="edge-animation-"+e.animation);let B=!1;if(e.look==="handDrawn"){const $=xt.svg(t);Object.assign([],x);const D=$.path(T,{roughness:.3,seed:l});E+=" transition",w=Ut(D).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+E+(e.classes?" "+e.classes:"")+(L?" "+L:"")).attr("style",N?N.reduce((R,X)=>R+";"+X,""):"");let _=w.attr("d");w.attr("d",_),t.node().appendChild(w.node())}else{const $=f.join(";"),D=N?N.reduce((st,J)=>st+J+";",""):"",_=($?$+";"+D+";":D)+";"+(N?N.reduce((st,J)=>st+";"+J,""):"");w=t.append("path").attr("d",T).attr("id",`${o}-${e.id}`).attr("class"," "+E+(e.classes?" "+e.classes:"")+(L?" "+L:"")).attr("style",_),F=(P=_.match(/stroke:([^;]+)/))==null?void 0:P[1],B=e.animate===!0||!!e.animation||$.includes("animation");const R=w.node(),X=typeof R.getTotalLength=="function"?R.getTotalLength():0,A=Tx[e.arrowTypeStart]||0,ct=Tx[e.arrowTypeEnd]||0;if(e.look==="neo"&&!B){const J=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?DW(X,A,ct):`0 ${A} ${X-A-ct} ${ct}`}; stroke-dashoffset: 0;`;w.attr("style",J+w.attr("style"))}}w.attr("data-edge",!0),w.attr("data-et","edge"),w.attr("data-id",e.id),w.attr("data-points",m),w.attr("data-look",Pe(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 W="";(te().flowchart.arrowMarkerAbsolute||te().state.arrowMarkerAbsolute)&&(W=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,W=W.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),rt.info("arrowTypeStart",e.arrowTypeStart),rt.info("arrowTypeEnd",e.arrowTypeEnd);const G=!B&&(e==null?void 0:e.look)==="neo";NW(w,e,W,o,n,G,F);const O=Math.floor(c.length/2),I=c[O];Wr.isLabelCoordinateInPath(I,w.attr("d"))||(u=!0);let M={};return u&&(M.updatedPath=c),M.originalPath=e.points,M},"insertEdge");function _S(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 c=o.x-a.x,u=o.y-a.y,d=l.x-o.x,p=l.y-o.y,f=Math.hypot(c,u),m=Math.hypot(d,p);if(f<i||m<i){r+=`L${o.x},${o.y}`;continue}const x=c/f,g=u/f,y=d/m,b=p/m,k=x*y+g*b,S=Math.max(-1,Math.min(1,k)),E=Math.acos(S);if(E<i||Math.abs(Math.PI-E)<i){r+=`L${o.x},${o.y}`;continue}const w=Math.min(e/Math.sin(E/2),f/2,m/2),T=o.x-x*w,N=o.y-g*w,F=o.x+y*w,L=o.y+b*w;r+=`L${T},${N}`,r+=`Q${o.x},${o.y} ${F},${L}`}}return r}v(_S,"generateRoundedPath");function ef(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(ef,"calculateDeltaAndAngle");function ES(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&He[e.arrowTypeStart]){const i=He[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=ef(s,o),l=i*Math.cos(a),c=i*Math.sin(a);r[0].x=s.x+l,r[0].y=s.y+c}const n=t.length;if(n>=2&&He[e.arrowTypeEnd]){const i=He[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=ef(o,s),l=i*Math.cos(a),c=i*Math.sin(a);r[n-1].x=s.x-l,r[n-1].y=s.y-c}return r}v(ES,"applyMarkerOffsetsToPoints");var $W=v((t,e,r,n)=>{e.forEach(i=>{lq[i](t,r,n)})},"insertMarkers"),RW=v((t,e,r)=>{rt.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),t.append("marker").attr("id",r+"_"+e+"-extensionStart-margin").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd-margin").attr("class","marker extension "+e).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),zW=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"),WW=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"),qW=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"),HW=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"),UW=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"),GW=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"),VW=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"),YW=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"),XW=v((t,e,r)=>{const n=be(),{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"),KW=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"),ZW=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"),QW=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"),JW=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"),tq=v((t,e,r)=>{const n=be(),{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"),eq=v((t,e,r)=>{const n=be(),{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"),rq=v((t,e,r)=>{const n=be(),{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"),nq=v((t,e,r)=>{const n=be(),{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"),iq=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
632
- L20,10
633
- M20,10
634
- L0,20`)},"requirement_arrow"),sq=v((t,e,r)=>{const n=be(),{themeVariables:i}=n,{strokeWidth:s}=i;t.append("defs").append("marker").attr("id",r+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${s}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
635
- L20,10
636
- M20,10
637
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),oq=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"),aq=v((t,e,r)=>{const n=be(),{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"),lq={extension:RW,composition:zW,aggregation:WW,dependency:qW,lollipop:HW,point:UW,circle:GW,cross:VW,barb:YW,barbNeo:XW,only_one:KW,zero_or_one:ZW,one_or_more:QW,zero_or_more:JW,only_one_neo:tq,zero_or_one_neo:eq,one_or_more_neo:rq,zero_or_more_neo:nq,requirement_arrow:iq,requirement_contains:oq,requirement_arrow_neo:sq,requirement_contains_neo:aq},cq=$W,hq={common:wa,getConfig:be,insertCluster:aW,insertEdge:OW,insertEdgeLabel:AW,insertMarkers:cq,insertNode:SS,interpolateToCurve:Pp,labelHelper:It,log:rt,positionEdgeLabel:MW},da={},NS=v(t=>{for(const e of t)da[e.name]=e},"registerLayoutLoaders"),uq=v(()=>{NS([{name:"dagre",loader:v(async()=>await Jt(()=>import("./dagre-KV5264BT-HcBmaeC1.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Jt(()=>import("./cose-bilkent-S5V4N54A-CN-sdzRq.js"),__vite__mapDeps([11,10,6,7,8,9])),"loader")}])},"registerDefaultLayoutLoaders");uq();var _tt=v(async(t,e)=>{if(!(t.layoutAlgorithm in da))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=da[t.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:s}=t.config,{useGradient:o,gradientStart:a,gradientStop:l}=s,c=e.attr("id");if(e.append("defs").append("filter").attr("id",`${c}-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",`${c}-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,hq,{algorithm:r.algorithm})},"render"),Ett=v((t="",{fallback:e="dagre"}={})=>{if(t in da)return t;if(e in da)return rt.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),jS="comm",LS="rule",BS="decl",dq="@import",fq="@namespace",pq="@keyframes",mq="@layer",gq=Math.abs,Yo=String.fromCharCode;function AS(t){return t.trim()}function rf(t,e,r){return t.replace(e,r)}function us(t,e){return t.charCodeAt(e)|0}function $s(t,e,r){return t.slice(e,r)}function en(t){return t.length}function xq(t){return t.length}function hl(t,e){return e.push(t),t}var Ch=1,Rs=1,MS=0,Fr=0,Le=0,Ys="";function nm(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:Ch,column:Rs,length:o,return:"",siblings:a}}function yq(){return Le}function bq(){return Le=Fr>0?us(Ys,--Fr):0,Rs--,Le===10&&(Rs=1,Ch--),Le}function Ur(){return Le=Fr<MS?us(Ys,Fr++):0,Rs++,Le===10&&(Rs=1,Ch++),Le}function $n(){return us(Ys,Fr)}function Fl(){return Fr}function kh(t,e){return $s(Ys,t,e)}function fa(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 Cq(t){return Ch=Rs=1,MS=en(Ys=t),Fr=0,[]}function kq(t){return Ys="",t}function Nu(t){return AS(kh(Fr-1,nf(t===91?t+2:t===40?t+1:t)))}function vq(t){for(;(Le=$n())&&Le<33;)Ur();return fa(t)>2||fa(Le)>3?"":" "}function wq(t,e){for(;--e&&Ur()&&!(Le<48||Le>102||Le>57&&Le<65||Le>70&&Le<97););return kh(t,Fl()+(e<6&&$n()==32&&Ur()==32))}function nf(t){for(;Ur();)switch(Le){case t:return Fr;case 34:case 39:t!==34&&t!==39&&nf(Le);break;case 40:t===41&&nf(t);break;case 92:Ur();break}return Fr}function Sq(t,e){for(;Ur()&&t+Le!==57;)if(t+Le===84&&$n()===47)break;return"/*"+kh(e,Fr-1)+"*"+Yo(t===47?t:Ur())}function Tq(t){for(;!fa($n());)Ur();return kh(t,Fr)}function _q(t){return kq(Pl("",null,null,null,[""],t=Cq(t),0,[0],t))}function Pl(t,e,r,n,i,s,o,a,l){for(var c=0,u=0,d=o,p=0,f=0,m=0,x=1,g=1,y=1,b=0,k=0,S="",E=i,w=s,T=n,N=S;g;)switch(m=k,k=Ur()){case 40:m!=108&&us(N,d-1)==58?(b++,N+="("):N+=Nu(k);break;case 41:b--,N+=")";break;case 34:case 39:case 91:N+=Nu(k);break;case 9:case 10:case 13:case 32:if(b>0){N+=Yo(k);break}N+=vq(m);break;case 92:N+=wq(Fl()-1,7);continue;case 47:switch($n()){case 42:case 47:hl(Eq(Sq(Ur(),Fl()),e,r,l),l),(fa(m||1)==5||fa($n()||1)==5)&&en(N)&&$s(N,-1,void 0)!==" "&&(N+=" ");break;default:N+="/"}break;case 123*x:a[c++]=en(N)*y;case 125*x:case 59:case 0:if(b>0&&k){N+=Yo(k);break}switch(k){case 0:case 125:g=0;case 59+u:y==-1&&(N=rf(N,/\f/g,"")),f>0&&(en(N)-d||x===0)&&hl(f>32?w0(N+";",n,r,d-1,l):w0(rf(N," ","")+";",n,r,d-2,l),l);break;case 59:N+=";";default:if(hl(T=v0(N,e,r,c,u,i,a,S,E=[],w=[],d,s),s),k===123)if(u===0)Pl(N,e,T,T,E,s,d,a,w);else{switch(p){case 99:if(us(N,3)===110)break;case 108:if(us(N,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Pl(t,T,T,n&&hl(v0(t,T,T,0,0,i,a,S,i,E=[],d,w),w),i,w,d,a,n?E:w):Pl(N,T,T,T,[""],w,0,a,w)}}c=u=f=0,x=y=1,S=N="",d=o;break;case 58:d=1+en(N),f=m;default:if(x<1){if(k==123)--x;else if(k==125&&x++==0&&bq()==125)continue}switch(N+=Yo(k),k*x){case 38:y=u>0?1:(N+="\f",-1);break;case 44:if(b>0)break;a[c++]=(en(N)-1)*y,y=1;break;case 64:$n()===45&&(N+=Nu(Ur())),p=$n(),u=d=en(S=N+=Tq(Fl())),k++;break;case 45:m===45&&en(N)==2&&(x=0)}}return s}function v0(t,e,r,n,i,s,o,a,l,c,u,d){for(var p=i-1,f=i===0?s:[""],m=xq(f),x=0,g=0,y=0;x<n;++x)for(var b=0,k=$s(t,p+1,p=gq(g=o[x])),S=t;b<m;++b)(S=AS(g>0?f[b]+" "+k:rf(k,/&\f/g,f[b])))&&(l[y++]=S);return nm(t,e,r,i===0?LS:a,l,c,u,d)}function Eq(t,e,r,n){return nm(t,e,r,jS,Yo(yq()),$s(t,2,-2),0,n)}function w0(t,e,r,n,i){return nm(t,e,r,BS,$s(t,0,n),$s(t,n+1,-1),n,i)}function sf(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function Nq(t,e,r,n){switch(t.type){case mq:if(t.children.length)break;case dq:case fq:case BS:return t.return=t.return||t.value;case jS:return"";case pq:return t.return=t.value+"{"+sf(t.children,n)+"}";case LS:if(!en(t.value=t.props.join(",")))return""}return en(r=sf(t.children,n))?t.return=t.value+"{"+r+"}":""}var jq=nw(Object.keys,Object),Lq=Object.prototype,Bq=Lq.hasOwnProperty;function Aq(t){if(!uh(t))return jq(t);var e=[];for(var r in Object(t))Bq.call(t,r)&&r!="constructor"&&e.push(r);return e}var of=Fi(fn,"DataView"),af=Fi(fn,"Promise"),lf=Fi(fn,"Set"),cf=Fi(fn,"WeakMap"),S0="[object Map]",Mq="[object Object]",T0="[object Promise]",_0="[object Set]",E0="[object WeakMap]",N0="[object DataView]",Iq=Ii(of),Fq=Ii(ha),Pq=Ii(af),Dq=Ii(lf),Oq=Ii(cf),ui=Hs;(of&&ui(new of(new ArrayBuffer(1)))!=N0||ha&&ui(new ha)!=S0||af&&ui(af.resolve())!=T0||lf&&ui(new lf)!=_0||cf&&ui(new cf)!=E0)&&(ui=function(t){var e=Hs(t),r=e==Mq?t.constructor:void 0,n=r?Ii(r):"";if(n)switch(n){case Iq:return N0;case Fq:return S0;case Pq:return T0;case Dq:return _0;case Oq:return E0}return e});var $q="[object Map]",Rq="[object Set]",zq=Object.prototype,Wq=zq.hasOwnProperty;function j0(t){if(t==null)return!0;if(dh(t)&&(wc(t)||typeof t=="string"||typeof t.splice=="function"||Ip(t)||Fp(t)||vc(t)))return!t.length;var e=ui(t);if(e==$q||e==Rq)return!t.size;if(uh(t))return!Aq(t).length;for(var r in t)if(Wq.call(t,r))return!1;return!0}var IS="c4",qq=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),Hq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./c4Diagram-AHTNJAMY-Bo5yMBT9.js");return{diagram:e}},__vite__mapDeps([12,13,6,7,8,9,10]));return{id:IS,diagram:t}},"loader"),Uq={id:IS,detector:qq,loader:Hq},Gq=Uq,FS="flowchart",Vq=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"),Yq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-J9uyMWkp.js");return{diagram:e}},__vite__mapDeps([14,15,13,16,17,18,6,7,8,9,10]));return{id:FS,diagram:t}},"loader"),Xq={id:FS,detector:Vq,loader:Yq},Kq=Xq,PS="flowchart-v2",Zq=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"),Qq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-J9uyMWkp.js");return{diagram:e}},__vite__mapDeps([14,15,13,16,17,18,6,7,8,9,10]));return{id:PS,diagram:t}},"loader"),Jq={id:PS,detector:Zq,loader:Qq},tH=Jq,DS="er",eH=v(t=>/^\s*erDiagram/.test(t),"detector"),rH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./erDiagram-SMLLAGMA-DUT_laNT.js");return{diagram:e}},__vite__mapDeps([19,16,17,18,6,7,8,9,10]));return{id:DS,diagram:t}},"loader"),nH={id:DS,detector:eH,loader:rH},iH=nH,OS="gitGraph",sH=v(t=>/^\s*gitGraph/.test(t),"detector"),oH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-UUTBAWPF-B1jNNoiW.js");return{diagram:e}},__vite__mapDeps([20,21,22,23,8,6,7,9,4,2,10]));return{id:OS,diagram:t}},"loader"),aH={id:OS,detector:sH,loader:oH},lH=aH,$S="gantt",cH=v(t=>/^\s*gantt/.test(t),"detector"),hH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ganttDiagram-T4ZO3ILL-Cee_YjtS.js");return{diagram:e}},__vite__mapDeps([24,6,7,25,26,27,8,9,10]));return{id:$S,diagram:t}},"loader"),uH={id:$S,detector:cH,loader:hH},dH=uH,RS="info",fH=v(t=>/^\s*info/.test(t),"detector"),pH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./infoDiagram-42DDH7IO-m1jIMAlx.js");return{diagram:e}},__vite__mapDeps([28,23,8,6,7,9,4,2,10]));return{id:RS,diagram:t}},"loader"),mH={id:RS,detector:fH,loader:pH},zS="pie",gH=v(t=>/^\s*pie/.test(t),"detector"),xH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./pieDiagram-DEJITSTG-DdBjaXTu.js");return{diagram:e}},__vite__mapDeps([29,21,23,8,6,7,9,4,2,30,31,26,10]));return{id:zS,diagram:t}},"loader"),yH={id:zS,detector:gH,loader:xH},WS="quadrantChart",bH=v(t=>/^\s*quadrantChart/.test(t),"detector"),CH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./quadrantDiagram-34T5L4WZ-D_K_ZMnx.js");return{diagram:e}},__vite__mapDeps([32,25,26,27,6,7,8,9,10]));return{id:WS,diagram:t}},"loader"),kH={id:WS,detector:bH,loader:CH},vH=kH,qS="xychart",wH=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),SH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./xychartDiagram-5P7HB3ND-CLgTTXkj.js");return{diagram:e}},__vite__mapDeps([33,26,31,25,27,6,7,8,9,10]));return{id:qS,diagram:t}},"loader"),TH={id:qS,detector:wH,loader:SH},_H=TH,HS="requirement",EH=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),NH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./requirementDiagram-MS252O5E-XlROD_VH.js");return{diagram:e}},__vite__mapDeps([34,16,17,6,7,8,9,10]));return{id:HS,diagram:t}},"loader"),jH={id:HS,detector:EH,loader:NH},LH=jH,US="sequence",BH=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),AH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sequenceDiagram-FGHM5R23-D22asQ-_.js");return{diagram:e}},__vite__mapDeps([35,13,22,6,7,8,9,10]));return{id:US,diagram:t}},"loader"),MH={id:US,detector:BH,loader:AH},IH=MH,GS="class",FH=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"),PH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-6PBFFD2Q-DTItsUL2.js");return{diagram:e}},__vite__mapDeps([36,37,15,13,16,17,6,7,8,9,10]));return{id:GS,diagram:t}},"loader"),DH={id:GS,detector:FH,loader:PH},OH=DH,VS="classDiagram",$H=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"),RH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-v2-HSJHXN6E-DTItsUL2.js");return{diagram:e}},__vite__mapDeps([38,37,15,13,16,17,6,7,8,9,10]));return{id:VS,diagram:t}},"loader"),zH={id:VS,detector:$H,loader:RH},WH=zH,YS="state",qH=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"),HH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-FHFEXIEX-BnCepkBg.js");return{diagram:e}},__vite__mapDeps([39,40,16,17,1,2,3,4,6,7,8,9,10]));return{id:YS,diagram:t}},"loader"),UH={id:YS,detector:qH,loader:HH},GH=UH,XS="stateDiagram",VH=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"),YH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-QKLJ7IA2-DD_YjrTQ.js");return{diagram:e}},__vite__mapDeps([41,40,16,17,6,7,8,9,10]));return{id:XS,diagram:t}},"loader"),XH={id:XS,detector:VH,loader:YH},KH=XH,KS="journey",ZH=v(t=>/^\s*journey/.test(t),"detector"),QH=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./journeyDiagram-VCZTEJTY-BOCgv7m4.js");return{diagram:e}},__vite__mapDeps([42,15,13,30,6,7,8,9,10]));return{id:KS,diagram:t}},"loader"),JH={id:KS,detector:ZH,loader:QH},tU=JH,eU=v((t,e,r)=>{rt.debug(`rendering svg for syntax error
638
- `);const n=SR(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),vC(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"),ZS={draw:eU},rU=ZS,nU={db:{},renderer:ZS,parser:{parse:v(()=>{},"parse")}},iU=nU,QS="flowchart-elk",sU=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"),oU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-J9uyMWkp.js");return{diagram:e}},__vite__mapDeps([14,15,13,16,17,18,6,7,8,9,10]));return{id:QS,diagram:t}},"loader"),aU={id:QS,detector:sU,loader:oU},lU=aU,JS="timeline",cU=v(t=>/^\s*timeline/.test(t),"detector"),hU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./timeline-definition-GMOUNBTQ-gdlx6TEB.js");return{diagram:e}},__vite__mapDeps([43,30,6,7,8,9,10]));return{id:JS,diagram:t}},"loader"),uU={id:JS,detector:cU,loader:hU},dU=uU,tT="mindmap",fU=v(t=>/^\s*mindmap/.test(t),"detector"),pU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./mindmap-definition-QFDTVHPH-BPwx_SxA.js");return{diagram:e}},__vite__mapDeps([44,16,17,6,7,8,9,10]));return{id:tT,diagram:t}},"loader"),mU={id:tT,detector:fU,loader:pU},gU=mU,eT="kanban",xU=v(t=>/^\s*kanban/.test(t),"detector"),yU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./kanban-definition-6JOO6SKY-Fu0eFxr1.js");return{diagram:e}},__vite__mapDeps([45,15,6,7,8,9,10]));return{id:eT,diagram:t}},"loader"),bU={id:eT,detector:xU,loader:yU},CU=bU,rT="sankey",kU=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),vU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sankeyDiagram-XADWPNL6-Sl0FllYQ.js");return{diagram:e}},__vite__mapDeps([46,31,26,6,7,8,9,10]));return{id:rT,diagram:t}},"loader"),wU={id:rT,detector:kU,loader:vU},SU=wU,nT="packet",TU=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),_U=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-TYMM5635-CjfaWKT0.js");return{diagram:e}},__vite__mapDeps([47,21,23,8,6,7,9,4,2,10]));return{id:nT,diagram:t}},"loader"),EU={id:nT,detector:TU,loader:_U},iT="radar",NU=v(t=>/^\s*radar-beta/.test(t),"detector"),jU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-MMDJMWI5-WiLMNWTz.js");return{diagram:e}},__vite__mapDeps([48,21,23,8,6,7,9,4,2,10]));return{id:iT,diagram:t}},"loader"),LU={id:iT,detector:NU,loader:jU},sT="block",BU=v(t=>/^\s*block(-beta)?/.test(t),"detector"),AU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./blockDiagram-DXYQGD6D-BEbnyY6z.js");return{diagram:e}},__vite__mapDeps([49,15,5,1,2,18,6,7,8,9,10]));return{id:sT,diagram:t}},"loader"),MU={id:sT,detector:BU,loader:AU},IU=MU,oT="treeView",FU=v(t=>/^\s*treeView-beta/.test(t),"detector"),PU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-5BDNPKRD-DeMZN1_c.js");return{diagram:e}},__vite__mapDeps([50,21,22,23,8,6,7,9,4,2,10]));return{id:oT,diagram:t}},"loader"),DU={id:oT,detector:FU,loader:PU},OU=DU,aT="architecture",$U=v(t=>/^\s*architecture/.test(t),"detector"),RU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./architectureDiagram-Q4EWVU46-CYkxf4MU.js");return{diagram:e}},__vite__mapDeps([51,21,23,8,6,7,9,4,2,10]));return{id:aT,diagram:t}},"loader"),zU={id:aT,detector:$U,loader:RU},WU=zU,lT="ishikawa",qU=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),HU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-UXIWVN3A-BC7DwQNb.js");return{diagram:e}},__vite__mapDeps([52,6,7,8,9,10]));return{id:lT,diagram:t}},"loader"),UU={id:lT,detector:qU,loader:HU},cT="venn",GU=v(t=>/^\s*venn-beta/.test(t),"detector"),VU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./vennDiagram-DHZGUBPP-wy4YzhrG.js");return{diagram:e}},__vite__mapDeps([53,6,7,8,9,10]));return{id:cT,diagram:t}},"loader"),YU={id:cT,detector:GU,loader:VU},XU=YU,hT="treemap",KU=v(t=>/^\s*treemap/.test(t),"detector"),ZU=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-G4DWMVQ6-DAVSapDS.js");return{diagram:e}},__vite__mapDeps([54,17,21,23,8,6,7,9,4,2,27,31,26,10]));return{id:hT,diagram:t}},"loader"),QU={id:hT,detector:KU,loader:ZU},uT="wardley-beta",JU=v(t=>/^\s*wardley-beta/i.test(t),"detector"),tG=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./wardleyDiagram-NUSXRM2D-Ds2dLjs8.js");return{diagram:e}},__vite__mapDeps([55,21,23,8,6,7,9,4,2,10]));return{id:uT,diagram:t}},"loader"),eG={id:uT,detector:JU,loader:tG},rG=eG,L0=!1,vh=v(()=>{L0||(L0=!0,ic("error",iU,t=>t.toLowerCase().trim()==="error"),ic("---",{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("---")),ud(lU,gU,WU),ud(Gq,CU,WH,OH,iH,dH,mH,yH,LH,IH,tH,Kq,dU,lH,KH,GH,tU,vH,SU,EU,_H,IU,OU,LU,UU,QU,XU,rG))},"addDiagrams"),nG=v(async()=>{rt.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(ki).map(async([r,{detector:n,loader:i}])=>{if(i)try{md(r)}catch{try{const{diagram:s,id:o}=await i();ic(o,s,n)}catch(s){throw rt.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete ki[r],s}}}))).filter(r=>r.status==="rejected");if(e.length>0){rt.error(`Failed to load ${e.length} external diagrams`);for(const r of e)rt.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),iG="graphics-document document";function dT(t,e){t.attr("role",iG),e!==""&&t.attr("aria-roledescription",e)}v(dT,"setA11yDiagramInfo");function fT(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(fT,"addSVGa11yTitleDescription");var yi,hf=(yi=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 c,u;const n=be(),i=op(e,n);e=E9(e)+`
639
- `;try{md(i)}catch{const d=q4(i);if(!d)throw new lC(`Diagram ${i} not found.`);const{id:p,diagram:f}=await d();ic(p,f)}const{db:s,parser:o,renderer:a,init:l}=md(i);return o.parser&&(o.parser.yy=s),(c=s.clear)==null||c.call(s),l==null||l(n),r.title&&((u=s.setDiagramTitle)==null||u.call(s,r.title)),await o.parse(e),new yi(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(yi,"Diagram"),yi),B0=[],sG=v(()=>{B0.forEach(t=>{t()}),B0=[]},"attachFunctions"),oG=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function pT(t){const e=t.match(aC);if(!e)return{text:t,metadata:{}};let r=B6(e[1],{schema:L6})??{};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(pT,"extractFrontMatter");var aG=v(t=>t.replace(/\r\n?/g,`
640
- `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),lG=v(t=>{const{text:e,metadata:r}=pT(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"),cG=v(t=>{const e=Wr.detectInit(t)??{},r=Wr.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:p9(t),directive:e}},"processDirectives");function im(t){const e=aG(t),r=lG(e),n=cG(r.text),i=zp(r.config,n.directive);return t=oG(n.text),{code:t,title:r.title,config:i}}v(im,"preprocessDiagram");function mT(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(mT,"toBase64");var hG=5e4,uG="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",dG="sandbox",fG="loose",pG="http://www.w3.org/2000/svg",mG="http://www.w3.org/1999/xlink",gG="http://www.w3.org/1999/xhtml",xG="100%",yG="100%",bG="border:0;margin:0;",CG="margin:0",kG="allow-top-navigation-by-user-activation allow-popups",vG='The "iframe" tag is not supported by your browser.',wG=["foreignobject"],SG=["dominant-baseline"];function sm(t){const e=im(t);return rc(),xP(e.config??{}),e}v(sm,"processAndSetConfigs");async function gT(t,e){vh();try{const{code:r,config:n}=sm(t);return{diagramType:(await yT(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(gT,"parse");var A0=v((t,e,r=[])=>`
641
- .${t} ${e} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),TG=v((t,e=new Map)=>{let r="";if(t.themeCSS!==void 0&&(r+=`
642
- ${t.themeCSS}`),t.fontFamily!==void 0&&(r+=`
643
- :root { --mermaid-font-family: ${t.fontFamily}}`),t.altFontFamily!==void 0&&(r+=`
644
- :root { --mermaid-alt-font-family: ${t.altFontFamily}}`),e instanceof Map){const o=ir(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(a=>{j0(a.styles)||o.forEach(l=>{r+=A0(a.id,l,a.styles)}),j0(a.textStyles)||(r+=A0(a.id,"tspan",((a==null?void 0:a.textStyles)||[]).map(l=>l.replace("color","fill"))))})}return r},"createCssStyles"),_G=v((t,e,r,n)=>{const i=TG(t,r),s=PP(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return sf(_q(`${n}{${s}}`),Nq)},"createUserStyles"),EG=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=_i(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),NG=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":yG,n=mT(`<body style="${CG}">${t}</body>`);return`<iframe style="width:${xG};height:${r};${bG}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${kG}">
645
- ${vG}
646
- </iframe>`},"putIntoIFrame"),M0=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",pG);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function uf(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(uf,"sandboxedIframe");var jG=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"),LG=v(async function(t,e,r){var W,G,O,I,M,P;vh();const n=sm(e);e=n.code;const i=be();rt.debug(i),e.length>((i==null?void 0:i.maxTextSize)??hG)&&(e=uG);const s="#"+t,o="i"+t,a="#"+o,l="d"+t,c="#"+l,u=v(()=>{const D=Ut(p?a:c).node();D&&"remove"in D&&D.remove()},"removeTempElements");let d=Ut("body");const p=i.securityLevel===dG,f=i.securityLevel===fG,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),p){const $=uf(Ut(r),o);d=Ut($.nodes()[0].contentDocument.body),d.node().style.margin=0}else d=Ut(r);M0(d,t,l,`font-family: ${m}`,mG)}else{if(jG(document,t,l,o),p){const $=uf(Ut("body"),o);d=Ut($.nodes()[0].contentDocument.body),d.node().style.margin=0}else d=Ut("body");M0(d,t,l)}let x,g;try{x=await hf.fromText(e,{title:n.title})}catch($){if(i.suppressErrorRendering)throw u(),$;x=await hf.fromText("error"),g=$}const y=d.select(c).node(),b=x.type,k=y.firstChild,S=k.firstChild,E=(G=(W=x.renderer).getClasses)==null?void 0:G.call(W,e,x),w=_G(i,b,E,s),T=document.createElement("style");T.innerHTML=w,k.insertBefore(T,S);try{await x.renderer.draw(e,t,"11.14.0",x)}catch($){throw i.suppressErrorRendering?u():rU.draw(e,t,"11.14.0"),$}const N=d.select(`${c} svg`),F=(I=(O=x.db).getAccTitle)==null?void 0:I.call(O),L=(P=(M=x.db).getAccDescription)==null?void 0:P.call(M);bT(b,N,F,L),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",gG);let B=d.select(c).node().innerHTML;if(rt.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),B=EG(B,p,Tn(i.arrowMarkerAbsolute)),p){const $=d.select(c+" svg").node();B=NG(B,$)}else f||(B=Ms.sanitize(B,{ADD_TAGS:wG,ADD_ATTR:SG,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(sG(),g)throw g;return u(),{diagramType:b,svg:B,bindFunctions:x.db.bindFunctions}},"render");function xT(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),mP(e),e!=null&&e.theme&&e.theme in bn?e.themeVariables=bn[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=bn.default.getThemeVariables(e.themeVariables));const r=typeof e=="object"?pP(e):fC();sp(r.logLevel),vh()}v(xT,"initialize");var yT=v((t,e={})=>{const{code:r}=im(t);return hf.fromText(r,e)},"getDiagramFromText");function bT(t,e,r,n){dT(e,t),fT(e,r,n,e.attr("id"))}v(bT,"addA11yInfo");var Ni=Object.freeze({render:LG,parse:gT,getDiagramFromText:yT,initialize:xT,getConfig:be,setConfig:pC,getSiteConfig:fC,updateSiteConfig:gP,reset:v(()=>{rc()},"reset"),globalReset:v(()=>{rc(Is)},"globalReset"),defaultConfig:Is});sp(be().logLevel);rc(be());var BG=v((t,e,r)=>{rt.warn(t),Rp(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"),CT=v(async function(t={querySelector:".mermaid"}){try{await AG(t)}catch(e){if(Rp(e)&&rt.error(e.str),Er.parseError&&Er.parseError(e),!t.suppressErrors)throw rt.error("Use the suppressErrors option to suppress these errors"),e}},"run"),AG=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=Ni.getConfig();rt.debug(`${t?"":"No "}Callback function found`);let i;if(r)i=r;else if(e)i=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");rt.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(rt.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),Ni.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new Wr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const l of Array.from(i)){if(rt.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${s.next()}`;o=l.innerHTML,o=Dw(Wr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=Wr.detectInit(o);u&&rt.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:p}=await ST(c,o,l);l.innerHTML=d,t&&await t(c),p&&p(l)}catch(d){BG(d,a,Er.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),kT=v(function(t){Ni.initialize(t)},"initialize"),MG=v(async function(t,e,r){rt.warn("mermaid.init is deprecated. Please use run instead."),t&&kT(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await CT(n)},"init"),IG=v(async(t,{lazyLoad:e=!0}={})=>{vh(),ud(...t),e===!1&&await nG()},"registerExternalDiagrams"),vT=v(function(){if(Er.startOnLoad){const{startOnLoad:t}=Ni.getConfig();t&&Er.run().catch(e=>rt.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",vT,!1);var FG=v(function(t){Er.parseError=t},"setParseErrorHandler"),Ic=[],ju=!1,wT=v(async()=>{if(!ju){for(ju=!0;Ic.length>0;){const t=Ic.shift();if(t)try{await t()}catch(e){rt.error("Error executing queue",e)}}ju=!1}},"executeQueue"),PG=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{Ni.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;rt.error("Error parsing",a),(l=Er.parseError)==null||l.call(Er,a),o(a),n(a)})}),"performCall");Ic.push(i),wT().catch(n)}),"parse"),ST=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{Ni.render(t,e,r).then(l=>{o(l),n(l)},l=>{var c;rt.error("Error parsing",l),(c=Er.parseError)==null||c.call(Er,l),a(l),i(l)})}),"performCall");Ic.push(s),wT().catch(i)}),"render"),DG=v(()=>Object.keys(ki).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),Er={startOnLoad:!0,mermaidAPI:Ni,parse:PG,render:ST,init:MG,run:CT,registerExternalDiagrams:IG,registerLayoutLoaders:NS,initialize:kT,parseError:void 0,contentLoaded:vT,setParseErrorHandler:FG,detectType:op,registerIconPacks:I7,getRegisteredDiagramsMetadata:DG},TT=Er;/*! Check if previously processed *//*!
647
- * Wait for document loaded before starting the execution
648
- */TT.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function OG({code:t}){const e=C.useRef(null),r=C.useId(),[n,i]=C.useState(null),[s,o]=C.useState(null);return C.useEffect(()=>{let a=!1;const l=`mermaid-${r.replace(/:/g,"")}`;return TT.render(l,t).then(({svg:c})=>{a||i(c)}).catch(c=>{a||o(c.message||"Invalid diagram")}),()=>{a=!0}},[t,r]),s?h.jsx("pre",{className:"text-[11px] text-destructive bg-destructive/10 border border-destructive/20 rounded p-3 overflow-x-auto",children:`Mermaid error: ${s}
649
-
650
- ${t}`}):n?h.jsx("div",{ref:e,className:"my-3 overflow-x-auto",dangerouslySetInnerHTML:{__html:n}}):h.jsx("div",{className:"text-[11px] text-muted-foreground py-2",children:"Rendering diagram..."})}function $G({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?h.jsx(OG,{code:String(e).trim()}):h.jsx("code",{className:t,...r,children:e})}function RG(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 _T(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=_T(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function ET(t){let e=t.files.length;for(const r of t.children.values())e+=ET(r);return e}function NT({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=zG(t,e),c=r.has(l)||!!a,u=ET(t);return h.jsxs("div",{children:[h.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:[c?h.jsx(UM,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):h.jsx(Vf,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:t.name}),h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto tabular-nums shrink-0",children:u})]}),c&&h.jsxs(h.Fragment,{children:[[...t.children.values()].sort((d,p)=>d.name.localeCompare(p.name)).map(d=>h.jsx(NT,{node:d,depth:e+1,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a},d.name)),t.files.sort((d,p)=>d.name.localeCompare(p.name)).map(d=>h.jsx(jT,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function jT({file:t,depth:e,isSelected:r,isTracked:n,onSelect:i}){return h.jsxs("button",{onClick:i,className:nt("flex items-center gap-1.5 w-full px-2 py-1 text-left transition-colors rounded-sm",r?"bg-accent/10 text-accent":"hover:bg-muted/30"),style:{paddingLeft:`${e*16+4}px`},children:[h.jsx(Bi,{className:"h-3 w-3 shrink-0",style:{color:n?"hsl(var(--primary))":void 0}}),h.jsx("span",{className:nt("text-xs truncate",r?"text-accent font-medium":"text-foreground"),children:t.name}),n&&h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 ml-auto",style:{background:"hsl(var(--primary))"}})]})}function zG(t,e){return`dir-${e}-${t.name}`}function LT({items:t,selectedFile:e,onSelectedFileChange:r,previousView:n,onBack:i,featureCode:s,focusActive:o,onToggleFocus:a}){const[l,c]=C.useState([]),[u,d]=C.useState(!0),[p,f]=C.useState(null),m=e||p,x=Z=>{f(Z),r&&r(Z)},[g,y]=C.useState(null),[b,k]=C.useState(!1),[S,E]=C.useState(!1),[w,T]=C.useState(""),[N,F]=C.useState(null),[L,B]=C.useState(!1),W=C.useRef(null),[G,O]=C.useState(""),[I,M]=C.useState(()=>new Set(["dir-0-docs"])),[P,$]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),D=C.useRef(!1),_=C.useRef(null),R=C.useCallback(Z=>{Z.preventDefault(),D.current=!0;const at=Et=>{if(!D.current||!_.current)return;const Mt=_.current.getBoundingClientRect(),re=Math.min(Math.max(Et.clientX-Mt.left,160),500);$(re)},vt=()=>{D.current=!1,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",vt),$(Et=>(localStorage.setItem("compose:docsTreeWidth",Et),Et))};document.addEventListener("mousemove",at),document.addEventListener("mouseup",vt)},[]),X=S&&w!==N,A=C.useCallback(async()=>{if(!(!m||L)){B(!0);try{(await $t("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:w})})).ok&&(F(w),y(w))}catch{}B(!1)}},[m,w,L]),ct=C.useCallback(()=>{E(Z=>(!Z&&g!==null&&(T(g),F(g)),!Z))},[g]);C.useEffect(()=>{if(!S)return;const Z=at=>{(at.metaKey||at.ctrlKey)&&at.key==="s"&&(at.preventDefault(),A())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[S,A]),C.useEffect(()=>{E(!1),T(""),F(null)},[m]),C.useEffect(()=>{$t("/api/files").then(Z=>Z.json()).then(Z=>{c(Z.files||[]),d(!1);const at=new Set(["dir-0-docs"]);for(const vt of Z.files||[]){const Et=vt.split("/");Et.length>1&&at.add(`dir-1-${Et[1]}`)}M(at)}).catch(()=>d(!1))},[]),C.useEffect(()=>{if(!m){y(null);return}k(!0),$t(`/api/file?path=${encodeURIComponent(m)}`).then(Z=>Z.json()).then(Z=>{y(Z.content??null),k(!1)}).catch(()=>{y(null),k(!1)})},[m]);const st=C.useMemo(()=>!o||!s?l:l.filter(Z=>Z.includes(`features/${s}/`)),[l,o,s]),J=C.useMemo(()=>{const Z=new Set,at=vt=>vt.split("/").pop();for(const vt of t){const Et=`${vt.title||""} ${vt.description||""} ${vt.planLink||""}`.toLowerCase();for(const Mt of st)(Et.includes(Mt.toLowerCase())||Et.includes(at(Mt).replace(".md","").toLowerCase()))&&Z.add(Mt)}return Z},[t,st]),yt=C.useMemo(()=>RG(st),[st]),Ot=C.useMemo(()=>_T(yt,G),[yt,G]),lt=C.useCallback(Z=>{M(at=>{const vt=new Set(at);return vt.has(Z)?vt.delete(Z):vt.add(Z),vt})},[]);return u?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading docs..."})}):h.jsxs("div",{ref:_,className:"flex-1 flex min-h-0",children:[h.jsxs("div",{className:"shrink-0 flex flex-col min-h-0",style:{width:`${P}px`},children:[h.jsxs("div",{className:"px-2 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:h.jsx(ka,{featureCode:s,active:o,onToggle:a})}),h.jsxs("div",{className:"relative",children:[h.jsx(Zn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Xc,{placeholder:"Search files...",value:G,onChange:Z=>O(Z.target.value),className:"h-7 pl-7 pr-7 text-xs"}),G&&h.jsx("button",{onClick:()=>O(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h.jsx(ln,{className:"h-3 w-3"})})]}),h.jsxs("div",{className:"flex items-center justify-between mt-1.5 px-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[st.length," files"]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[st.length-J.size," untracked"]})]})]}),h.jsx(Hn,{className:"flex-1",children:h.jsxs("div",{className:"py-1",children:[[...Ot.children.values()].sort((Z,at)=>Z.name.localeCompare(at.name)).map(Z=>h.jsx(NT,{node:Z,depth:0,expandedDirs:I,onToggleDir:lt,selectedFile:m,onSelectFile:x,trackedPaths:J,searchQuery:G},Z.name)),Ot.files.sort((Z,at)=>Z.name.localeCompare(at.name)).map(Z=>h.jsx(jT,{file:Z,depth:0,isSelected:m===Z.path,isTracked:J.has(Z.path),onSelect:()=>x(Z.path)},Z.path))]})})]}),h.jsx("div",{onMouseDown:R,className:"w-1 shrink-0 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors",style:{background:"hsl(var(--border))"}}),h.jsx("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:m?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"px-4 py-2 shrink-0 flex items-center gap-2",style:{borderBottom:"1px solid hsl(var(--border))"},children:[n&&i&&h.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:[h.jsx(kM,{className:"h-3 w-3"}),"Back to ",n.charAt(0).toUpperCase()+n.slice(1)]}),h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:m}),X&&h.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"}),J.has(m)&&h.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"}),S&&h.jsxs("button",{onClick:A,disabled:L||!X,className:nt("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",X?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[h.jsx(xI,{className:"h-3 w-3"}),L?"Saving...":"Save"]}),h.jsx("button",{onClick:ct,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors px-1.5 py-0.5 rounded hover:bg-muted/50",title:S?"Preview":"Edit",disabled:g===null,children:S?h.jsx(i1,{className:"h-3.5 w-3.5"}):h.jsx(a1,{className:"h-3.5 w-3.5"})})]}),b?h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):g!==null&&S?h.jsx("textarea",{ref:W,value:w,onChange:Z=>T(Z.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?h.jsx(Hn,{className:"flex-1",children:h.jsx("div",{className:"px-6 py-4 max-w-3xl",children:h.jsx("article",{className:`prose prose-sm prose-invert max-w-none
651
- prose-headings:text-foreground prose-p:text-muted-foreground
652
- prose-a:text-accent prose-strong:text-foreground
653
- prose-code:text-accent prose-code:bg-muted prose-code:px-1 prose-code:rounded
654
- prose-pre:bg-muted prose-pre:border prose-pre:border-border
655
- prose-li:text-muted-foreground prose-table:text-xs
656
- prose-th:text-foreground prose-td:text-muted-foreground
657
- prose-hr:border-border`,children:h.jsx(Rf,{remarkPlugins:[Hf],components:{code:$G},children:g})})})}):h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Could not load file"})})]}):h.jsx("div",{className:"flex-1 flex items-center justify-center",children:h.jsxs("div",{className:"text-center",children:[h.jsx(Bi,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/30"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a file to preview"}),h.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Markdown files from the project docs/ directory"})]})})})]})}const WG=d1("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Rt=C.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},s)=>{const o=n?fF:"button";return h.jsx(o,{className:nt(WG({variant:e,size:r,className:t})),ref:s,...i})});Rt.displayName="Button";class qG{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=b=>{if(b=this.postProcess(b,n),i){setTimeout(function(){i(b)},0);return}else return b},a=r.length,l=e.length;let c=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,p=Date.now()+d,f=[{oldPos:-1,lastComponent:void 0}];let m=this.extractCommon(f[0],r,e,0,n);if(f[0].oldPos+1>=l&&m+1>=a)return o(this.buildValues(f[0].lastComponent,r,e));let x=-1/0,g=1/0;const y=()=>{for(let b=Math.max(x,-c);b<=Math.min(g,c);b+=2){let k;const S=f[b-1],E=f[b+1];S&&(f[b-1]=void 0);let w=!1;if(E){const N=E.oldPos-b;w=E&&0<=N&&N<a}const T=S&&S.oldPos+1<l;if(!w&&!T){f[b]=void 0;continue}if(!T||w&&S.oldPos<E.oldPos?k=this.addToPath(E,!0,!1,0,n):k=this.addToPath(S,!1,!0,1,n),m=this.extractCommon(k,r,e,b,n),k.oldPos+1>=l&&m+1>=a)return o(this.buildValues(k.lastComponent,r,e))||!0;f[b]=k,k.oldPos+1>=l&&(g=Math.min(g,b-1)),m+1>=a&&(x=Math.max(x,b+1))}c++};if(i)(function b(){setTimeout(function(){if(c>u||Date.now()>p)return i(void 0);y()||b()},0)})();else for(;c<=u&&Date.now()<=p;){const b=y();if(b)return b}}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,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(n[l+1],r[c+1],s);)c++,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,c}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,c=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(n.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let d=r.slice(l,l+u.count);d=d.map(function(p,f){const m=n[c+f];return m.length>p.length?m:p}),u.value=this.join(d)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}}class HG extends qG{constructor(){super(...arguments),this.tokenize=VG}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
658
- `))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
659
- `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
660
- `)&&(e=e.slice(0,-1)),r.endsWith(`
661
- `)&&(r=r.slice(0,-1))),super.equals(e,r,n)}}const UG=new HG;function GG(t,e,r){return UG.diff(t,e,r)}function VG(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
662
- `));const r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){const s=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}function om({oldText:t,newText:e}){const[r,n]=C.useState(!1),{parts:i,addCount:s,removeCount:o}=C.useMemo(()=>{if(!t||!e)return{parts:[],addCount:0,removeCount:0};const a=GG(t,e);let l=0,c=0;for(const u of a){const d=u.value.split(`
663
- `).filter(p=>p!=="").length;u.added&&(l+=d),u.removed&&(c+=d)}return{parts:a,addCount:l,removeCount:c}},[t,e]);return!t||!e?null:s===0&&o===0?h.jsx("span",{className:"text-[9px] text-muted-foreground/50 italic",children:"No changes"}):r?h.jsxs("div",{className:"mt-1.5",children:[h.jsx("button",{onClick:()=>n(!1),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors mb-1",children:"Hide changes"}),h.jsx("div",{className:"rounded border border-border bg-muted/30 overflow-x-auto max-h-[300px] overflow-y-auto",children:h.jsx("pre",{className:"text-[10px] font-mono leading-relaxed",children:i.map((a,l)=>{const c=a.value.split(`
664
- `);return c[c.length-1]===""&&c.pop(),c.map((u,d)=>h.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:[h.jsx("span",{className:"inline-block w-3 text-muted-foreground/40 select-none mr-1",children:a.added?"+":a.removed?"-":" "}),u||" "]},`${l}-${d}`))})})})]}):h.jsxs("button",{onClick:()=>n(!0),className:"text-[9px] text-blue-400 hover:text-blue-300 transition-colors",children:["Show changes (+",s," -",o,")"]})}function BT(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 YG({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=zy[t.fromPhase];return e.exists?h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r&&h.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&&h.jsxs("span",{className:"text-amber-400",children:[" (missing: ",e.sections.missing.join(", "),")"]}),!e.meetsMinWordCount&&h.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}):h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[r??"Artifact"," not found"]})}function XG(t){var f;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,c=((f=s==null?void 0:s.missing)==null?void 0:f.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(c>0)return{sentence:`Missing ${c} section${c>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 KG({gate:t}){const e=XG(t);if(!e)return null;const r=e.outcome==="approve";return h.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 I0({title:t,count:e,color:r,children:n}){return h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:r}}),h.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:t}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:e})]}),n]})}function ZG({gate:t,item:e,priorRevision:r,isExpanded:n,expandedAction:i,onExpand:s,onResolve:o,onSelect:a}){const[l,c]=C.useState(""),u=()=>{o(t.id,"revised",l||void 0),s(null,null),c("")},d=()=>{l.trim()&&(o(t.id,"killed",l),s(null,null),c(""))};return h.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent hover:bg-muted/50 transition-colors",children:[h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[h.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"}),h.jsx("p",{className:"text-[10px] text-muted-foreground",children:kn[t.stepId]??`${Se[t.fromPhase]??t.fromPhase} → ${Se[t.toPhase]??t.toPhase}`}),h.jsx(YG,{gate:t}),r?h.jsxs("div",{className:"space-y-1",children:[h.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&&h.jsx("div",{className:"px-2",children:h.jsx(om,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:BT(t.createdAt)})]}),h.jsx("div",{className:"mt-1.5",children:h.jsx(KG,{gate:t})}),h.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[h.jsx(Rt,{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"}),h.jsx(Rt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",n&&i==="revise"&&"bg-amber-400/10"),onClick:()=>{n&&i==="revise"?s(null,null):(s(t.id,"revise"),c(""))},children:"Revise"}),h.jsx(Rt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",n&&i==="kill"&&"bg-destructive/10"),onClick:()=>{n&&i==="kill"?s(null,null):(s(t.id,"kill"),c(""))},children:"Kill"})]}),n&&h.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[h.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:p=>c(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(i==="revise"?u():i==="kill"&&d()),p.key==="Escape"&&s(null,null)},autoFocus:!0}),h.jsx(Rt,{variant:"outline",size:"sm",className:"h-6 text-[10px]",disabled:i==="kill"&&!l.trim(),onClick:i==="revise"?u:d,children:i==="revise"?"Submit":"Confirm Kill"})]})]})}function QG(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function JG({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=QG(t);return h.jsxs("div",{className:"px-3 py-2 border-l-2 border-l-transparent",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:(e==null?void 0:e.title)??"Unknown"}),h.jsx(er,{variant:"outline",className:nt("text-[10px] px-1.5 py-0 h-4",n.color,n.border),children:t.outcome}),i!=="human"&&h.jsx("span",{className:"text-[9px] px-1 py-0 rounded bg-muted text-muted-foreground",children:i}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:BT(t.resolvedAt)})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:kn[t.stepId]??`${Se[t.fromPhase]??t.fromPhase} → ${Se[t.toPhase]??t.toPhase}`}),t.comment&&h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function AT({gates:t,items:e,onResolve:r,onSelect:n,featureCode:i,focusActive:s,onToggleFocus:o}){const[a,l]=C.useState(null),[c,u]=C.useState(null),d=C.useMemo(()=>{if(!s||!i)return t;const k=new Set(e.filter(S=>{var E;return S.featureCode===i||((E=S.lifecycle)==null?void 0:E.featureCode)===i}).map(S=>S.id));return t.filter(S=>k.has(S.itemId))},[t,e,s,i]),p=(k,S)=>{l(k),u(S)},{pending:f,resolved:m,priorRevisions:x}=C.useMemo(()=>{const k=[],S=[];for(const w of d)w.status==="pending"?k.push(w):w.resolvedAt&&S.push(w);k.sort((w,T)=>new Date(w.createdAt)-new Date(T.createdAt)),S.sort((w,T)=>new Date(T.resolvedAt)-new Date(w.resolvedAt));const E=new Map;for(const w of k){const T=S.find(N=>N.stepId===w.stepId&&N.itemId===w.itemId&&(N.outcome==="revised"||N.outcome==="revise")&&N.comment);T&&E.set(w.id,{comment:T.comment,priorSnapshot:T.artifactSnapshot||null,currentSnapshot:w.artifactSnapshot||null})}return{pending:k,resolved:S,priorRevisions:E}},[d]),[g,y]=C.useState(!1),b=C.useMemo(()=>new Map(e.map(k=>[k.id,k])),[e]);return h.jsxs("div",{className:"flex-1 overflow-auto flex flex-col",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0",children:[h.jsx(ka,{featureCode:i,active:s,onToggle:o}),h.jsx("span",{className:"text-xs font-medium text-foreground",children:"Gates"}),f.length>0?h.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:[f.length," pending"]}):h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No gates pending"}),m.length>0&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["· ",m.length," resolved"]})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[f.length>0&&h.jsx(I0,{title:"Pending",count:f.length,color:"#f59e0b",children:f.map(k=>h.jsx(ZG,{gate:k,item:b.get(k.itemId),priorRevision:x.get(k.id),isExpanded:a===k.id,expandedAction:a===k.id?c:null,onExpand:p,onResolve:r,onSelect:n},k.id))}),m.length>0&&h.jsxs(I0,{title:"History",count:m.length,color:"#22c55e",children:[(g?m.slice(0,50):m.slice(0,10)).map(k=>h.jsx(JG,{gate:k,item:b.get(k.itemId)},k.id)),m.length>10&&!g&&h.jsxs("button",{className:"w-full px-3 py-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>y(!0),children:["Show all ",m.length," resolved gates"]})]}),f.length===0&&m.length===0&&h.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No gates pending."})]})]})}function MT({event:t,items:e,onNavigate:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(null);if(C.useEffect(()=>{if(!t)return;o(t),i(!0);const u=setTimeout(()=>i(!1),5e3);return()=>clearTimeout(u)},[t]),!n||!s)return null;const a=e.find(u=>u.id===s.itemId),l=(a==null?void 0:a.title)??"Unknown",c=s.type==="pending"?`Gate pending: ${Zo(s,a)}`:`Gate ${s.outcome}: ${l}`;return h.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:c})}function tV({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=C.useContext(Yc),i=r.has(t.id)?"vision-entering":n.has(t.id)?"vision-updated":"",[s,o]=C.useState(!1),[a,l]=C.useState(""),c=t.status==="complete"||t.status==="killed",{baseDesc:u,resolution:d}=C.useMemo(()=>{if(!t.description)return{baseDesc:"",resolution:""};const x=`
665
-
666
- ---
667
- Resolution:`,g=t.description.indexOf(x);return g===-1?{baseDesc:t.description,resolution:""}:{baseDesc:t.description.slice(0,g).trim(),resolution:t.description.slice(g+x.length).trim()}},[t.description]),p=C.useCallback(async()=>{const g=`Be brief. Summarize, give your recommendation, refine the decision wording based on the resolution if needed: ${t.description||t.title}
668
- `;try{await fetch("http://localhost:4002/api/terminal/inject",{method:"POST",headers:Do({"Content-Type":"application/json"}),body:JSON.stringify({text:g})});const y=document.querySelector(".xterm-helper-textarea");y&&y.focus()}catch(y){console.error("Failed to inject into terminal:",y)}},[t]),f=C.useCallback(()=>{const x=a.trim()?`${t.description||""}
669
-
670
- ---
671
- Resolution: ${a.trim()}`:t.description;e(t.id,{status:"complete",description:x}),o(!1),l("")},[t.id,t.description,a,e]),m=C.useCallback(()=>{e(t.id,{status:"killed"})},[t.id,e]);return h.jsxs("div",{className:nt("rounded-lg border p-3 space-y-2 transition-all",c?"border-border/50 bg-muted/20 opacity-60":"border-border bg-muted/30",i),children:[h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("div",{className:"w-2 h-2 rounded-full shrink-0 mt-1.5",style:{background:c?"hsl(var(--muted-foreground))":mr.question}}),h.jsx("p",{className:nt("text-sm font-medium leading-snug flex-1",c?"text-muted-foreground line-through":"text-foreground"),children:t.title})]}),u&&h.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed pl-4",children:u}),d&&h.jsxs("div",{className:nt("ml-4 pl-3 border-l-2 border-success/40 py-1",n.has(t.id)&&"resolution-sparkle"),children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-0.5",children:"Resolution"}),h.jsx("p",{className:"text-xs text-foreground leading-relaxed",children:d})]}),s&&h.jsxs("div",{className:"ml-4 flex items-center gap-1.5",children:[h.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"&&f(),x.key==="Escape"&&o(!1)},autoFocus:!0}),h.jsx(Rt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:f,children:h.jsx(Yf,{className:"h-3 w-3"})}),h.jsx(Rt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>o(!1),children:h.jsx(ln,{className:"h-3 w-3"})})]}),!c&&!s&&h.jsxs("div",{className:"flex items-center gap-1.5 pl-4",children:[h.jsxs("button",{onClick:p,className:"text-[10px] px-2 py-0.5 rounded-md text-accent hover:bg-accent/10 flex items-center gap-1 transition-colors",children:[h.jsx(Gc,{className:"h-2.5 w-2.5"})," Discuss"]}),h.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:[h.jsx(ba,{className:"h-2.5 w-2.5"})," Resolve"]}),h.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:[h.jsx(DM,{className:"h-2.5 w-2.5"})," Dismiss"]})]}),c&&h.jsx("div",{className:"pl-4",children:h.jsx("span",{className:nt("text-[10px] px-1.5 py-0.5 rounded-full",t.status==="complete"?"bg-success/10 text-success":"bg-muted text-muted-foreground"),children:t.status==="complete"?"Resolved":"Dismissed"})})]})}function IT({item:t,items:e,connections:r,onUpdate:n,onClose:i}){const[s,o]=C.useState(null),[a,l]=C.useState(null),[c,u]=C.useState(""),d=C.useRef(null),p=C.useMemo(()=>{const x=new Map(e.map(y=>[y.id,y])),g=[];for(const y of r)if(y.type==="contradicts"){if(y.toId===t.id){const b=x.get(y.fromId);b&&g.push(b)}if(y.fromId===t.id){const b=x.get(y.toId);b&&g.push(b)}}return g.sort((y,b)=>{const k=new Date(y.createdAt||0).getTime();return new Date(b.createdAt||0).getTime()-k}),g},[t.id,e,r]),f=p.filter(x=>x.status!=="complete"&&x.status!=="killed").length;C.useEffect(()=>{if(!(!s||a!=="running"))return d.current=setInterval(async()=>{try{const x=await $t(`http://localhost:4001/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=C.useCallback(async()=>{if(a==="running")return;const x=t.description?`
672
- Description: ${t.description}`:"",g=["Challenge the assumptions of this item and create counter-questions.","",`Item: "${t.title}" (type: ${t.type}, status: ${t.status})${x}`,"","Create 2-3 challenging questions that probe weaknesses, missing considerations, or alternative approaches. For each question, run:",`node scripts/vision-track.mjs create "<your question>" --type question --phase ${t.phase||"vision"} --description "<why this matters>" --connects-to ${t.id}:contradicts`,"","Be specific and constructive. Challenge the idea, not the person.","Only run the vision-track.mjs commands above. Do not do anything else."].join(`
673
- `);l("running");try{const y=await $t("http://localhost:4001/api/agent/spawn",{method:"POST",headers:Do({"Content-Type":"application/json"}),body:JSON.stringify({prompt:g})});if(!y.ok){const k=await y.json().catch(()=>({}));l("failed"),u(k.error||"Failed to spawn agent");return}const b=await y.json();o(b.agentId)}catch(y){l("failed"),u(y.message)}},[t,a]);return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:i}),h.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:[h.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3 border-b border-border shrink-0",children:[h.jsx(Vl,{className:"h-5 w-5 text-amber-400 shrink-0 mt-0.5"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Pressure Test"}),h.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t.title})]}),h.jsx(Rt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:i,children:h.jsx(ln,{className:"h-3.5 w-3.5"})})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-3",children:[a==="running"&&h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-accent/10 border border-accent/20",children:[h.jsx(o1,{className:"h-3.5 w-3.5 text-accent animate-spin"}),h.jsx("span",{className:"text-xs text-accent",children:"Generating challenges..."})]}),a==="failed"&&h.jsx("div",{className:"px-3 py-2 rounded-lg bg-destructive/10 border border-destructive/20",children:h.jsxs("span",{className:"text-xs text-destructive",children:["Failed: ",c]})}),p.length===0&&!a?h.jsxs("div",{className:"text-center py-8",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No challenges yet."}),h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Run a pressure test to generate counter-questions."})]}):p.map(x=>h.jsx(tV,{item:x,onUpdate:n},x.id))]}),h.jsxs("div",{className:"flex items-center justify-between p-4 pt-3 border-t border-border shrink-0",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:f>0?`${f} open / ${p.length} total`:p.length>0?`${p.length} resolved`:"No challenges"}),h.jsxs(Rt,{size:"sm",className:nt("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[h.jsx(Vl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const eV=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],rV=["gate","flag","skip"],nV=["light","dark","system"],F0=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function wo({title:t,children:e}){return h.jsxs("div",{className:"mb-6",children:[h.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:t}),e]})}function Gi({label:t,children:e}){return h.jsxs("div",{className:"flex items-center justify-between py-1.5 px-1",children:[h.jsx("label",{className:"text-sm text-foreground",children:t}),e]})}function iV({value:t,className:e,onCommit:r}){const[n,i]=C.useState(t||"");return C.useEffect(()=>{i(t||"")},[t]),h.jsx("input",{type:"text",className:e,value:n,onChange:s=>i(s.target.value),onBlur:()=>{n.trim()&&n.trim()!==t&&r(n.trim())}})}function FT({settings:t,onSettingsChange:e,onReset:r}){var p,f,m,x,g,y;if(!t)return h.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."});const n=C.useCallback((b,k)=>{const S=k==="null"?null:k;e({policies:{[b]:S}})},[e]),i=C.useCallback((b,k)=>{const S=parseInt(k,10);S>=1&&S<=100&&e({iterations:{[b]:{maxIterations:S}}})},[e]),s=C.useCallback((b,k)=>{k.trim()&&e({models:{[b]:k.trim()}})},[e]),o=C.useCallback(b=>{if(e({ui:{theme:b}}),b==="system"){const k=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",k),localStorage.removeItem("compose:theme")}else document.documentElement.classList.toggle("dark",b==="dark"),localStorage.setItem("compose:theme",b)},[e]),a=C.useCallback(b=>{e({ui:{defaultView:b}})},[e]),l=C.useCallback(b=>{e({capabilities:{enforcement:b}})},[e]),c=C.useCallback(()=>{window.confirm("Reset all settings to defaults?")&&r()},[r]),u="h-7 text-xs rounded-md border border-input bg-background px-2 py-1",d="h-7 text-xs rounded-md border border-input bg-background px-2 py-1 w-24";return h.jsxs("div",{className:"flex-1 overflow-auto p-6 max-w-2xl",children:[h.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Settings"}),h.jsx(wo,{title:"Phase Policies",children:eV.map(b=>h.jsx(Gi,{label:Se[b]||b,children:h.jsxs("select",{className:u,value:t.policies[b]===null?"null":t.policies[b]||"skip",onChange:k=>n(b,k.target.value),children:[b==="explore_design"&&h.jsx("option",{value:"null",children:"—"}),rV.map(k=>h.jsx("option",{value:k,children:k},k))]})},b))}),h.jsxs(wo,{title:"Iteration Limits",children:[h.jsx(Gi,{label:"Review max iterations",children:h.jsx("input",{type:"number",className:d,min:1,max:100,value:((f=(p=t.iterations)==null?void 0:p.review)==null?void 0:f.maxIterations)??10,onChange:b=>i("review",b.target.value)})}),h.jsx(Gi,{label:"Coverage max iterations",children:h.jsx("input",{type:"number",className:d,min:1,max:100,value:((x=(m=t.iterations)==null?void 0:m.coverage)==null?void 0:x.maxIterations)??15,onChange:b=>i("coverage",b.target.value)})})]}),h.jsx(wo,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var k;return h.jsx(Gi,{label:b,children:h.jsx(iV,{className:d+" w-48",value:((k=t.models)==null?void 0:k[b])||"",onCommit:S=>s(b,S)},b)},b)})}),h.jsxs(wo,{title:"Appearance",children:[h.jsx(Gi,{label:"Theme",children:h.jsx("select",{className:u,value:((g=t.ui)==null?void 0:g.theme)||"system",onChange:b=>o(b.target.value),children:nV.map(b=>h.jsx("option",{value:b,children:b},b))})}),h.jsx(Gi,{label:"Default view",children:h.jsx("select",{className:u,value:F0.includes((y=t.ui)==null?void 0:y.defaultView)?t.ui.defaultView:"graph",onChange:b=>a(b.target.value),children:F0.map(b=>h.jsx("option",{value:b,children:b},b))})})]}),h.jsx(wo,{title:"Capability Enforcement",children:h.jsxs("div",{className:"space-y-2 px-1",children:[[{value:"log",label:"Log (default)"},{value:"block",label:"Block"}].map(({value:b,label:k})=>{var S;return h.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[h.jsx("input",{type:"radio",name:"enforcement",value:b,checked:(((S=t.capabilities)==null?void 0:S.enforcement)??"log")===b,onChange:()=>l(b),className:"accent-accent"}),h.jsx("span",{className:"text-sm text-foreground",children:k})]},b)}),h.jsx("p",{className:"text-[11px] text-muted-foreground pt-1",children:"Block stops the build on disallowed tool use; Log records but continues."})]})}),h.jsx("button",{onClick:c,className:"text-xs text-destructive hover:underline mt-2",children:"Reset to Defaults"})]})}function sV({icon:t=ZM,title:e,description:r,action:n,onAction:i,className:s}){return h.jsxs("div",{className:nt("flex flex-col items-center justify-center gap-3 p-8 text-center",s),children:[h.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-muted/50",children:h.jsx(t,{className:"w-6 h-6 text-muted-foreground/60"})}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:e}),r&&h.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),n&&h.jsx(Rt,{variant:"outline",size:"sm",onClick:i,children:n})]})}function oV(){const[t,e]=C.useState([]),[r,n]=C.useState(!0),[i,s]=C.useState(null);C.useEffect(()=>{$t("/api/pipeline/templates").then(a=>a.json()).then(a=>{e(a.templates||[]),n(!1)}).catch(()=>n(!1))},[]);const o=async a=>{s(a);try{await $t("/api/pipeline/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateId:a})})}catch(l){console.error("[TemplateSelector] Failed to create draft:",l)}s(null)};return r?h.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[h.jsx(o1,{className:"w-4 h-4 animate-spin mr-2"}),"Loading templates..."]}):t.length===0?h.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"No pipeline templates found"}):h.jsxs("div",{className:"p-4 space-y-3",children:[h.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Choose a pipeline template"}),h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(a=>h.jsxs("button",{onClick:()=>o(a.id),disabled:i!==null,className:nt("flex flex-col gap-2 p-3 rounded-lg border text-left transition-all","hover:ring-1 hover:ring-accent/50",i===a.id&&"opacity-60",cE[a.category]||"border-border bg-card"),children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Bi,{className:"w-4 h-4 shrink-0"}),h.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.label})]}),h.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:a.description}),h.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground mt-auto",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(JM,{className:"w-3 h-3"})," ",a.steps," steps"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(n1,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),h.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function PT({activeBuild:t,pipelineDraft:e,onSelectStep:r,onRefresh:n}){const[i,s]=C.useState(null),[o,a]=C.useState(!1),[l,c]=C.useState(!1),u=k=>{const S=i===k?null:k;s(S),r&&r(S)},d=()=>{n&&n()},p=async()=>{if(e!=null&&e.draftId){a(!0);try{await $t("/api/pipeline/draft/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})})}catch(k){console.error("[PipelineView] Approve failed:",k)}a(!1)}},f=async()=>{if(e!=null&&e.draftId){c(!0);try{await $t("/api/pipeline/draft/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draftId:e.draftId})})}catch(k){console.error("[PipelineView] Reject failed:",k)}c(!1)}};if(!t&&!e)return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pipeline Templates"}),h.jsx("div",{className:"ml-auto",children:h.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:[h.jsx(Gl,{className:"w-3 h-3"})," Refresh"]})})]}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(oV,{})})]});if(e){const k=e.steps||[],S=e.metadata||{};return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Draft Review"}),h.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[h.jsxs("button",{onClick:f,disabled:l||o,className:nt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-red-400 border-red-500/30 hover:bg-red-500/10",l&&"opacity-60"),children:[h.jsx(ln,{className:"w-3 h-3"})," Reject"]}),h.jsxs("button",{onClick:p,disabled:o||l,className:nt("flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border","text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/10",o&&"opacity-60"),children:[h.jsx(ba,{className:"w-3 h-3"})," Approve"]})]})]}),h.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:[h.jsxs("span",{className:"text-amber-400 font-medium",children:["Draft: ",S.label||S.id||"Pipeline"]}),h.jsx("span",{className:"text-muted-foreground ml-2",children:S.description||""}),S.category&&h.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",S.category]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-3",children:h.jsx("div",{className:"space-y-1",children:k.map((E,w)=>h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-slate-800/40 bg-card",children:[h.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:w+1}),h.jsx("span",{className:"text-xs text-foreground",children:E.id}),E.agent&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:E.agent}),E.function&&h.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",E.function]})]},E.id||w))})})]})}const m=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(k=>[k.id,k.status])):{},x=(t==null?void 0:t.currentStepId)??null,g=Array.isArray(t==null?void 0:t.steps)?Object.fromEntries(t.steps.map(k=>[k.id,k])):{},y=Mh.map(k=>{const S=g[k.id];return S?{...k,...S}:k});if(t!=null&&t.steps)for(const k of t.steps)Mh.find(S=>S.id===k.id)||y.push({id:k.id,name:k.id.replace(/_/g," "),agent:"claude",phase:"implementation",...k});const b=Object.keys(mm).map(k=>({phase:k,config:mm[k],steps:y.filter(S=>S.phase===k)}));return h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border shrink-0 h-9",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ul,{icon:ls,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),h.jsx(ul,{icon:Gf,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),h.jsx(ul,{icon:Xf,color:"text-slate-300 bg-slate-500/10",label:"Human"}),h.jsx(ul,{icon:qs,color:"text-amber-400 bg-amber-500/10",label:"Gate"})]}),h.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t&&h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Live: ",h.jsx("span",{className:"text-blue-400 font-medium",children:t.featureCode})]}),h.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:[h.jsx(Gl,{className:"w-3 h-3"})," Refresh"]})]})]}),t&&h.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:[h.jsxs("span",{className:"text-blue-400 font-medium",children:["Active Build: ",t.featureCode]}),h.jsxs("span",{className:"text-muted-foreground ml-2",children:["status: ",t.status," · step ",t.stepNum??"?","/",t.totalSteps??Mh.length]}),x&&h.jsxs("span",{className:"text-foreground ml-2",children:["· Current: ",h.jsx("span",{className:"font-medium",children:x})]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:b.map(({phase:k,config:S,steps:E})=>h.jsxs("div",{className:nt("rounded-lg border p-3",S.color),children:[h.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:S.label}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map((w,T)=>{const N=m[w.id]??null,F=w.id===x,L=w.id===i;return h.jsxs(Vt.Fragment,{children:[h.jsx(aV,{step:w,liveStatus:N,isCurrent:F,isSelected:L,onClick:()=>u(w.id)}),T<E.length-1&&h.jsx(Jb,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},w.id)})})]},k))})]})}function aV({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?qs:t.agent==="claude"?ls:t.agent==="codex"?Gf:Xf,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 h.jsxs("button",{onClick:i,className:nt("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border text-left transition-all min-w-[120px]",n?"border-accent/80 bg-accent/10":o,t.hasGate&&!e&&"border-amber-500/30 bg-amber-500/5",r&&"ring-1 ring-blue-400/40"),children:[h.jsx("div",{className:nt("w-5 h-5 rounded flex items-center justify-center shrink-0",t.hasGate?"bg-amber-500/15 text-amber-400":t.agent==="claude"?"bg-orange-500/15 text-orange-400":t.agent==="codex"?"bg-emerald-500/15 text-emerald-400":"bg-slate-500/15 text-slate-400"),children:h.jsx(s,{className:"w-3 h-3"})}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("p",{className:"text-[10px] font-medium text-foreground truncate leading-tight",children:t.name}),e&&h.jsx("p",{className:"text-[8px] text-muted-foreground capitalize",children:e})]})]})}function ul({icon:t,color:e,label:r}){return h.jsxs("div",{className:nt("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",e),children:[h.jsx(t,{className:"w-3 h-3"}),h.jsx("span",{children:r})]})}function lV(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,c,u;return((a=o.featureCode)==null?void 0:a.toLowerCase().includes(s))||((l=o.feature_code)==null?void 0:l.toLowerCase().includes(s))||((c=o.summary)==null?void 0:c.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 cV={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:ls},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:Gf},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:ls},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:Xf},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:ls}},hV={bg:"bg-slate-800",text:"text-slate-600",Icon:ls},P0={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 uV({agent:t,size:e="md",className:r}){const n=cV[t]||hV,i=P0[e]||P0.md,{Icon:s}=n;return h.jsx("span",{className:nt("inline-flex items-center justify-center rounded-full shrink-0",n.bg,n.text,i.outer,r),title:t||"unassigned",children:h.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 Xn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const DT=6048e5,dV=864e5,dl=43200,D0=1440;let fV={};function Ma(){return fV}function pa(t,e){var a,l,c,u;const r=Ma(),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=(c=r.locale)==null?void 0:c.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 Fc(t){return pa(t,{weekStartsOn:1})}function OT(t){const e=le(t),r=e.getFullYear(),n=Xn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=Fc(n),s=Xn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=Fc(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function O0(t){const e=le(t);return e.setHours(0,0,0,0),e}function Pc(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 pV(t,e){const r=O0(t),n=O0(e),i=+r-Pc(r),s=+n-Pc(n);return Math.round((i-s)/dV)}function mV(t){const e=OT(t),r=Xn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Fc(r)}function Dl(t,e){const r=le(t),n=le(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function gV(t){return Xn(t,Date.now())}function xV(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function yV(t){if(!xV(t)&&typeof t!="number")return!1;const e=le(t);return!isNaN(Number(e))}function bV(t,e){const r=le(t),n=le(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function CV(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function kV(t,e){return+le(t)-+le(e)}function vV(t){const e=le(t);return e.setHours(23,59,59,999),e}function wV(t){const e=le(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function SV(t){const e=le(t);return+vV(e)==+wV(e)}function TV(t,e){const r=le(t),n=le(e),i=Dl(r,n),s=Math.abs(bV(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=Dl(r,n)===-i;SV(le(t))&&s===1&&Dl(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function _V(t,e,r){const n=kV(t,e)/1e3;return CV(r==null?void 0:r.roundingMethod)(n)}function EV(t){const e=le(t),r=Xn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const NV={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"}},jV=(t,e,r)=>{let n;const i=NV[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 Lu(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const LV={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},BV={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},AV={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},MV={date:Lu({formats:LV,defaultWidth:"full"}),time:Lu({formats:BV,defaultWidth:"full"}),dateTime:Lu({formats:AV,defaultWidth:"full"})},IV={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},FV=(t,e,r,n)=>IV[t];function So(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 PV={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},DV={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},OV={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"]},$V={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"]},RV={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"}},zV={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"}},WV=(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"},qV={ordinalNumber:WV,era:So({values:PV,defaultWidth:"wide"}),quarter:So({values:DV,defaultWidth:"wide",argumentCallback:t=>t-1}),month:So({values:OV,defaultWidth:"wide"}),day:So({values:$V,defaultWidth:"wide"}),dayPeriod:So({values:RV,defaultWidth:"wide",formattingValues:zV,defaultFormattingWidth:"wide"})};function To(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)?UV(a,d=>d.test(o)):HV(a,d=>d.test(o));let c;c=t.valueCallback?t.valueCallback(l):l,c=r.valueCallback?r.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function HV(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function UV(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function GV(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 VV=/^(\d+)(th|st|nd|rd)?/i,YV=/\d+/i,XV={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},KV={any:[/^b/i,/^(a|c)/i]},ZV={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},QV={any:[/1/i,/2/i,/3/i,/4/i]},JV={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},tY={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]},eY={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},rY={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]},nY={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},iY={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}},sY={ordinalNumber:GV({matchPattern:VV,parsePattern:YV,valueCallback:t=>parseInt(t,10)}),era:To({matchPatterns:XV,defaultMatchWidth:"wide",parsePatterns:KV,defaultParseWidth:"any"}),quarter:To({matchPatterns:ZV,defaultMatchWidth:"wide",parsePatterns:QV,defaultParseWidth:"any",valueCallback:t=>t+1}),month:To({matchPatterns:JV,defaultMatchWidth:"wide",parsePatterns:tY,defaultParseWidth:"any"}),day:To({matchPatterns:eY,defaultMatchWidth:"wide",parsePatterns:rY,defaultParseWidth:"any"}),dayPeriod:To({matchPatterns:nY,defaultMatchWidth:"any",parsePatterns:iY,defaultParseWidth:"any"})},$T={code:"en-US",formatDistance:jV,formatLong:MV,formatRelative:FV,localize:qV,match:sY,options:{weekStartsOn:0,firstWeekContainsDate:1}};function oY(t){const e=le(t);return pV(e,EV(e))+1}function aY(t){const e=le(t),r=+Fc(e)-+mV(e);return Math.round(r/DT)+1}function RT(t,e){var u,d,p,f;const r=le(t),n=r.getFullYear(),i=Ma(),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??((f=(p=i.locale)==null?void 0:p.options)==null?void 0:f.firstWeekContainsDate)??1,o=Xn(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=pa(o,e),l=Xn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const c=pa(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=c.getTime()?n:n-1}function lY(t,e){var a,l,c,u;const r=Ma(),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=(c=r.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,i=RT(t,e),s=Xn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),pa(s,e)}function cY(t,e){const r=le(t),n=+pa(r,e)-+lY(r,e);return Math.round(n/DT)+1}function oe(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const Mn={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return oe(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):oe(r+1,2)},d(t,e){return oe(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 oe(t.getHours()%12||12,e.length)},H(t,e){return oe(t.getHours(),e.length)},m(t,e){return oe(t.getMinutes(),e.length)},s(t,e){return oe(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return oe(i,e.length)}},Vi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},$0={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 Mn.y(t,e)},Y:function(t,e,r,n){const i=RT(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return oe(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):oe(s,e.length)},R:function(t,e){const r=OT(t);return oe(r,e.length)},u:function(t,e){const r=t.getFullYear();return oe(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 oe(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 oe(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 Mn.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 oe(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=cY(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):oe(i,e.length)},I:function(t,e,r){const n=aY(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):oe(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Mn.d(t,e)},D:function(t,e,r){const n=oY(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):oe(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 oe(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 oe(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 oe(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=Vi.noon:n===0?i=Vi.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=Vi.evening:n>=12?i=Vi.afternoon:n>=4?i=Vi.morning:i=Vi.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 Mn.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Mn.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):oe(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):oe(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Mn.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Mn.s(t,e)},S:function(t,e){return Mn.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return z0(n);case"XXXX":case"XX":return di(n);case"XXXXX":case"XXX":default:return di(n,":")}},x:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"x":return z0(n);case"xxxx":case"xx":return di(n);case"xxxxx":case"xxx":default:return di(n,":")}},O:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+R0(n,":");case"OOOO":default:return"GMT"+di(n,":")}},z:function(t,e,r){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+R0(n,":");case"zzzz":default:return"GMT"+di(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return oe(n,e.length)},T:function(t,e,r){const n=t.getTime();return oe(n,e.length)}};function R0(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+oe(s,2)}function z0(t,e){return t%60===0?(t>0?"-":"+")+oe(Math.abs(t)/60,2):di(t,e)}function di(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=oe(Math.trunc(n/60),2),s=oe(n%60,2);return r+i+e+s}const W0=(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"})}},zT=(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"})}},hY=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return W0(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}}",W0(n,e)).replace("{{time}}",zT(i,e))},uY={p:zT,P:hY},dY=/^D+$/,fY=/^Y+$/,pY=["D","DD","YY","YYYY"];function mY(t){return dY.test(t)}function gY(t){return fY.test(t)}function xY(t,e,r){const n=yY(t,e,r);if(console.warn(n),pY.includes(t))throw new RangeError(n)}function yY(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 bY=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,kY=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vY=/^'([^]*?)'?$/,wY=/''/g,SY=/[a-zA-Z]/;function TY(t,e,r){var u,d,p,f;const n=Ma(),i=n.locale??$T,s=n.firstWeekContainsDate??((d=(u=n.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=n.weekStartsOn??((f=(p=n.locale)==null?void 0:p.options)==null?void 0:f.weekStartsOn)??0,a=le(t);if(!yV(a))throw new RangeError("Invalid time value");let l=e.match(kY).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=uY[x];return g(m,i.formatLong)}return m}).join("").match(bY).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:_Y(m)};if($0[x])return{isToken:!0,value:m};if(x.match(SY))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 c={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(m=>{if(!m.isToken)return m.value;const x=m.value;(gY(x)||mY(x))&&xY(x,e,String(t));const g=$0[x[0]];return g(a,x,i.localize,c)}).join("")}function _Y(t){const e=t.match(vY);return e?e[1].replace(wY,"'"):t}function EY(t,e,r){const n=Ma(),i=(r==null?void 0:r.locale)??n.locale??$T,s=2520,o=Dl(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,c;o>0?(l=le(e),c=le(t)):(l=le(t),c=le(e));const u=_V(c,l),d=(Pc(c)-Pc(l))/1e3,p=Math.round((u-d)/60);let f;if(p<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):p===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",p,a);if(p<45)return i.formatDistance("xMinutes",p,a);if(p<90)return i.formatDistance("aboutXHours",1,a);if(p<D0){const m=Math.round(p/60);return i.formatDistance("aboutXHours",m,a)}else{if(p<s)return i.formatDistance("xDays",1,a);if(p<dl){const m=Math.round(p/D0);return i.formatDistance("xDays",m,a)}else if(p<dl*2)return f=Math.round(p/dl),i.formatDistance("aboutXMonths",f,a)}if(f=TV(c,l),f<12){const m=Math.round(p/dl);return i.formatDistance("xMonths",m,a)}else{const m=f%12,x=Math.trunc(f/12);return m<3?i.formatDistance("aboutXYears",x,a):m<9?i.formatDistance("overXYears",x,a):i.formatDistance("almostXYears",x+1,a)}}function NY(t,e){return EY(t,gV(t),e)}function jY({date:t,className:e}){if(!t)return h.jsx("span",{className:nt("text-muted-foreground",e),children:"—"});let r;try{if(r=typeof t=="string"?new Date(t):t,isNaN(r.getTime()))return h.jsx("span",{className:nt("text-muted-foreground",e),children:"—"})}catch{return h.jsx("span",{className:nt("text-muted-foreground",e),children:"—"})}const n=NY(r,{addSuffix:!0}),i=TY(r,"PPpp");return h.jsx("time",{dateTime:r.toISOString(),title:i,className:nt("text-muted-foreground tabular-nums",e),children:n})}function WT({sessions:t=[],items:e=[],onSelectItem:r,featureCode:n,focusActive:i,onToggleFocus:s}){const[o,a]=C.useState(""),[l,c]=C.useState("all"),[u,d]=C.useState("all"),p=C.useMemo(()=>t.filter(m=>m.status==="active").length,[t]),f=C.useMemo(()=>{let m=lV(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 h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2 border-b border-border shrink-0",children:[h.jsx(ka,{featureCode:n,active:i,onToggle:s}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[h.jsx("span",{className:nt("w-2 h-2 rounded-full",p>0?"bg-emerald-400":"bg-slate-600")}),h.jsxs("span",{className:"text-muted-foreground",children:[p," active"]})]}),h.jsx("div",{className:"h-4 w-px bg-border"}),h.jsxs("div",{className:"relative",children:[h.jsx(Zn,{className:"absolute left-1.5 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),h.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"})]}),h.jsxs("select",{value:l,onChange:m=>c(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:[h.jsx("option",{value:"all",children:"All agents"}),Wy.filter(m=>m!=="unassigned").map(m=>h.jsx("option",{value:m,children:m},m))]}),h.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:[h.jsx("option",{value:"all",children:"All status"}),["active","completed","failed","paused"].map(m=>h.jsx("option",{value:m,children:m},m))]}),h.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[f.length,"/",t.length]})]}),h.jsxs("div",{className:"flex-1 overflow-auto",children:[f.length===0&&h.jsx(sV,{icon:Uf,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),f.map(m=>h.jsx(LY,{session:m,items:e,onSelectItem:r},m.id))]})]})}function LY({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=pm[n]||pm.exploring,a=i?e.find(l=>{var c;return l.featureCode===i||l.feature_code===i||((c=l.lifecycle)==null?void 0:c.featureCode)===i}):null;return h.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:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(uV,{agent:t.agent,size:"sm",className:"shrink-0"}),h.jsx(ip,{status:t.status,className:"shrink-0"}),n&&h.jsx("span",{className:nt("text-[10px] px-1.5 py-0.5 rounded",o),children:n}),i&&h.jsx("button",{onClick:()=>a&&(r==null?void 0:r(a.id)),className:nt("text-[10px] font-mono",a?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:i}),h.jsx(jY,{date:s,className:"ml-auto text-[10px] shrink-0"})]}),t.summary&&h.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:t.summary}),h.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[h.jsxs("span",{children:["📄 ",t.reads??0]}),h.jsxs("span",{children:["📤 ",t.writes??0]}),h.jsxs("span",{className:(t.errors??0)>0?"text-red-400":void 0,children:["⚠ ",t.errors??0]})]})]})}const q0=t=>Symbol.iterator in t,H0=t=>"entries"in t,U0=(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},BY=(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 AY(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:q0(t)&&q0(e)?H0(t)&&H0(e)?U0(t,e):BY(t,e):U0({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Di(t){const e=Vt.useRef(void 0);return r=>{const n=t(r);return AY(e.current,n)?e.current:e.current=n}}function qT({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=pr(Di(g=>({items:g.items,gates:g.gates,sessions:g.sessions}))),[a,l]=C.useState(""),[c,u]=C.useState(0),d=C.useRef(null);C.useEffect(()=>{t&&(l(""),u(0),setTimeout(()=>{var g;return(g=d.current)==null?void 0:g.focus()},0))},[t]);const p=C.useMemo(()=>{if(!t)return[];if(!a.trim()){const S=s.filter(w=>w.status==="pending").slice(0,3).map(w=>({type:"gate",id:w.id,label:Zo(w,i.find(T=>T.id===w.itemId)),sub:kn[w.stepId]?`${Se[w.fromPhase]??w.fromPhase} → ${Se[w.toPhase]??w.toPhase}`:null,status:"pending",gate:w})),E=i.filter(w=>w.status==="blocked").slice(0,3).map(w=>({type:"item",id:w.id,label:w.title,sub:w.type,status:w.status,item:w}));return[...S.length?[{type:"section",label:"Pending Gates"}]:[],...S,...E.length?[{type:"section",label:"Blocked Items"}]:[],...E]}const g=a.toLowerCase(),y=i.filter(S=>{var E,w;return((E=S.title)==null?void 0:E.toLowerCase().includes(g))||((w=S.featureCode)==null?void 0:w.toLowerCase().includes(g))||(S.description||"").toLowerCase().includes(g)}).slice(0,5).map(S=>({type:"item",id:S.id,label:S.title,sub:`${S.type} · ${S.phase??""}`,status:S.status,item:S})),b=s.filter(S=>{var E;return(S.fromPhase||"").toLowerCase().includes(g)||(S.toPhase||"").toLowerCase().includes(g)||(((E=i.find(w=>w.id===S.itemId))==null?void 0:E.title)??"").toLowerCase().includes(g)}).slice(0,3).map(S=>({type:"gate",id:S.id,label:Zo(S,i.find(E=>E.id===S.itemId)),sub:S.status,status:S.status,gate:S})),k=(o||[]).filter(S=>(S.featureCode||"").toLowerCase().includes(g)||(S.summary||"").toLowerCase().includes(g)).slice(0,2).map(S=>({type:"session",id:S.id,label:S.featureCode||S.id,sub:S.summary||S.agent||"",status:S.status,session:S}));return[...y.length?[{type:"section",label:"Items"}]:[],...y,...b.length?[{type:"section",label:"Gates"}]:[],...b,...k.length?[{type:"section",label:"Sessions"}]:[],...k]},[t,a,i,s,o]),f=p.filter(g=>g.type!=="section"),m=C.useCallback(g=>{if(g.key==="Escape"){e();return}if(g.key==="ArrowDown"){g.preventDefault(),u(y=>(y+1)%Math.max(1,f.length));return}if(g.key==="ArrowUp"){g.preventDefault(),u(y=>(y-1+Math.max(1,f.length))%Math.max(1,f.length));return}if(g.key==="Enter"){const y=f[c];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}},[f,c,a,e,n,r]);let x=0;return t?h.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh]",onClick:e,children:h.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:[h.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-slate-700/50",children:[h.jsx(Zn,{className:"h-4 w-4 text-muted-foreground shrink-0"}),h.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"}),h.jsx("kbd",{className:"text-[10px] text-muted-foreground border border-border rounded px-1 py-0.5",children:"esc"})]}),h.jsxs("div",{className:"max-h-80 overflow-y-auto py-1",children:[p.length===0&&h.jsx("div",{className:"py-8 text-center text-xs text-muted-foreground",children:a?"No results":"No pending gates or blocked items"}),p.map((g,y)=>{if(g.type==="section")return h.jsx("div",{className:"px-4 pt-2 pb-1",children:h.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:g.label})},`section-${y}`);const b=x++,k=c===b;return h.jsxs("button",{className:nt("flex w-full items-center gap-3 px-4 py-2 text-left transition-colors",k?"bg-accent/10":"hover:bg-muted/50"),onMouseEnter:()=>u(b),onClick:()=>{g.type==="gate"?n==null||n(g.id):g.type==="item"?r==null||r(g.id):e()},children:[g.type==="gate"&&h.jsx(qs,{className:"h-4 w-4 text-amber-400 shrink-0"}),g.type==="item"&&h.jsx(Vc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&h.jsx(Uf,{className:"h-4 w-4 text-blue-400 shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-sm text-foreground truncate",children:g.label}),g.sub&&h.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:g.sub})]}),g.status&&h.jsx(ip,{status:g.status})]},g.id)})]}),h.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-slate-700/50 text-[10px] text-muted-foreground",children:[h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"↑↓"})," navigate"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"↵"})," select"]}),h.jsxs("span",{children:[h.jsx("kbd",{className:"border border-border rounded px-1",children:"esc"})," close"]})]})]})}):null}var MY=wf[" useId ".trim().toString()]||(()=>{}),IY=0;function Bu(t){const[e,r]=C.useState(MY());return Ls(()=>{r(n=>n??String(IY++))},[t]),t||(e?`radix-${e}`:"")}var FY=wf[" useInsertionEffect ".trim().toString()]||Ls;function PY({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[i,s,o]=DY({defaultProp:e,onChange:r}),a=t!==void 0,l=a?t:i;{const u=C.useRef(t!==void 0);C.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,n])}const c=C.useCallback(u=>{var d;if(a){const p=OY(u)?u(t):u;p!==t&&((d=o.current)==null||d.call(o,p))}else s(u)},[a,t,s,o]);return[l,c]}function DY({defaultProp:t,onChange:e}){const[r,n]=C.useState(t),i=C.useRef(r),s=C.useRef(e);return FY(()=>{s.current=e},[e]),C.useEffect(()=>{var o;i.current!==r&&((o=s.current)==null||o.call(s,r),i.current=r)},[r,i]),[r,n,s]}function OY(t){return typeof t=="function"}function $Y(t,e=globalThis==null?void 0:globalThis.document){const r=Mr(t);C.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var RY="DismissableLayer",df="dismissableLayer.update",zY="dismissableLayer.pointerDownOutside",WY="dismissableLayer.focusOutside",G0,HT=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),UT=C.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=C.useContext(HT),[u,d]=C.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=C.useState({}),m=jr(e,T=>d(T)),x=Array.from(c.layers),[g]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=x.indexOf(g),b=u?x.indexOf(u):-1,k=c.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,E=UY(T=>{const N=T.target,F=[...c.branches].some(L=>L.contains(N));!S||F||(i==null||i(T),o==null||o(T),T.defaultPrevented||a==null||a())},p),w=GY(T=>{const N=T.target;[...c.branches].some(L=>L.contains(N))||(s==null||s(T),o==null||o(T),T.defaultPrevented||a==null||a())},p);return $Y(T=>{b===c.layers.size-1&&(n==null||n(T),!T.defaultPrevented&&a&&(T.preventDefault(),a()))},p),C.useEffect(()=>{if(u)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(G0=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),V0(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=G0)}},[u,p,r,c]),C.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),V0())},[u,c]),C.useEffect(()=>{const T=()=>f({});return document.addEventListener(df,T),()=>document.removeEventListener(df,T)},[]),h.jsx(xr.div,{...l,ref:m,style:{pointerEvents:k?S?"auto":"none":void 0,...t.style},onFocusCapture:rr(t.onFocusCapture,w.onFocusCapture),onBlurCapture:rr(t.onBlurCapture,w.onBlurCapture),onPointerDownCapture:rr(t.onPointerDownCapture,E.onPointerDownCapture)})});UT.displayName=RY;var qY="DismissableLayerBranch",HY=C.forwardRef((t,e)=>{const r=C.useContext(HT),n=C.useRef(null),i=jr(e,n);return C.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),h.jsx(xr.div,{...t,ref:i})});HY.displayName=qY;function UY(t,e=globalThis==null?void 0:globalThis.document){const r=Mr(t),n=C.useRef(!1),i=C.useRef(()=>{});return C.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){GT(zY,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function GY(t,e=globalThis==null?void 0:globalThis.document){const r=Mr(t),n=C.useRef(!1);return C.useEffect(()=>{const i=s=>{s.target&&!n.current&&GT(WY,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function V0(){const t=new CustomEvent(df);document.dispatchEvent(t)}function GT(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?q3(i,s):i.dispatchEvent(s)}var Au="focusScope.autoFocusOnMount",Mu="focusScope.autoFocusOnUnmount",Y0={bubbles:!1,cancelable:!0},VY="FocusScope",VT=C.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=C.useState(null),c=Mr(i),u=Mr(s),d=C.useRef(null),p=jr(e,x=>l(x)),f=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(n){let x=function(k){if(f.paused||!a)return;const S=k.target;a.contains(S)?d.current=S:Pn(d.current,{select:!0})},g=function(k){if(f.paused||!a)return;const S=k.relatedTarget;S!==null&&(a.contains(S)||Pn(d.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&Pn(a)};document.addEventListener("focusin",x),document.addEventListener("focusout",g);const b=new MutationObserver(y);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",g),b.disconnect()}}},[n,a,f.paused]),C.useEffect(()=>{if(a){K0.add(f);const x=document.activeElement;if(!a.contains(x)){const y=new CustomEvent(Au,Y0);a.addEventListener(Au,c),a.dispatchEvent(y),y.defaultPrevented||(YY(JY(YT(a)),{select:!0}),document.activeElement===x&&Pn(a))}return()=>{a.removeEventListener(Au,c),setTimeout(()=>{const y=new CustomEvent(Mu,Y0);a.addEventListener(Mu,u),a.dispatchEvent(y),y.defaultPrevented||Pn(x??document.body,{select:!0}),a.removeEventListener(Mu,u),K0.remove(f)},0)}}},[a,c,u,f]);const m=C.useCallback(x=>{if(!r&&!n||f.paused)return;const g=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,y=document.activeElement;if(g&&y){const b=x.currentTarget,[k,S]=XY(b);k&&S?!x.shiftKey&&y===S?(x.preventDefault(),r&&Pn(k,{select:!0})):x.shiftKey&&y===k&&(x.preventDefault(),r&&Pn(S,{select:!0})):y===b&&x.preventDefault()}},[r,n,f.paused]);return h.jsx(xr.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});VT.displayName=VY;function YY(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Pn(n,{select:e}),document.activeElement!==r)return}function XY(t){const e=YT(t),r=X0(e,t),n=X0(e.reverse(),t);return[r,n]}function YT(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function X0(t,e){for(const r of t)if(!KY(r,{upTo:e}))return r}function KY(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function ZY(t){return t instanceof HTMLInputElement&&"select"in t}function Pn(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&ZY(t)&&e&&t.select()}}var K0=QY();function QY(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=Z0(t,e),t.unshift(e)},remove(e){var r;t=Z0(t,e),(r=t[0])==null||r.resume()}}}function Z0(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function JY(t){return t.filter(e=>e.tagName!=="A")}var tX="Portal",XT=C.forwardRef((t,e)=>{var a;const{container:r,...n}=t,[i,s]=C.useState(!1);Ls(()=>s(!0),[]);const o=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?F3.createPortal(h.jsx(xr.div,{...n,ref:e}),o):null});XT.displayName=tX;var Iu=0;function eX(){C.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Q0()),document.body.insertAdjacentElement("beforeend",t[1]??Q0()),Iu++,()=>{Iu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Iu--}},[])}function Q0(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var rn=function(){return rn=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},rn.apply(this,arguments)};function KT(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function rX(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}var Ol="right-scroll-bar-position",$l="width-before-scroll-bar",nX="with-scroll-bars-hidden",iX="--removed-body-scroll-bar-size";function Fu(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function sX(t,e){var r=C.useState(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var i=r.value;i!==n&&(r.value=n,r.callback(n,i))}}}})[0];return r.callback=e,r.facade}var oX=typeof window<"u"?C.useLayoutEffect:C.useEffect,J0=new WeakMap;function aX(t,e){var r=sX(null,function(n){return t.forEach(function(i){return Fu(i,n)})});return oX(function(){var n=J0.get(r);if(n){var i=new Set(n),s=new Set(t),o=r.current;i.forEach(function(a){s.has(a)||Fu(a,null)}),s.forEach(function(a){i.has(a)||Fu(a,o)})}J0.set(r,t)},[t]),r}function lX(t){return t}function cX(t,e){e===void 0&&(e=lX);var r=[],n=!1,i={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(s){var o=e(s,n);return r.push(o),function(){r=r.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(n=!0;r.length;){var o=r;r=[],o.forEach(s)}r={push:function(a){return s(a)},filter:function(){return r}}},assignMedium:function(s){n=!0;var o=[];if(r.length){var a=r;r=[],a.forEach(s),o=r}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),r={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),r}}}};return i}function hX(t){t===void 0&&(t={});var e=cX(null);return e.options=rn({async:!0,ssr:!1},t),e}var ZT=function(t){var e=t.sideCar,r=KT(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return C.createElement(n,rn({},r))};ZT.isSideCarExport=!0;function uX(t,e){return t.useMedium(e),ZT}var QT=hX(),Pu=function(){},wh=C.forwardRef(function(t,e){var r=C.useRef(null),n=C.useState({onScrollCapture:Pu,onWheelCapture:Pu,onTouchMoveCapture:Pu}),i=n[0],s=n[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,p=t.sideCar,f=t.noRelative,m=t.noIsolation,x=t.inert,g=t.allowPinchZoom,y=t.as,b=y===void 0?"div":y,k=t.gapMode,S=KT(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,w=aX([r,e]),T=rn(rn({},S),i);return C.createElement(C.Fragment,null,u&&C.createElement(E,{sideCar:QT,removeScrollBar:c,shards:d,noRelative:f,noIsolation:m,inert:x,setCallbacks:s,allowPinchZoom:!!g,lockRef:r,gapMode:k}),o?C.cloneElement(C.Children.only(a),rn(rn({},T),{ref:w})):C.createElement(b,rn({},T,{className:l,ref:w}),a))});wh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wh.classNames={fullWidth:$l,zeroRight:Ol};var dX=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fX(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=dX();return e&&t.setAttribute("nonce",e),t}function pX(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function mX(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var gX=function(){var t=0,e=null;return{add:function(r){t==0&&(e=fX())&&(pX(e,r),mX(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},xX=function(){var t=gX();return function(e,r){C.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},JT=function(){var t=xX(),e=function(r){var n=r.styles,i=r.dynamic;return t(n,i),null};return e},yX={left:0,top:0,right:0,gap:0},Du=function(t){return parseInt(t||"",10)||0},bX=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[Du(r),Du(n),Du(i)]},CX=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return yX;var e=bX(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},kX=JT(),ds="data-scroll-locked",vX=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),`
674
- .`.concat(nX,` {
675
- overflow: hidden `).concat(n,`;
676
- padding-right: `).concat(a,"px ").concat(n,`;
677
- }
678
- body[`).concat(ds,`] {
679
- overflow: hidden `).concat(n,`;
680
- overscroll-behavior: contain;
681
- `).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
682
- padding-left: `.concat(i,`px;
683
- padding-top: `).concat(s,`px;
684
- padding-right: `).concat(o,`px;
685
- margin-left:0;
686
- margin-top:0;
687
- margin-right: `).concat(a,"px ").concat(n,`;
688
- `),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
689
- }
690
-
691
- .`).concat(Ol,` {
692
- right: `).concat(a,"px ").concat(n,`;
693
- }
694
-
695
- .`).concat($l,` {
696
- margin-right: `).concat(a,"px ").concat(n,`;
697
- }
698
-
699
- .`).concat(Ol," .").concat(Ol,` {
700
- right: 0 `).concat(n,`;
701
- }
702
-
703
- .`).concat($l," .").concat($l,` {
704
- margin-right: 0 `).concat(n,`;
705
- }
706
-
707
- body[`).concat(ds,`] {
708
- `).concat(iX,": ").concat(a,`px;
709
- }
710
- `)},ty=function(){var t=parseInt(document.body.getAttribute(ds)||"0",10);return isFinite(t)?t:0},wX=function(){C.useEffect(function(){return document.body.setAttribute(ds,(ty()+1).toString()),function(){var t=ty()-1;t<=0?document.body.removeAttribute(ds):document.body.setAttribute(ds,t.toString())}},[])},SX=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n;wX();var s=C.useMemo(function(){return CX(i)},[i]);return C.createElement(kX,{styles:vX(s,!e,i,r?"":"!important")})},ff=!1;if(typeof window<"u")try{var fl=Object.defineProperty({},"passive",{get:function(){return ff=!0,!0}});window.addEventListener("test",fl,fl),window.removeEventListener("test",fl,fl)}catch{ff=!1}var Yi=ff?{passive:!1}:!1,TX=function(t){return t.tagName==="TEXTAREA"},t_=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!TX(t)&&r[e]==="visible")},_X=function(t){return t_(t,"overflowY")},EX=function(t){return t_(t,"overflowX")},ey=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=e_(t,n);if(i){var s=r_(t,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},NX=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},jX=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},e_=function(t,e){return t==="v"?_X(e):EX(e)},r_=function(t,e){return t==="v"?NX(e):jX(e)},LX=function(t,e){return t==="h"&&e==="rtl"?-1:1},BX=function(t,e,r,n,i){var s=LX(t,window.getComputedStyle(e).direction),o=s*n,a=r.target,l=e.contains(a),c=!1,u=o>0,d=0,p=0;do{if(!a)break;var f=r_(t,a),m=f[0],x=f[1],g=f[2],y=x-g-s*m;(m||y)&&e_(t,a)&&(d+=y,p+=m);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&Math.abs(d)<1||!u&&Math.abs(p)<1)&&(c=!0),c},pl=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},ry=function(t){return[t.deltaX,t.deltaY]},ny=function(t){return t&&"current"in t?t.current:t},AX=function(t,e){return t[0]===e[0]&&t[1]===e[1]},MX=function(t){return`
711
- .block-interactivity-`.concat(t,` {pointer-events: none;}
712
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
713
- `)},IX=0,Xi=[];function FX(t){var e=C.useRef([]),r=C.useRef([0,0]),n=C.useRef(),i=C.useState(IX++)[0],s=C.useState(JT)[0],o=C.useRef(t);C.useEffect(function(){o.current=t},[t]),C.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var x=rX([t.lockRef.current],(t.shards||[]).map(ny),!0).filter(Boolean);return x.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=C.useCallback(function(x,g){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var y=pl(x),b=r.current,k="deltaX"in x?x.deltaX:b[0]-y[0],S="deltaY"in x?x.deltaY:b[1]-y[1],E,w=x.target,T=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in x&&T==="h"&&w.type==="range")return!1;var N=window.getSelection(),F=N&&N.anchorNode,L=F?F===w||F.contains(w):!1;if(L)return!1;var B=ey(T,w);if(!B)return!0;if(B?E=T:(E=T==="v"?"h":"v",B=ey(T,w)),!B)return!1;if(!n.current&&"changedTouches"in x&&(k||S)&&(n.current=E),!E)return!0;var W=n.current||E;return BX(W,g,x,W==="h"?k:S)},[]),l=C.useCallback(function(x){var g=x;if(!(!Xi.length||Xi[Xi.length-1]!==s)){var y="deltaY"in g?ry(g):pl(g),b=e.current.filter(function(E){return E.name===g.type&&(E.target===g.target||g.target===E.shadowParent)&&AX(E.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var k=(o.current.shards||[]).map(ny).filter(Boolean).filter(function(E){return E.contains(g.target)}),S=k.length>0?a(g,k[0]):!o.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),c=C.useCallback(function(x,g,y,b){var k={name:x,delta:g,target:y,should:b,shadowParent:PX(y)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(S){return S!==k})},1)},[]),u=C.useCallback(function(x){r.current=pl(x),n.current=void 0},[]),d=C.useCallback(function(x){c(x.type,ry(x),x.target,a(x,t.lockRef.current))},[]),p=C.useCallback(function(x){c(x.type,pl(x),x.target,a(x,t.lockRef.current))},[]);C.useEffect(function(){return Xi.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Yi),document.addEventListener("touchmove",l,Yi),document.addEventListener("touchstart",u,Yi),function(){Xi=Xi.filter(function(x){return x!==s}),document.removeEventListener("wheel",l,Yi),document.removeEventListener("touchmove",l,Yi),document.removeEventListener("touchstart",u,Yi)}},[]);var f=t.removeScrollBar,m=t.inert;return C.createElement(C.Fragment,null,m?C.createElement(s,{styles:MX(i)}):null,f?C.createElement(SX,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function PX(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const DX=uX(QT,FX);var n_=C.forwardRef(function(t,e){return C.createElement(wh,rn({},t,{ref:e,sideCar:DX}))});n_.classNames=wh.classNames;var OX=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ki=new WeakMap,ml=new WeakMap,gl={},Ou=0,i_=function(t){return t&&(t.host||i_(t.parentNode))},$X=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=i_(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},RX=function(t,e,r,n){var i=$X(e,Array.isArray(t)?t:[t]);gl[r]||(gl[r]=new WeakMap);var s=gl[r],o=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))u(p);else try{var f=p.getAttribute(n),m=f!==null&&f!=="false",x=(Ki.get(p)||0)+1,g=(s.get(p)||0)+1;Ki.set(p,x),s.set(p,g),o.push(p),x===1&&m&&ml.set(p,!0),g===1&&p.setAttribute(r,"true"),m||p.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return u(e),a.clear(),Ou++,function(){o.forEach(function(d){var p=Ki.get(d)-1,f=s.get(d)-1;Ki.set(d,p),s.set(d,f),p||(ml.has(d)||d.removeAttribute(n),ml.delete(d)),f||d.removeAttribute(r)}),Ou--,Ou||(Ki=new WeakMap,Ki=new WeakMap,ml=new WeakMap,gl={})}},zX=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=OX(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),RX(n,i,r,"aria-hidden")):function(){return null}};function WX(t){const e=qX(t),r=C.forwardRef((n,i)=>{const{children:s,...o}=n,a=C.Children.toArray(s),l=a.find(UX);if(l){const c=l.props.children,u=a.map(d=>d===l?C.Children.count(c)>1?C.Children.only(null):C.isValidElement(c)?c.props.children:null:d);return h.jsx(e,{...o,ref:i,children:C.isValidElement(c)?C.cloneElement(c,void 0,u):null})}return h.jsx(e,{...o,ref:i,children:s})});return r.displayName=`${t}.Slot`,r}function qX(t){const e=C.forwardRef((r,n)=>{const{children:i,...s}=r;if(C.isValidElement(i)){const o=VX(i),a=GX(s,i.props);return i.type!==C.Fragment&&(a.ref=n?Kc(n,o):o),C.cloneElement(i,a)}return C.Children.count(i)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var HX=Symbol("radix.slottable");function UX(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===HX}function GX(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}function VX(t){var n,i;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Sh="Dialog",[s_]=E1(Sh),[YX,Xr]=s_(Sh),o_=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=C.useRef(null),l=C.useRef(null),[c,u]=PY({prop:n,defaultProp:i??!1,onChange:s,caller:Sh});return h.jsx(YX,{scope:e,triggerRef:a,contentRef:l,contentId:Bu(),titleId:Bu(),descriptionId:Bu(),open:c,onOpenChange:u,onOpenToggle:C.useCallback(()=>u(d=>!d),[u]),modal:o,children:r})};o_.displayName=Sh;var a_="DialogTrigger",XX=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(a_,r),s=jr(e,i.triggerRef);return h.jsx(xr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":cm(i.open),...n,ref:s,onClick:rr(t.onClick,i.onOpenToggle)})});XX.displayName=a_;var am="DialogPortal",[KX,l_]=s_(am,{forceMount:void 0}),c_=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=Xr(am,e);return h.jsx(KX,{scope:e,forceMount:r,children:C.Children.map(n,o=>h.jsx(Jn,{present:r||s.open,children:h.jsx(XT,{asChild:!0,container:i,children:o})}))})};c_.displayName=am;var Dc="DialogOverlay",h_=C.forwardRef((t,e)=>{const r=l_(Dc,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Xr(Dc,t.__scopeDialog);return s.modal?h.jsx(Jn,{present:n||s.open,children:h.jsx(QX,{...i,ref:e})}):null});h_.displayName=Dc;var ZX=WX("DialogOverlay.RemoveScroll"),QX=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(Dc,r);return h.jsx(n_,{as:ZX,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(xr.div,{"data-state":cm(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),ji="DialogContent",u_=C.forwardRef((t,e)=>{const r=l_(ji,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Xr(ji,t.__scopeDialog);return h.jsx(Jn,{present:n||s.open,children:s.modal?h.jsx(JX,{...i,ref:e}):h.jsx(tK,{...i,ref:e})})});u_.displayName=ji;var JX=C.forwardRef((t,e)=>{const r=Xr(ji,t.__scopeDialog),n=C.useRef(null),i=jr(e,r.contentRef,n);return C.useEffect(()=>{const s=n.current;if(s)return zX(s)},[]),h.jsx(d_,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rr(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:rr(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:rr(t.onFocusOutside,s=>s.preventDefault())})}),tK=C.forwardRef((t,e)=>{const r=Xr(ji,t.__scopeDialog),n=C.useRef(!1),i=C.useRef(!1);return h.jsx(d_,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),s.preventDefault()),n.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=r.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),d_=C.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Xr(ji,r),l=C.useRef(null),c=jr(e,l);return eX(),h.jsxs(h.Fragment,{children:[h.jsx(VT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(UT,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":cm(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(eK,{titleId:a.titleId}),h.jsx(nK,{contentRef:l,descriptionId:a.descriptionId})]})]})}),lm="DialogTitle",f_=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(lm,r);return h.jsx(xr.h2,{id:i.titleId,...n,ref:e})});f_.displayName=lm;var p_="DialogDescription",m_=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(p_,r);return h.jsx(xr.p,{id:i.descriptionId,...n,ref:e})});m_.displayName=p_;var g_="DialogClose",x_=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Xr(g_,r);return h.jsx(xr.button,{type:"button",...n,ref:e,onClick:rr(t.onClick,()=>i.onOpenChange(!1))})});x_.displayName=g_;function cm(t){return t?"open":"closed"}var y_="DialogTitleWarning",[Ntt,b_]=V3(y_,{contentName:ji,titleName:lm,docsSlug:"dialog"}),eK=({titleId:t})=>{const e=b_(y_),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
714
-
715
- If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
716
-
717
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return C.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},rK="DialogDescriptionWarning",nK=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${b_(rK).contentName}}.`;return C.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},iK=o_,sK=c_,C_=h_,k_=u_,v_=f_,w_=m_,oK=x_;const hm=iK,aK=sK,S_=C.forwardRef(({className:t,...e},r)=>h.jsx(C_,{ref:r,className:nt("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));S_.displayName=C_.displayName;const Th=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(aK,{children:[h.jsx(S_,{}),h.jsxs(k_,{ref:n,className:nt("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%]","w-full max-w-lg rounded-lg border border-slate-700 bg-card shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",t),...r,children:[e,h.jsxs(oK,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(ln,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Th.displayName=k_.displayName;const _h=({className:t,...e})=>h.jsx("div",{className:nt("flex flex-col space-y-1.5 p-6 pb-4",t),...e});_h.displayName="DialogHeader";const um=({className:t,...e})=>h.jsx("div",{className:nt("flex items-center justify-end gap-2 p-6 pt-4",t),...e});um.displayName="DialogFooter";const Eh=C.forwardRef(({className:t,...e},r)=>h.jsx(v_,{ref:r,className:nt("text-sm font-semibold text-foreground leading-none tracking-tight",t),...e}));Eh.displayName=v_.displayName;const lK=C.forwardRef(({className:t,...e},r)=>h.jsx(w_,{ref:r,className:nt("text-sm text-muted-foreground",t),...e}));lK.displayName=w_.displayName;const iy=[{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"}}],cK=["gate","flag","skip"];function sy(t){return{type:"task",title:"",description:"",phase:(t==null?void 0:t.phase)??"planning",priority:1,assignedTo:"unassigned",governance:"flag",featureCode:""}}function T_({open:t,onClose:e,parentItem:r}){const n=pr(b=>b.createItem),[i,s]=C.useState(()=>sy(r)),[o,a]=C.useState("task"),[l,c]=C.useState(!1),[u,d]=C.useState(!1),[p,f]=C.useState(""),m=C.useRef(null);C.useEffect(()=>{if(t){const b=sy(r);s(b),a("task"),c(!1),f(""),setTimeout(()=>{var k;return(k=m.current)==null?void 0:k.focus()},50)}},[t,r]);const x=b=>{const k=iy.find(S=>S.id===b);k&&(a(b),s(S=>({...S,type:k.defaults.type,phase:(r==null?void 0:r.phase)??k.defaults.phase,priority:k.defaults.priority,governance:k.defaults.governance})))},g=async()=>{if(!i.title.trim()){f("Title is required");return}d(!0),f("");try{const b={type:i.type,title:i.title.trim(),description:i.description.trim()||void 0,phase:i.phase||void 0,status:"planned",confidence:0,priority:i.priority,assignedTo:i.assignedTo!=="unassigned"?i.assignedTo:void 0,governance:i.governance!=="flag"?i.governance:void 0,featureCode:i.featureCode.trim()||void 0};await n(b),e()}catch{f("Failed to create item")}finally{d(!1)}},y=b=>{b.key==="Enter"&&!b.shiftKey&&b.target.tagName!=="TEXTAREA"&&(b.preventDefault(),g())};return h.jsx(hm,{open:t,onOpenChange:b=>!b&&e(),children:h.jsxs(Th,{className:"max-w-md",onKeyDown:y,children:[h.jsx(_h,{children:h.jsx(Eh,{children:"New Item"})}),h.jsxs("div",{className:"px-6 pb-2 space-y-4",children:[h.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:iy.map(b=>h.jsx("button",{type:"button",onClick:()=>x(b.id),className:nt("rounded-md px-2 py-1.5 text-[11px] font-medium border transition-colors",o===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))}),h.jsx("input",{ref:m,type:"text",placeholder:"Item title…",value:i.title,onChange:b=>s(k=>({...k,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"}),h.jsx("textarea",{placeholder:"Description (optional)…",value:i.description,onChange:b=>s(k=>({...k,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"}),h.jsxs("button",{type:"button",onClick:()=>c(b=>!b),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l?h.jsx(e1,{className:"h-3 w-3"}):h.jsx(Ca,{className:"h-3 w-3"}),"Advanced"]}),l&&h.jsxs("div",{className:"space-y-3 border border-border/40 rounded-md p-3 bg-muted/20",children:[h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Feature Code"}),h.jsx("input",{type:"text",placeholder:"e.g. COMP-UI-5",value:i.featureCode,onChange:b=>s(k=>({...k,featureCode:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border outline-none"})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Phase"}),h.jsx("select",{value:i.phase,onChange:b=>s(k=>({...k,phase:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:Ry.map(b=>h.jsx("option",{value:b,children:Rl[b]??b},b))})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Priority"}),h.jsxs("select",{value:i.priority,onChange:b=>s(k=>({...k,priority:Number(b.target.value)})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:[h.jsx("option",{value:0,children:"Low (0)"}),h.jsx("option",{value:1,children:"Normal (1)"}),h.jsx("option",{value:2,children:"High (2)"}),h.jsx("option",{value:3,children:"Critical (3)"})]})]}),h.jsxs("label",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Assign to"}),h.jsx("select",{value:i.assignedTo,onChange:b=>s(k=>({...k,assignedTo:b.target.value})),className:"text-xs bg-muted text-foreground px-2 py-1 rounded border border-border cursor-pointer",children:Wy.map(b=>h.jsx("option",{value:b,children:b},b))})]}),h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Governance"}),h.jsx("div",{className:"flex gap-1.5",children:cK.map(b=>h.jsx("button",{type:"button",onClick:()=>s(k=>({...k,governance:b})),className:nt("flex-1 text-[11px] px-2 py-1 rounded border transition-colors",i.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&&h.jsx("p",{className:"text-xs text-destructive",children:p})]}),h.jsxs(um,{children:[h.jsx(Rt,{variant:"ghost",size:"sm",onClick:e,disabled:u,children:"Cancel"}),h.jsx(Rt,{size:"sm",onClick:g,disabled:u||!i.title.trim(),children:u?"Creating…":"Create"})]})]})})}const hK=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],uK=[{id:"gate",Icon:qs,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:i1,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:c1,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function dK(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 __({open:t,onClose:e,settings:r,onSettingsChange:n}){const[i,s]=C.useState(!1),o=C.useRef(null),a=C.useCallback((l,c)=>{n==null||n({governance:{phases:{[l]:c}}}),clearTimeout(o.current),s(!0),o.current=setTimeout(()=>s(!1),1500)},[n]);return h.jsx(hm,{open:t,onOpenChange:l=>!l&&e(),children:h.jsxs(Th,{className:"max-w-sm",children:[h.jsx(_h,{children:h.jsxs("div",{className:"flex items-center justify-between pr-6",children:[h.jsx(Eh,{children:"Governance Settings"}),i&&h.jsx("span",{className:"text-[11px] text-emerald-400 font-medium",children:"Saved ✓"})]})}),h.jsx("div",{className:"px-6 pb-6 space-y-1 max-h-96 overflow-y-auto",children:hK.map(l=>{const c=l==="explore_design",u=dK(r,l),d=Se[l]??l;return h.jsxs("div",{className:nt("flex items-center gap-3 rounded-md px-2 py-1.5",c&&"opacity-40"),children:[h.jsx("span",{className:nt("text-xs flex-1 min-w-0 truncate",c?"text-muted-foreground":"text-foreground"),children:d}),c?h.jsx("span",{className:"text-[10px] text-muted-foreground italic",children:"no policy"}):h.jsx("div",{className:"flex gap-1 shrink-0",children:uK.map(p=>{const f=u===p.id,{Icon:m}=p;return h.jsxs("button",{onClick:()=>a(l,p.id),title:p.label,className:nt("flex items-center gap-1 px-2 py-0.5 text-[10px] rounded border transition-colors",f?p.active:"border-border/30 text-muted-foreground hover:border-border hover:text-foreground"),children:[h.jsx(m,{className:"h-2.5 w-2.5"}),p.label]},p.id)})})]},l)})}),h.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 E_({onOpenGate:t}){const{gates:e,items:r}=pr(Di(g=>({gates:g.gates,items:g.items}))),[n,i]=C.useState(new Set),[s,o]=C.useState(0),a=e.filter(g=>g.status==="pending"&&!n.has(g.id));if(a.length===0)return null;const l=Math.min(s,a.length-1),c=a[l],u=r.find(g=>g.id===c.itemId)||r.find(g=>{var y;return((y=g.lifecycle)==null?void 0:y.featureCode)&&c.featureCode&&g.lifecycle.featureCode===c.featureCode}),d=Zo(c,u),p=hE[c.fromPhase]??uE,f=()=>{i(g=>new Set([...g,c.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 h.jsxs("div",{className:nt("shrink-0 h-10 border-t flex items-center gap-2 px-3",p.bg,p.border),children:[h.jsx(qs,{className:nt("h-3.5 w-3.5 shrink-0",p.text)}),h.jsx("span",{className:nt("text-[11px] font-medium truncate flex-1 min-w-0",p.text),children:d}),a.length>1&&h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx("button",{onClick:m,disabled:l===0,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:h.jsx(t1,{className:"h-3 w-3"})}),h.jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[l+1,"/",a.length]}),h.jsx("button",{onClick:x,disabled:l===a.length-1,className:"p-0.5 rounded hover:bg-muted/50 disabled:opacity-30 transition-colors",children:h.jsx(js,{className:"h-3 w-3"})})]}),h.jsx("button",{onClick:()=>t==null?void 0:t(c.id),className:nt("shrink-0 text-[10px] px-2 py-0.5 rounded border transition-colors hover:opacity-80",p.border,p.text),children:"Review"}),h.jsx("button",{onClick:f,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:h.jsx(ln,{className:"h-3 w-3"})})]})}const fK="●",pK="text-zinc-400";function mK(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 gK(t){var e;return((e=qy[t])==null?void 0:e.icon)??fK}function xK(t){var e;return((e=qy[t])==null?void 0:e.color)??pK}const yK={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 bK(t){return yK[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function CK(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function kK(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function vK({event:t,now:e}){const r=gK(t.kind),n=xK(t.kind),i=mK(t.timestamp,e);return h.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:[h.jsxs("div",{className:"flex items-center justify-between gap-1",children:[h.jsx("span",{className:nt("text-[11px] shrink-0",n),children:r}),h.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:i||kK(t.timestamp)})]}),h.jsx("p",{className:"text-[11px] text-foreground/80 truncate leading-tight",children:t.title}),t.roles&&t.roles.length>0&&h.jsx("div",{className:"flex flex-wrap gap-0.5 mt-0.5",children:t.roles.map((s,o)=>h.jsx("span",{"data-role-chip":!0,className:nt("text-[9px] px-1 py-px rounded-full leading-tight",bK(s.name)),children:s.name},o))})]})}function N_({events:t=[],currentFeatureCode:e,now:r}){const n=CK(t,e);return n.length===0?null:h.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:h.jsx("div",{className:"flex items-center gap-2 px-3 h-full",children:n.map(i=>h.jsx(vK,{event:i,now:r},i.id))})})}function wK(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 SK="Select a feature to see status.";function j_({featureCode:t,snapshot:e}){const[r,n]=C.useState(!1),i=C.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??SK,o=wK(e);return h.jsxs(h.Fragment,{children:[h.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:[h.jsx("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1},children:s}),h.jsx("span",{style:{marginLeft:8,opacity:.5,fontSize:10},"aria-hidden":"true",children:r?"▲":"▼"})]}),r&&h.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:h.jsx("div",{style:{padding:"8px 12px"},children:o.length===0?h.jsx("span",{className:"text-muted-foreground",children:"No details available."}):h.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:h.jsx("tbody",{children:o.map((a,l)=>h.jsxs("tr",{children:[h.jsx("td",{style:{paddingRight:16,paddingBottom:2,fontWeight:500,whiteSpace:"nowrap"},className:"text-foreground/60",children:a.label}),h.jsx("td",{style:{paddingBottom:2},children:String(a.value)})]},l))})})})})]})}function TK({onContextSelect:t,sidebarOpen:e=!0,onToggleSidebar:r}){const{items:n,connections:i,connected:s,uiCommand:o,clearUICommand:a,recentChanges:l,createItem:c,updateItem:u,deleteItem:d,createConnection:p,deleteConnection:f,agentActivity:m,agentErrors:x,sessionState:g,registerSnapshotProvider:y,gates:b,gateEvent:k,resolveGate:S,settings:E,updateSettings:w,resetSettings:T,activeBuild:N,setActiveBuild:F,pipelineDraft:L,sessions:B,selectedPhase:W,setSelectedPhase:G,decisionEvents:O,statusSnapshots:I,setStatusSnapshot:M}=pr(),[P,$]=C.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),D=C.useRef(!!sessionStorage.getItem("vision-activeView")),[_,R]=C.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[X,A]=C.useState(""),[ct,st]=C.useState(null),[J,yt]=C.useState(!1),[Ot,lt]=C.useState(!1),[Z,at]=C.useState(!1);C.useEffect(()=>{sessionStorage.setItem("vision-activeView",_)},[_]),C.useEffect(()=>{P?sessionStorage.setItem("vision-selectedItemId",P):sessionStorage.removeItem("vision-selectedItemId")},[P]);const vt=C.useRef(!1);C.useEffect(()=>{var tt;(tt=E==null?void 0:E.ui)!=null&&tt.defaultView&&!vt.current&&!D.current&&(R(E.ui.defaultView),vt.current=!0)},[E]),C.useEffect(()=>{o&&(o.view&&R(o.view),o.phase!==void 0&&G(o.phase),o.select!==void 0&&$(o.select),a())},[o,a]),C.useEffect(()=>{const tt=()=>{var U;return["INPUT","TEXTAREA","SELECT"].includes((U=document.activeElement)==null?void 0:U.tagName)},mt=U=>{(U.metaKey||U.ctrlKey)&&U.key==="k"&&(U.preventDefault(),yt(et=>!et)),(U.metaKey||U.ctrlKey)&&U.key==="n"&&(U.preventDefault(),lt(!0)),U.key===","&&!U.metaKey&&!U.ctrlKey&&!tt()&&at(!0)};return window.addEventListener("keydown",mt),()=>window.removeEventListener("keydown",mt)},[]);const Et=C.useMemo(()=>{let tt=n;if(W&&(tt=tt.filter(mt=>mt.phase===W)),X){const mt=X.toLowerCase();tt=tt.filter(U=>U.title.toLowerCase().includes(mt)||(U.description||"").toLowerCase().includes(mt))}return tt},[n,W,X]),Mt=C.useMemo(()=>W?n.filter(tt=>tt.phase===W):n,[n,W]),re=C.useMemo(()=>new Set(Mt.map(tt=>tt.id)),[Mt]),xe=C.useMemo(()=>W?b.filter(tt=>re.has(tt.itemId)):b,[b,re,W]),Re=C.useMemo(()=>{if(!W&&!X)return i;const tt=new Set(Et.map(mt=>mt.id));return i.filter(mt=>tt.has(mt.fromId)&&tt.has(mt.toId))},[i,Et,W,X]);C.useEffect(()=>{y(()=>({activeView:_,selectedPhase:W,searchQuery:X,selectedItemId:P,totalItems:n.length,filteredCount:Et.length,connected:s}))},[y,_,W,X,P,n.length,Et.length,s]);const Kt=C.useCallback(tt=>{$(tt),t&&t({type:"item",id:tt})},[t]),_e=C.useCallback((tt,mt)=>{u(tt,mt)},[u]);C.useCallback(async()=>{const mt=await c({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:W||"vision"});mt&&mt.id&&$(mt.id)},[c,W]),C.useCallback(async tt=>{await d(tt),P===tt&&($(null),t&&t(null))},[d,P,t]);const V=C.useCallback(tt=>{const mt=b.find(U=>U.id===tt);mt&&($(mt.itemId),t&&t({type:"item",id:mt.itemId}))},[b,t]);C.useCallback(async tt=>p(tt),[p]),C.useCallback(async tt=>f(tt),[f]);const it=C.useCallback(()=>{$t("/api/build/state").then(tt=>tt.json()).then(tt=>F(tt.state??null)).catch(()=>{})},[F]),ut=C.useCallback(tt=>{t&&t({type:"step",id:tt})},[t]),jt=C.useMemo(()=>{var mt;if(!P)return null;const tt=n.find(U=>U.id===P);return((mt=tt==null?void 0:tt.lifecycle)==null?void 0:mt.featureCode)||null},[P,n]);return C.useEffect(()=>{jt&&(I&&I[jt]||$t(`/api/lifecycle/status?featureCode=${encodeURIComponent(jt)}`).then(tt=>tt.json()).then(tt=>{tt.snapshot&&M&&M(jt,tt.snapshot)}).catch(()=>{}))},[jt]),h.jsx(Yc.Provider,{value:l,children:h.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[h.jsx(j_,{featureCode:jt,snapshot:jt?(I==null?void 0:I[jt])??null:null}),jt&&h.jsx(N_,{events:O,currentFeatureCode:jt}),h.jsxs("div",{className:"flex-1 flex min-h-0",children:[h.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[r&&h.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&&h.jsx(X1,{items:n,gates:b,activeBuild:N,activeView:_,onViewChange:R,selectedPhase:W,onPhaseSelect:G,searchQuery:X,onSearchChange:A,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Kt,onThemeChange:w,onNewItem:()=>lt(!0)})]}),h.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[!s&&h.jsx("div",{className:"text-center text-[10px] py-0.5 bg-destructive text-destructive-foreground",children:"Disconnected — reconnecting..."}),_==="tree"&&h.jsx(Z1,{items:Et,connections:Re,selectedItemId:P,onSelect:Kt}),_==="graph"&&h.jsx(J1,{items:Et,connections:Re,selectedItemId:P,onSelect:Kt}),_==="pipeline"&&h.jsx(PT,{activeBuild:N,pipelineDraft:L,onSelectStep:ut,onRefresh:it}),_==="sessions"&&h.jsx(WT,{sessions:B,items:n,onSelectItem:Kt}),_==="docs"&&h.jsx(LT,{items:Mt}),_==="gates"&&h.jsx(AT,{gates:xe,items:Mt,onResolve:S,onSelect:Kt}),_==="settings"&&h.jsx(FT,{settings:E,onSettingsChange:w,onReset:T})]}),h.jsx(E_,{onOpenGate:V}),ct&&(()=>{const tt=n.find(mt=>mt.id===ct);return tt?h.jsx(IT,{item:tt,items:n,connections:i,onUpdate:_e,onClose:()=>st(null)}):null})(),h.jsx(MT,{event:k,items:n,onNavigate:()=>R("gates")}),h.jsx(qT,{open:J,onClose:()=>yt(!1),onSelectItem:tt=>{Kt(tt),yt(!1)},onSelectGate:tt=>{V(tt),yt(!1)}}),h.jsx(T_,{open:Ot,onClose:()=>lt(!1)}),h.jsx(__,{open:Z,onClose:()=>at(!1),settings:E,onSettingsChange:w})]})]})})}ma.use($y);const _K={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},EK={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function NK(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 jK(){const[t,e]=C.useState(()=>document.documentElement.classList.contains("dark"));return C.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const LK={"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}},BK={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function AK(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 Oc="compose:graph:";function MK(t){try{const e=localStorage.getItem(Oc+t);return e?JSON.parse(e):null}catch{return null}}function IK(t,e){try{localStorage.setItem(Oc+t,JSON.stringify(e))}catch{}}const FK=[{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 os({onClick:t,active:e,children:r,title:n}){return h.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 xl({mode:t,active:e,onClick:r}){return h.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 $u(){return h.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function oy({arrow:t,label:e,edgeStyle:r,color:n,targetLabel:i,targetColor:s,suffix:o}){return h.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:t}),h.jsx("span",{style:{color:n||"hsl(var(--muted-foreground))",fontStyle:r==="dashed"?"italic":"normal"},children:e||"connects"}),i?h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:s||"hsl(var(--muted-foreground) / 0.6)"}}),h.jsx("span",{style:{color:"hsl(var(--foreground))"},children:i})]})]}):o?h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:o}):null,r&&r!=="solid"&&h.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",r,")"]})]})}function PK({nodes:t,edges:e,graphKey:r}){const[n,i]=C.useState(()=>{try{const l=localStorage.getItem(Oc+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});C.useEffect(()=>{try{localStorage.setItem(Oc+r+":tree-collapsed",JSON.stringify([...n]))}catch{}},[n,r]);const s=C.useMemo(()=>{const l={};for(const c of t)l[c.id]=c;return l},[t]),o=C.useMemo(()=>{var u,d;const l={},c={};for(const p of t)l[p.id]=[],c[p.id]=[];for(const p of e)(u=l[p.from])==null||u.push(p),(d=c[p.to])==null||d.push(p);return{out:l,inc:c}},[t,e]),a=l=>i(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return h.jsxs("div",{className:"w-full h-full overflow-y-auto",style:{background:"hsl(var(--background))",padding:"1rem"},children:[h.jsxs("div",{className:"flex items-center mb-4",style:{gap:"8px"},children:[h.jsx(os,{onClick:()=>i(new Set),children:"Expand all"}),h.jsx(os,{onClick:()=>i(new Set(t.map(l=>l.id))),children:"Collapse all"}),h.jsxs("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground))"},children:[t.length," entities · ",e.length," relations"]})]}),t.map(l=>{const c=n.has(l.id),u=o.out[l.id]||[],d=o.inc[l.id]||[],p=u.filter(g=>g.from===g.to),f=u.filter(g=>g.from!==g.to),m=d.filter(g=>g.from!==g.to),x=f.length+m.length+p.length;return h.jsxs("div",{className:"mb-0.5",children:[h.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:[h.jsx("span",{className:"text-xs w-4 text-center inline-block transition-transform",style:{color:"hsl(var(--muted-foreground))",transform:c?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),h.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"}}),h.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:l.label}),l.sublabel&&h.jsxs("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:["— ",l.sublabel]}),h.jsx("span",{className:"text-xs ml-auto",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:x})]}),!c&&h.jsxs("div",{style:{paddingLeft:"32px",paddingBottom:"4px"},children:[f.map((g,y)=>{var b,k;return h.jsx(oy,{arrow:"→",label:g.label,edgeStyle:g.style,color:g.color,targetLabel:((b=s[g.to])==null?void 0:b.label)||g.to,targetColor:(k=s[g.to])==null?void 0:k.color},`out-${y}`)}),p.map((g,y)=>h.jsx(oy,{arrow:"↻",label:g.label,edgeStyle:g.style,color:g.color,suffix:"(self)"},`self-${y}`)),m.map((g,y)=>{var b,k;return h.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground))"},children:[h.jsxs("span",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{background:((b=s[g.from])==null?void 0:b.color)||"hsl(var(--muted-foreground) / 0.6)"}}),h.jsx("span",{style:{color:"hsl(var(--foreground))"},children:((k=s[g.from])==null?void 0:k.label)||g.from})]}),h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→"}),h.jsx("span",{style:{color:g.color||"hsl(var(--muted-foreground))",fontStyle:g.style==="dashed"?"italic":"normal"},children:g.label||"connects"}),h.jsx("span",{style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:"→ this"}),g.style&&g.style!=="solid"&&h.jsxs("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:["(",g.style,")"]})]},`in-${y}`)}),x===0&&h.jsx("div",{className:"text-xs italic",style:{padding:"4px 8px",color:"hsl(var(--muted-foreground) / 0.6)"},children:"no relations"})]})]},l.id)})]})}function DK({elements:t,nodes:e,edges:r,layout:n,style:i,title:s,subtitle:o,graphKey:a="default",onNodeClick:l}){const c=C.useRef(null),u=C.useRef(null),[d,p]=C.useState(null),f=jK(),m=f?_K:EK,x=C.useMemo(()=>MK(a),[a]),[g,y]=C.useState((x==null?void 0:x.layoutKey)||"dagre-tb"),[b,k]=C.useState((x==null?void 0:x.showEdgeLabels)??!0),[S,E]=C.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[w,T]=C.useState((x==null?void 0:x.showLegend)??!0),[N,F]=C.useState((x==null?void 0:x.viewMode)||"graph");C.useEffect(()=>{IK(a,{layoutKey:g,showEdgeLabels:b,hiddenNodes:[...S],showLegend:w,viewMode:N})},[a,g,b,S,w,N]);const L=t||(e&&r?AK(e,r):[]),B=C.useMemo(()=>i||NK(m),[i,f]),W=n||LK[g],G=C.useMemo(()=>L.filter(_=>!_.data.source).map(_=>({id:_.data.id,label:_.data.label,color:_.data.color})),[JSON.stringify(L)]),O=C.useMemo(()=>S.size===0?L:L.filter(_=>_.data.source?!S.has(_.data.source)&&!S.has(_.data.target):!S.has(_.data.id)),[L,S]);C.useEffect(()=>{if(!c.current)return;const _=ma({container:c.current,elements:O,style:B,layout:W,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=_,_.on("mouseover","node",R=>{const X=R.target;X.style("border-width",2),X.style("border-opacity",1);const A=X.renderedPosition();p({x:A.x,y:A.y-X.renderedHeight()/2-12,label:X.data("label"),sublabel:X.data("sublabel"),id:X.id(),color:X.data("color")})}),_.on("mouseout","node",R=>{R.target.style("border-width",1),R.target.style("border-opacity",.5),p(null)}),l&&_.on("tap","node",R=>l(R.target.id())),_.on("layoutstop",()=>_.fit(void 0,40)),()=>{_.destroy(),u.current=null}},[JSON.stringify(O),JSON.stringify(W),f,N]),C.useEffect(()=>{const _=u.current;_&&_.edges().forEach(R=>{R.data("label")&&R.style("label",b?R.data("label"):"")})},[b]);const I=C.useCallback(()=>{var _;return(_=u.current)==null?void 0:_.fit(void 0,40)},[]),M=C.useCallback(()=>{const _=u.current;_&&_.zoom({level:_.zoom()*1.3,renderedPosition:{x:_.width()/2,y:_.height()/2}})},[]),P=C.useCallback(()=>{const _=u.current;_&&_.zoom({level:_.zoom()/1.3,renderedPosition:{x:_.width()/2,y:_.height()/2}})},[]),$=C.useCallback(_=>{E(R=>{const X=new Set(R);return X.has(_)?X.delete(_):X.add(_),X})},[]),D=C.useCallback(()=>E(new Set),[]);return N==="tree"?h.jsxs("div",{className:"w-full h-full flex flex-col",style:{background:"hsl(var(--background))"},children:[h.jsxs("div",{className:"flex items-center justify-between shrink-0",style:{padding:"8px 16px",borderBottom:"1px solid hsl(var(--border))"},children:[h.jsxs("div",{className:"flex items-center",style:{gap:"8px"},children:[s&&h.jsx("span",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&h.jsx("span",{className:"text-xs",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),h.jsxs("div",{className:"flex",style:{gap:"4px"},children:[h.jsx(xl,{mode:"graph",active:N==="graph",onClick:()=>F("graph")}),h.jsx(xl,{mode:"tree",active:N==="tree",onClick:()=>F("tree")})]})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(PK,{nodes:e||[],edges:r||[],graphKey:a})})]}):h.jsxs("div",{className:"w-full h-full relative",style:{background:"hsl(var(--background))"},children:[(s||o)&&h.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&&h.jsx("div",{className:"text-sm font-semibold",style:{color:"hsl(var(--foreground))"},children:s}),o&&h.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:o})]}),h.jsxs("div",{className:"absolute top-2 right-3 z-[2] flex items-center",style:{gap:"4px"},children:[h.jsx("select",{value:g,onChange:_=>y(_.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(BK).map(([_,R])=>h.jsx("option",{value:_,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:R},_))}),h.jsx($u,{}),h.jsx(os,{onClick:P,title:"Zoom out",children:"−"}),h.jsx(os,{onClick:I,title:"Fit to view",children:"Fit"}),h.jsx(os,{onClick:M,title:"Zoom in",children:"+"}),h.jsx($u,{}),h.jsx(os,{onClick:()=>T(!w),active:w,title:w?"Hide legend":"Show legend",children:"Legend"}),h.jsx($u,{}),h.jsx(xl,{mode:"graph",active:N==="graph",onClick:()=>F("graph")}),h.jsx(xl,{mode:"tree",active:N==="tree",onClick:()=>F("tree")})]}),w&&h.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:[h.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Entities"}),S.size>0&&h.jsx("button",{onClick:D,className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:"hsl(var(--primary))"},children:"Show all"})]}),h.jsx("div",{className:"flex flex-col gap-1",children:G.map(_=>{const R=S.has(_.id);return h.jsxs("button",{onClick:()=>$(_.id),className:"flex items-center gap-1.5 bg-transparent border-none py-0.5 cursor-pointer transition-opacity",style:{opacity:R?.35:1},title:R?`Show ${_.label}`:`Hide ${_.label}`,children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:R?"transparent":_.color,border:`1.5px solid ${_.color}`}}),h.jsx("span",{className:"text-xs",style:{color:R?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:R?"line-through":"none"},children:_.label})]},_.id)})}),h.jsxs("div",{className:"flex justify-between items-center mt-2.5 mb-1.5",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--muted-foreground))"},children:"Edges"}),h.jsx("button",{onClick:()=>k(!b),className:"text-[10px] bg-transparent border-none cursor-pointer p-0",style:{color:b?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.6)"},children:b?"Hide labels":"Show labels"})]}),h.jsx("div",{className:"flex flex-col gap-1",children:FK.map(_=>h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("svg",{width:"20",height:"6",className:"shrink-0",children:h.jsx("line",{x1:"0",y1:"3",x2:"20",y2:"3",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.5",strokeDasharray:_.dash||"none"})}),h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:_.label})]},_.style))})]}),d&&h.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:[h.jsx("div",{className:"text-sm font-semibold",style:{color:d.color||"hsl(var(--foreground))"},children:d.label}),d.sublabel&&h.jsx("div",{className:"text-xs mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:d.sublabel}),h.jsx("div",{className:"text-[10px] mt-1 font-mono",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:d.id})]}),h.jsx("div",{ref:c,className:"w-full h-full"})]})}const Wt={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"},OK=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:Wt.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:Wt.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:Wt.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:Wt.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:Wt.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:Wt.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:Wt.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:Wt.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:Wt.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:Wt.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:Wt.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:Wt.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:Wt.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:Wt.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:Wt.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:Wt.decision},{id:"question",label:"Question",sublabel:"may block progress",color:Wt.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:Wt.artifact}],$K=[{from:"p-vision",to:"p-specification",color:Wt.pipeline},{from:"p-specification",to:"p-planning",color:Wt.pipeline},{from:"p-planning",to:"p-implementation",color:Wt.pipeline},{from:"p-implementation",to:"p-verification",color:Wt.pipeline},{from:"p-verification",to:"p-release",color:Wt.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:Wt.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:Wt.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:Wt.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:Wt.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:Wt.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:Wt.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:Wt.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:Wt.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:Wt.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:Wt.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:Wt.track},{from:"task",to:"feature",label:"implements",color:Wt.task},{from:"spec",to:"feature",label:"implements",color:Wt.spec},{from:"feature",to:"feature",label:"blocks",color:Wt.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:Wt.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:Wt.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:Wt.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:Wt.artifact},{from:"question",to:"decision",label:"contradicts",color:Wt.question},{from:"feature",to:"p-vision",label:"enters",color:Wt.feature,style:"dashed"}];function RK(){return h.jsx(DK,{graphKey:"product",nodes:OK,edges:$K,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const zK="compose-popout";function L_(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 yl({path:t,onDock:e}){return h.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:[h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:L_(t)}),h.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:[h.jsx(bM,{style:{width:11,height:11}}),"pop in"]})]})}function WK({path:t}){const[e,r]=C.useState(null),[n,i]=C.useState(!0),s=C.useRef(null),o=C.useRef(null),a=t.startsWith("vision://")?"vision":t.startsWith("graph://")?"graph":t.endsWith(".html")||t.endsWith(".htm")?"html":"markdown";C.useEffect(()=>{document.title=L_(t)+" — Compose"},[t]),C.useEffect(()=>{const c=new BroadcastChannel(zK);s.current=c,c.postMessage({type:"popout-mounted",path:t});const u=()=>{c.postMessage({type:"popout-closed",path:t})};return window.addEventListener("beforeunload",u),()=>{u(),c.close(),window.removeEventListener("beforeunload",u)}},[t]);const l=C.useCallback(()=>{var c;(c=s.current)==null||c.postMessage({type:"popout-dock",path:t}),window.close()},[t]);return C.useEffect(()=>{if(a==="vision"||a==="graph"){i(!1);return}$t(`/api/file?path=${encodeURIComponent(t)}`).then(c=>c.json()).then(c=>{c.content!==void 0&&r(c.content),i(!1)}).catch(()=>i(!1))},[t,a]),C.useEffect(()=>{if(a==="vision"||a==="graph")return;const c=window.location.protocol==="https:"?"wss:":"ws:",u=new WebSocket(`${c}//${window.location.host}/ws/files`);return o.current=u,u.onmessage=d=>{try{const p=JSON.parse(d.data);p.type==="fileChanged"&&p.path===t&&r(p.content)}catch{}},()=>u.close()},[t,a]),n?h.jsx("div",{className:"h-screen w-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a==="vision"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(yl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(TK,{})})]}):a==="graph"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(yl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(RK,{})})]}):a==="html"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(yl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx("iframe",{srcDoc:e,className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin",title:t})})]}):h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(yl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 overflow-y-auto px-8 py-6",children:h.jsx("div",{className:"canvas-markdown max-w-4xl mx-auto",children:h.jsx(Rf,{remarkPlugins:[Hf],children:e||""})})})]})}const qK="/api/stratum";async function Nh(t,e={}){return(await $t(`${qK}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function HK(t,e){return Nh(t,{method:"POST",body:JSON.stringify(e)})}function B_({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 h.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 dm(){return h.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function UK({onAction:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState({}),[a,l]=C.useState({}),c=C.useCallback(()=>{Nh("/gates").then(d=>{r(Array.isArray(d)?d:[]),i(null)}).catch(d=>i(d.message))},[]);C.useEffect(()=>{c();const d=setInterval(c,1e4);return()=>clearInterval(d)},[c]);async function u(d,p,f){const m=`${d}/${p}/${f}`;o(g=>({...g,[m]:!0}));const x=a[`${d}/${p}`]||"";try{const g=await HK(`/gates/${d}/${p}/${f}`,{note:x});g.conflict?i(`Gate already resolved (${d}/${p})`):g.error?i(g.error.message):(t==null||t(),c())}catch(g){i(g.message)}finally{o(g=>({...g,[m]:!1}))}}return e===null&&!n?h.jsx(dm,{}):h.jsxs("section",{children:[h.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&&h.jsxs("span",{style:{opacity:1,color:"#f59e0b"},children:["(",e.length,")"]})]}),n&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em",margin:"0 0 8px"},children:n}),(e==null?void 0:e.length)===0&&h.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No pending gates."}),e==null?void 0:e.map(d=>{const p=`${d.flow_id}/${d.step_id}`,f=m=>s[`${p}/${m}`];return h.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",marginBottom:8,background:"#18181b"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[h.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:d.flow_name||d.flow_id}),h.jsx("span",{style:{opacity:.4,fontSize:"0.8em"},children:"›"}),h.jsx("span",{style:{fontFamily:"monospace",fontSize:"0.82em",opacity:.7},children:d.step_id}),d.function&&h.jsxs("span",{style:{opacity:.4,fontSize:"0.78em"},children:["fn:",d.function]})]}),h.jsx("input",{type:"text",placeholder:"Note (optional)",value:a[p]||"",onChange:m=>l(x=>({...x,[p]: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"}}),h.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})=>h.jsx("button",{disabled:f(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:f(m)?"not-allowed":"pointer",opacity:f(m)?.5:1},children:f(m)?"…":x},m))})]},p)})]})}function GK({flowId:t,onClose:e}){const[r,n]=C.useState(null),[i,s]=C.useState(null);return C.useEffect(()=>{Nh(`/flows/${t}`).then(o=>{o.error?s(o.error.message):n(o)}).catch(o=>s(o.message))},[t]),h.jsxs("div",{style:{border:"1px solid #3f3f46",borderRadius:6,padding:"10px 12px",background:"#18181b"},children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[h.jsx("span",{style:{fontWeight:600,fontSize:"0.9em"},children:(r==null?void 0:r.flow_name)||t}),h.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"1.1em"},children:"✕"})]}),i&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:i}),!r&&!i&&h.jsx(dm,{}),r&&h.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,c=r.step_count??"?";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:[h.jsx("span",{children:h.jsx(B_,{status:r.status})}),h.jsxs("span",{children:["steps ",l,"/",c,a.size>0&&h.jsxs("span",{style:{marginLeft:6,color:"#34d399",fontSize:"0.85em"},children:["∥ ",a.size," running"]})]}),r.round>0&&h.jsxs("span",{children:["round ",r.round]})]}),Array.isArray(r.ordered_steps)&&r.ordered_steps.length>0&&h.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",lineHeight:1.7},children:r.ordered_steps.map(u=>h.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:[h.jsx("span",{style:{fontFamily:"monospace"},children:u.id}),u.mode==="gate"&&h.jsx("span",{style:{marginLeft:6,color:"#f59e0b",fontSize:"0.9em"},children:"gate"}),a.has(u.id)&&h.jsx("span",{style:{marginLeft:6,fontSize:"0.85em"},children:"∥ running"})]},u.id))})]})})()})]})}function VK({activeBuild:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState(null),a=C.useCallback(()=>{Nh("/flows").then(l=>{r(Array.isArray(l)?l:[]),i(null)}).catch(l=>i(l.message))},[]);return C.useEffect(()=>{a();const l=setInterval(a,15e3);return()=>clearInterval(l)},[a]),C.useEffect(()=>{t&&a()},[t,a]),e===null&&!n?h.jsx(dm,{}):h.jsxs("section",{children:[h.jsx("h3",{style:{fontSize:"0.8em",textTransform:"uppercase",letterSpacing:"0.08em",opacity:.5,margin:"0 0 8px"},children:"Flows"}),n&&h.jsx("p",{style:{color:"#ef4444",fontSize:"0.8em"},children:n}),(e==null?void 0:e.length)===0&&h.jsx("p",{style:{opacity:.4,fontSize:"0.85em"},children:"No flows found."}),e==null?void 0:e.map(l=>h.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:h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx("span",{style:{fontSize:"0.88em",fontWeight:500},children:l.flow_name||l.flow_id}),h.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[h.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??"?"]}),h.jsx(B_,{status:l.status})]})]})},l.flow_id)),s&&h.jsx("div",{style:{marginTop:8},children:h.jsx(GK,{flowId:s,onClose:()=>o(null)})})]})}const YK={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 XK({build:t,onDismiss:e}){const r=t.status==="running",n=["complete","failed","aborted"].includes(t.status);C.useEffect(()=>{if(t.status==="complete"){const s=setTimeout(()=>e==null?void 0:e(),5e3);return()=>clearTimeout(s)}},[t.status,e]);const i={running:"#166534",complete:"#14532d",failed:"#7f1d1d",aborted:"#78350f"};return h.jsxs("div",{style:{border:`1px solid ${r?"#22c55e33":"#3f3f46"}`,borderRadius:6,padding:"10px 12px",marginBottom:12,background:i[t.status]||"#18181b"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[r&&h.jsx("span",{style:YK}),h.jsx("span",{style:{fontWeight:600,fontSize:"0.88em"},children:t.featureCode}),h.jsx("span",{style:{opacity:.5,fontSize:"0.78em"},children:r?"building":t.status})]}),n&&t.status!=="complete"&&h.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"0.9em"},children:"✕"})]}),h.jsxs("div",{style:{fontSize:"0.8em",opacity:.7,marginTop:4,fontFamily:"monospace"},children:[t.currentStepId,t.stepNum!=null&&t.totalSteps!=null&&h.jsxs("span",{style:{marginLeft:8,opacity:.5},children:["(",t.stepNum,"/",t.totalSteps,")"]}),t.retries>0&&h.jsxs("span",{style:{marginLeft:8,color:"#f59e0b"},children:["retry ",t.retries]})]})]})}function KK(){const t=pr(s=>s.activeBuild),[e,r]=C.useState(null),n=C.useCallback(()=>{t&&r(`${t.flowId}:${t.completedAt}`)},[t]);C.useEffect(()=>{(t==null?void 0:t.status)==="running"&&r(null)},[t==null?void 0:t.status]);const i=t&&!(e&&e===`${t.flowId}:${t.completedAt}`);return h.jsxs("div",{style:{padding:"12px 14px",color:"#e4e4e7",fontSize:"0.9em",overflowY:"auto",height:"100%"},children:[i&&h.jsx(XK,{build:t,onDismiss:n}),h.jsx(UK,{}),h.jsx("div",{style:{marginTop:20},children:h.jsx(VK,{activeBuild:t})})]})}const ZK={dashboard:{label:"Dashboard",icon:eI},tree:{label:"Items",icon:s1},graph:{label:"Graph",icon:dI},pipeline:{label:"Pipeline",icon:FI},sessions:{label:"Sessions",icon:Uf},gates:{label:"Gates",icon:qs},docs:{label:"Docs",icon:Bi},design:{label:"Design",icon:Gc},ideabox:{label:"Ideabox",icon:Ci}};function QK({tabs:t=[],activeTab:e,onTabChange:r,onOpenPalette:n,badges:i={}}){return h.jsxs("div",{className:"flex items-center gap-0.5 h-full",role:"tablist","aria-label":"Main views",children:[t.map(s=>{const o=ZK[s],a=s===e,l=o==null?void 0:o.icon,c=(o==null?void 0:o.label)||s,u=i[s];return h.jsxs("button",{role:"tab","aria-selected":a,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-accent text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>r==null?void 0:r(s),children:[l&&h.jsx(l,{style:{width:12,height:12}}),c,u>0&&h.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)}),h.jsx("div",{className:"flex-1"}),n&&h.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:[h.jsx(Zn,{style:{width:12,height:12}}),h.jsx("kbd",{className:"text-[9px] font-mono opacity-50 bg-muted px-1 py-0.5 rounded",children:"⌘K"})]})]})}function JK(){const[t,e]=C.useState(Uy);function r(){const n=!t;ME(n),e(n)}return h.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 Ue={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},tZ={[Ue.COLLAPSED]:Ue.EXPANDED,[Ue.EXPANDED]:Ue.MAXIMIZED,[Ue.MAXIMIZED]:Ue.COLLAPSED};function eZ(t){return tZ[t]??Ue.COLLAPSED}function rZ(t){return Ue.COLLAPSED}function nZ(t){return Ue.MAXIMIZED}const iZ=new Set(Object.values(Ue));function sZ(t){return iZ.has(t)}function oZ(t){switch(t){case Ue.COLLAPSED:return"h-7";case Ue.EXPANDED:return"h-[40vh]";case Ue.MAXIMIZED:return"flex-1";default:return"h-7"}}const A_="compose:agentBarState";function aZ(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(A_);return sZ(e)?e:Ue.COLLAPSED}catch{return Ue.COLLAPSED}}function lZ(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(A_,t)}catch{}}const ay="▾",cZ="▴",hZ="⤢";function uZ({barState:t="collapsed",onStateChange:e}){const[r,n]=C.useState("idle"),[i,s]=C.useState(null);C.useEffect(()=>{function u(d){const{status:p,tool:f,category:m,parallelTasks:x}=d.detail??{};if(s(x??null),x){const{total:g,completed:y,failed:b,active:k}=x;n(`∥ ${y}/${g} tasks${b?` (${b} failed)`:""}${k?` • ${k} active`:""}`)}else n(p==="idle"?"idle":f?`${f} — ${m??p}`:m||(p??"idle"))}return window.addEventListener("compose:agent-status",u),()=>window.removeEventListener("compose:agent-status",u)},[]);const o=C.useCallback(()=>{e==null||e(eZ(t))},[t,e]),a=C.useCallback(()=>{e==null||e(rZ())},[t,e]);C.useCallback(()=>{e==null||e(nZ())},[t,e]);const l=t==="collapsed",c=t==="expanded";return h.jsxs("div",{className:"flex flex-col shrink-0 overflow-hidden",style:{borderTop:"1px solid hsl(var(--border))"},"data-agent-bar-state":t,children:[h.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:[h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:o,title:l?"Expand agent bar":c?"Maximize agent bar":"Collapse agent bar","aria-label":"Toggle agent bar",children:l?cZ:c?hZ:ay}),h.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold shrink-0",style:{color:"hsl(var(--accent))"},children:"Agent"}),h.jsx("span",{className:"flex-1 min-w-0 truncate text-[11px] font-mono",style:{color:"hsl(var(--muted-foreground))"},children:r}),h.jsx(JK,{}),i&&i.total>0&&h.jsx("div",{className:"shrink-0 flex items-center gap-1",title:`${i.completed}/${i.total} tasks complete`,children:h.jsx("div",{style:{width:48,height:4,borderRadius:2,background:"hsl(var(--muted))",overflow:"hidden"},children:h.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&&h.jsx("button",{className:"compose-btn-icon shrink-0",onClick:a,title:"Collapse agent bar","aria-label":"Collapse agent bar",children:ay})]}),!l&&h.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:h.jsx(Vy,{})})]})}const dZ=280,fZ=.6;function pZ({isOpen:t=!1,onToggle:e,widthPx:r=380,onResizePx:n,children:i,activeBuild:s,gates:o=[],agentErrors:a=[],items:l=[]}){const c=C.useRef(!1),u=C.useCallback(p=>{p.preventDefault(),c.current=!0;const f=x=>{if(!c.current)return;const g=window.innerWidth-x.clientX,y=window.innerWidth*fZ,b=Math.max(dZ,Math.min(y,g));n==null||n(b)},m=()=>{c.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",m)},[n]),d=o.filter(p=>p.status==="pending"||p.status==="awaiting");return h.jsxs("div",{className:"flex shrink-0 h-full",style:{borderLeft:"1px solid hsl(var(--border))"},"data-context-panel-open":t,children:[t&&n&&h.jsx("div",{className:"w-1 cursor-col-resize hover:bg-accent/30 active:bg-accent/50 transition-colors flex-shrink-0",onMouseDown:u}),h.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&&h.jsx("div",{className:"flex flex-col h-full overflow-hidden",style:{width:`${r}px`},children:Vt.Children.toArray(i).length>0?h.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):h.jsx(gZ,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const mZ={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function ly(t){return mZ[t]||"#6b7280"}function gZ({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 h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"h-7 flex items-center px-3 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:h.jsx("span",{className:"text-[10px] uppercase tracking-wider font-semibold text-muted-foreground",children:"Project Overview"})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-3 space-y-4",children:[t?h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Active Build"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-xs text-accent font-mono",children:t.featureCode||"—"}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),h.jsx("span",{className:"text-[10px] text-foreground",children:t.currentStep||t.step||"—"})]})]}):h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Status"}),h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No active build"})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Pending Gates (",e.length,")"]}),e.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):h.jsx("div",{className:"space-y-0.5",children:e.slice(0,5).map((a,l)=>h.jsx("p",{className:"text-[10px] text-amber-400 truncate",children:Zo(a,n.find(c=>c.id===a.itemId))},l))})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Recent Errors (",o.length,")"]}),o.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"None"}):h.jsx("div",{className:"space-y-0.5",children:o.map((a,l)=>h.jsx("p",{className:"text-[10px] text-destructive truncate",children:a.message||a.error||"Error"},l))})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase Distribution"}),h.jsx("div",{className:"flex h-2 rounded overflow-hidden gap-px",children:Object.entries(i).map(([a,l])=>h.jsx("div",{className:"h-full",style:{width:`${l/s*100}%`,background:ly(a),opacity:.75,minWidth:"2px"},title:`${a}: ${l}`},a))}),h.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 mt-1",children:Object.entries(i).map(([a,l])=>h.jsxs("span",{className:"text-[9px] text-muted-foreground flex items-center gap-1",children:[h.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:ly(a)}}),a,": ",l]},a))})]})]})]})}const In=60,Or=24,bl=80,Ru=28,zu=48,cy=8,fs=5,$c=9;function xZ(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function yZ(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 c of r)if(c.fromId===a.id&&c.toId!==t.id){const u=n.get(c.toId);u&&l.push(u)}l.length>0&&o.set(a.id,l)}return{parents:i,children:s,grandchildren:o}}function Wu(t,e,r,n,i){const s=Math.min(t,fs),o=s*n+(s-1)*cy,a=(r-o)/2,l=[];for(let c=0;c<s;c++)l.push({x:a+c*(n+cy),y:e,w:n,h:i});return{positions:l,overflow:t>fs?t-fs+1:0}}function Cl({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:c}){const u=mr[t.type]||mr.task,d=s?.2:.08;return h.jsxs("g",{style:{cursor:"pointer"},onClick:()=>a(t.id),onMouseEnter:p=>l(t,p),onMouseLeave:c,children:[h.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}),h.jsx("text",{x:e+n/2,y:r+i/2,textAnchor:"middle",dominantBaseline:"central",fontSize:s?$c+1:$c,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:xZ(t.title,s?10:8)})]})}function bZ({item:t,pos:e}){if(!t||!e)return null;const r=mr[t.type]||mr.task,n=qn[t.status]||qn.planned;return h.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:[h.jsx("p",{className:"text-xs font-medium text-foreground whitespace-nowrap",children:t.title}),h.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[h.jsx("span",{className:"text-[10px]",style:{color:r},children:t.type}),h.jsxs("span",{className:"text-[10px] flex items-center gap-1",children:[h.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full",style:{background:n}}),t.status]}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:Sf[t.confidence||0]})]})]})}function CZ({item:t,items:e,connections:r,onSelect:n}){const[i,s]=C.useState(null),[o,a]=C.useState(null),{parents:l,children:c,grandchildren:u}=C.useMemo(()=>yZ(t,e,r),[t,e,r]),d=C.useCallback((I,M)=>{const P=M.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),$=M.currentTarget.getBoundingClientRect();s(I),a({x:$.x+$.width/2-P.x,y:$.y-P.y-4})},[]),p=C.useCallback(()=>{s(null),a(null)},[]);if(!(l.length>0||c.length>0))return null;const m=288,x=[];let g=12,y=[],b=0;if(l.length>0){const I=Wu(l.length,g,m,In,Or);y=I.positions,b=I.overflow,g+=Or+zu}const k=(m-bl)/2,S=g;g+=Ru+zu;let E=[],w=0;if(c.length>0){const I=Wu(c.length,g,m,In,Or);E=I.positions,w=I.overflow,g+=Or}let T=new Map,N=new Map;const F=[...u.entries()];let L=[];if(F.length>0){g+=zu;for(const[P,$]of F)for(const D of $)L.push({...D,_parentChildId:P});const I=Wu(L.length,g,m,In,Or);let M=0;for(const[P,$]of F){const D=[];for(let _=0;_<$.length&&M<I.positions.length;_++,M++)D.push(I.positions[M]);T.set(P,D)}I.overflow>0&&N.set("all",I.overflow),g+=Or}const B=g+12;for(let I=0;I<y.length;I++){const M=y[I];x.push({x1:M.x+M.w/2,y1:M.y+M.h,x2:k+bl/2,y2:S})}for(let I=0;I<E.length;I++){const M=E[I];x.push({x1:k+bl/2,y1:S+Ru,x2:M.x+M.w/2,y2:M.y})}for(const[I,M]of T){const P=c.findIndex($=>$.id===I);if(P>=0&&P<E.length){const $=E[P];for(const D of M)x.push({x1:$.x+$.w/2,y1:$.y+$.h,x2:D.x+D.w/2,y2:D.y})}}const W=l.slice(0,fs-(b>0?1:0)),G=c.slice(0,fs-(w>0?1:0)),O=L.slice(0,fs-(N.size>0?1:0));return h.jsxs("div",{className:"space-y-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Graph"}),h.jsxs("div",{className:"relative connection-graph-wrap",children:[h.jsxs("svg",{width:m,height:B,className:"w-full",viewBox:`0 0 ${m} ${B}`,children:[x.map((I,M)=>h.jsx("line",{x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},M)),W.map((I,M)=>h.jsx(Cl,{item:I,x:y[M].x,y:y[M].y,w:In,h:Or,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:p},I.id)),b>0&&h.jsxs("text",{x:y[y.length-1].x+In/2,y:y[0].y+Or/2,textAnchor:"middle",dominantBaseline:"central",fontSize:$c,fill:"hsl(var(--muted-foreground))",children:["+",b," more"]}),h.jsx(Cl,{item:t,x:k,y:S,w:bl,h:Ru,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:p}),G.map((I,M)=>h.jsx(Cl,{item:I,x:E[M].x,y:E[M].y,w:In,h:Or,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},I.id)),w>0&&h.jsxs("text",{x:E[E.length-1].x+In/2,y:E[0].y+Or/2,textAnchor:"middle",dominantBaseline:"central",fontSize:$c,fill:"hsl(var(--muted-foreground))",children:["+",w," more"]}),O.map((I,M)=>{const $=[...T.values()].flat()[M];return $?h.jsx(Cl,{item:I,x:$.x,y:$.y,w:In,h:Or,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},I.id):null})]}),h.jsx(bZ,{item:i,pos:o})]})]})}const kZ=["Untested","Low","Moderate","High","Crystallized"];function vZ({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=kZ[r]??"Untested",i=r===0?xm[0]:xm[r];return h.jsxs("span",{className:nt("inline-flex items-center gap-1",e),children:[h.jsx("span",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(s=>h.jsx("span",{className:nt("h-2.5 w-1.5 rounded-sm",s<=r?i:"bg-slate-600")},s))}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:n})]})}function wZ(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 hy(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function SZ(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function TZ(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 _Z(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:wZ(new Date(n).toISOString(),e)}function EZ(t,e=Date.now()){const r=(t==null?void 0:t.branches)||[],n=r.filter(c=>c.state==="complete"),i=r.filter(c=>c.state==="running"),s=r.length,o=_Z(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 NZ(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 uy({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:`${hy(i.tokens_in)} / ${hy(i.tokens_out)}`},{label:"USD",value:SZ(i.usd)},{label:"Wall clock",value:TZ(i.wall_clock_ms)},{label:"Final artifact",value:((o=t.final_artifact)==null?void 0:o.path)||"—"},...e];return h.jsx("div",{className:"space-y-1",children:s.map((a,l)=>h.jsxs("div",{className:"flex justify-between gap-2 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:a.label}),h.jsx("span",{className:"font-mono text-right truncate",title:typeof a.value=="string"?a.value:void 0,children:a.value})]},l))})}function jZ({lineage:t,selectedPair:e=[],onSelectPair:r=()=>{},extraMetricsForBranch:n=()=>[],now:i=Date.now()}){var g,y;const[s,o]=C.useState(!1),{summary:a,canCompare:l,completeBranches:c}=EZ(t,i),[u,d]=NZ(c,e),p=()=>{l&&(o(b=>!b),!s&&u&&d&&r([u.branch_id,d.branch_id]))};if(!s)return h.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[h.jsx("span",{children:a}),h.jsx("button",{disabled:!l,onClick:p,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 f=(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=!!f&&!!m;return h.jsxs("div",{className:"space-y-2 rounded border border-border p-2 bg-muted/10",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:a}),h.jsx("button",{onClick:()=>o(!1),className:"text-[10px] text-muted-foreground hover:text-foreground",children:"Collapse"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{children:[h.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&&h.jsx(uy,{branch:u,extraRows:n(u)})]}),h.jsxs("div",{children:[h.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&&h.jsx(uy,{branch:d,extraRows:n(d)})]})]}),h.jsx("div",{className:"col-span-2",children:x?h.jsx(om,{oldText:f,newText:m}):h.jsxs("div",{className:"text-[10px] italic text-muted-foreground",children:["No artifact produced on ",!f&&!m?"either branch":f?"branch B":"branch A","."]})})]})}const LZ={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function BZ(t){return LZ[t]??t}function dy(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function AZ(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 MZ({item:t}){const[e,r]=C.useState(!1),n=AZ(t);if(n.length===0)return null;const i=n.length;return h.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:[h.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:[h.jsx(Vc,{size:13}),h.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?h.jsx(e1,{size:13,style:{marginLeft:"auto"}}):h.jsx(Ca,{size:13,style:{marginLeft:"auto"}})]}),e&&h.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse",marginTop:"4px"},"data-testid":"drift-ribbon-table",children:[h.jsx("thead",{children:h.jsxs("tr",{style:{color:"hsl(var(--muted-foreground))"},children:[h.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Axis"}),h.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Ratio"}),h.jsx("th",{style:{textAlign:"right",padding:"2px 4px",fontWeight:500},children:"Threshold"}),h.jsx("th",{style:{textAlign:"left",padding:"2px 4px",fontWeight:500},children:"Explanation"})]})}),h.jsx("tbody",{children:n.map(s=>h.jsxs("tr",{"data-testid":`drift-axis-row-${s.axis_id}`,children:[h.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--foreground))",fontWeight:500},children:BZ(s.axis_id)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:dy(s.ratio)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:dy(s.threshold)}),h.jsx("td",{style:{padding:"2px 4px",color:"hsl(var(--muted-foreground))",maxWidth:"200px",wordBreak:"break-word"},children:s.explanation??""})]},s.axis_id))})]})]})}function IZ({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 h.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:[h.jsx("span",{className:"text-xs text-muted-foreground",children:Sf[t]}),h.jsx("div",{className:"flex items-center gap-0.5",children:[0,1,2,3].map(i=>h.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 FZ({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 c=s.get(l.toId);c&&o.push({item:c,type:l.type,direction:"outgoing",connId:l.id})}if(l.toId===t.id){const c=s.get(l.fromId);c&&o.push({item:c,type:l.type,direction:"incoming",connId:l.id})}}if(o.length===0)return null;const a={};for(const l of o){const c=`${l.type}-${l.direction}`;a[c]||(a[c]={type:l.type,direction:l.direction,items:[]}),a[c].items.push({item:l.item,connId:l.connId})}return h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Connections"}),Object.values(a).map(l=>h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] text-muted-foreground mb-1",children:l.direction==="incoming"?`${l.type} from`:`${l.type} to`}),h.jsx("div",{className:"space-y-0.5",children:l.items.map(({item:c,connId:u})=>h.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:[h.jsxs("button",{onClick:()=>n(c.id),className:"flex flex-1 items-center gap-2 min-w-0",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:qn[c.status]||qn.planned}}),h.jsx("span",{className:"text-xs text-foreground truncate",children:c.title}),h.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:mr[c.type]},children:c.type})]}),i&&h.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:h.jsx(ln,{className:"h-3 w-3"})})]},u))})]},`${l.type}-${l.direction}`))]})}function kl(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 PZ({featureCode:t,lineage:e}){const r=pr(i=>i.selectedBranches),n=pr(i=>i.setSelectedBranches);return h.jsx(jZ,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function DZ({featureCode:t}){const[e,r]=C.useState([]),[n,i]=C.useState(!0);return C.useEffect(()=>{const s=new AbortController;return i(!0),$t(`/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:h.jsxs("div",{children:[h.jsxs("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Sessions (",e.length,")"]}),h.jsx("div",{className:"space-y-2",children:e.map(s=>{var o;return h.jsxs("div",{className:"text-xs text-muted-foreground border-l-2 border-border pl-2",children:[h.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," ")}`]}),h.jsxs("div",{children:[s.toolCount," tools · ",Math.round((new Date(s.endedAt)-new Date(s.startedAt))/6e4),"m"]})]},s.id)})})]})}const OZ=["informs","supports","blocks","contradicts"];function $Z({item:t,items:e,onCreateConnection:r,onDismiss:n}){const[i,s]=C.useState(""),[o,a]=C.useState("informs"),l=e.filter(u=>u.id===t.id?!1:i?u.title.toLowerCase().includes(i.toLowerCase()):!0).slice(0,8),c=C.useCallback(async u=>{await r({fromId:t.id,toId:u,type:o}),n()},[t.id,o,r,n]);return h.jsx("div",{className:"absolute bottom-full left-0 mb-1 w-64 rounded-md border border-border bg-popover shadow-lg z-50",children:h.jsxs("div",{className:"p-2 space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.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:OZ.map(u=>h.jsx("option",{value:u,children:u},u))}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"to..."})]}),h.jsxs("div",{className:"relative",children:[h.jsx(Zn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),h.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})]}),h.jsx("div",{className:"max-h-40 overflow-auto space-y-0.5",children:l.length===0?h.jsx("p",{className:"text-[10px] text-muted-foreground text-center py-2",children:"No items found"}):l.map(u=>h.jsxs("button",{onClick:()=>c(u.id),className:"flex w-full items-center gap-2 px-2 py-1 rounded text-left hover:bg-muted/50 transition-colors",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:qn[u.status]||qn.planned}}),h.jsx("span",{className:"text-xs text-foreground truncate",children:u.title}),h.jsx("span",{className:"text-[10px] ml-auto shrink-0",style:{color:mr[u.type]},children:u.type})]},u.id))})]})})}function RZ({gate:t,onResolveGate:e}){const[r,n]=C.useState(null),[i,s]=C.useState(""),o=()=>{e(t.id,"revised",i||void 0),n(null),s("")},a=()=>{i.trim()&&(e(t.id,"killed",i),n(null),s(""))};return h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Rt,{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"}),h.jsx(Rt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-amber-400 border-amber-400/30 hover:bg-amber-400/10",r==="revise"&&"bg-amber-400/10"),onClick:()=>{n(r==="revise"?null:"revise"),s("")},children:"Revise"}),h.jsx(Rt,{variant:"outline",size:"sm",className:nt("h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",r==="kill"&&"bg-destructive/10"),onClick:()=>{n(r==="kill"?null:"kill"),s("")},children:"Kill"})]}),r&&h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.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}),h.jsx(Rt,{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 zZ({item:t,items:e,connections:r,gates:n,onUpdate:i,onDelete:s,onCreateConnection:o,onDeleteConnection:a,onSelect:l,onClose:c,onPressureTest:u,onResolveGate:d}){var I,M,P,$,D,_;const[p,f]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[b,k]=C.useState(""),[S,E]=C.useState(!1),[w,T]=C.useState("");C.useEffect(()=>{T((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const N=C.useCallback(()=>{const R=w.trim(),X=(t==null?void 0:t.group)||"";R!==X&&i(t.id,{group:R||null})},[w,t==null?void 0:t.id,t==null?void 0:t.group,i]),F=C.useCallback(()=>{x(t.title),f(!0)},[t==null?void 0:t.title]),L=C.useCallback(()=>{m.trim()&&m!==t.title&&i(t.id,{title:m.trim()}),f(!1)},[m,t==null?void 0:t.id,t==null?void 0:t.title,i]),B=C.useCallback(()=>{k(t.description||""),y(!0)},[t==null?void 0:t.description]),W=C.useCallback(()=>{b!==(t.description||"")&&i(t.id,{description:b}),y(!1)},[b,t==null?void 0:t.id,t==null?void 0:t.description,i]),G=C.useMemo(()=>{if(!t)return 0;let R=0;for(const X of r)X.type==="contradicts"&&(X.fromId===t.id||X.toId===t.id)&&R++;return R},[t==null?void 0:t.id,r]);if(!t)return null;const O=mr[t.type]||mr.task;return h.jsxs("div",{className:"w-full bg-card flex flex-col h-full",children:[h.jsxs("div",{className:"p-3 pb-2 flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[h.jsx(er,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:O,borderColor:O},children:t.type}),t.phase&&h.jsx(er,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:Rl[t.phase]||t.phase})]}),p?h.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:m,onChange:R=>x(R.target.value),onBlur:L,onKeyDown:R=>{R.key==="Enter"&&L(),R.key==="Escape"&&f(!1)},autoFocus:!0}):h.jsx("h3",{className:"text-sm font-semibold text-foreground cursor-pointer hover:text-accent transition-colors",onDoubleClick:F,title:"Double-click to edit",children:t.title})]}),h.jsx(Rt,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:c,children:h.jsx(ln,{className:"h-3.5 w-3.5"})})]}),h.jsx(Ql,{}),h.jsx(Hn,{className:"flex-1",children:h.jsxs("div",{className:"p-3 space-y-4",children:[h.jsx(MZ,{item:t}),((I=t.lifecycle)==null?void 0:I.featureCode)&&h.jsx(PZ,{featureCode:t.lifecycle.featureCode,lineage:(M=t.lifecycle.lifecycle_ext)==null?void 0:M.branch_lineage}),h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.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:R=>i(t.id,{status:R.target.value}),children:aE.map(R=>h.jsx("option",{value:R,children:R.replace("_"," ")},R))}),h.jsx(IZ,{level:t.confidence||0,onChange:R=>i(t.id,{confidence:R})})]}),h.jsx(vZ,{level:t.confidence||0}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Phase"}),h.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:R=>i(t.id,{phase:R.target.value||null}),children:[h.jsx("option",{value:"",children:"No phase"}),Ry.map(R=>h.jsx("option",{value:R,children:Rl[R]},R))]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Group"}),h.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:w,placeholder:"(none)",onChange:R=>T(R.target.value),onBlur:N,onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),R.currentTarget.blur()),R.key==="Escape"&&(T(t.group||""),R.currentTarget.blur())},"data-testid":"item-detail-group-input"})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),g?h.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:R=>k(R.target.value),onBlur:W,onKeyDown:R=>{R.key==="Escape"&&y(!1)},autoFocus:!0}):h.jsx("p",{className:nt("text-xs leading-relaxed cursor-pointer rounded px-2 py-1.5 hover:bg-muted/50 transition-colors",t.description?"text-muted-foreground":"text-muted-foreground/50 italic"),onClick:B,children:t.description||"Click to add description..."})]}),h.jsx(FZ,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),h.jsx(CZ,{item:t,items:e,connections:r,onSelect:l}),((P=t.lifecycle)==null?void 0:P.featureCode)&&h.jsx(DZ,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(R=>R.itemId===t.id))&&(()=>{var st;const R=t.lifecycle,X=n?n.filter(J=>J.itemId===t.id):[],A=X.filter(J=>J.status==="pending"),ct=X.filter(J=>J.status!=="pending");return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Lifecycle"}),h.jsxs("div",{className:"space-y-1.5",children:[R&&h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Phase:"}),h.jsx("span",{className:"text-[10px] text-foreground font-medium",children:Se[R.currentPhase]??R.currentPhase}),R.featureCode&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:R.featureCode})]}),((st=R==null?void 0:R.phaseHistory)==null?void 0:st.length)>1&&h.jsxs("div",{className:"px-2 py-1 rounded bg-muted/30",children:[h.jsx("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"History"}),h.jsx("div",{className:"flex flex-wrap gap-x-1 gap-y-0.5",children:R.phaseHistory.map((J,yt)=>h.jsxs("span",{className:nt("text-[10px]",J.phase===R.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[Se[J.phase]??J.phase,J.outcome&&J.outcome!=="approved"&&h.jsxs("span",{className:"text-amber-400",children:[" (",J.outcome,")"]}),yt<R.phaseHistory.length-1&&" → "]},yt))})]}),A.map(J=>{var lt,Z;const yt=J.artifactAssessment,Ot=zy[J.fromPhase];return h.jsxs("div",{className:"rounded bg-amber-400/10 border border-amber-400/20 px-2 py-1.5",children:[h.jsxs("p",{className:"text-[10px] text-amber-400 font-medium mb-1",children:["Pending: ",kn[J.stepId]??`${Se[J.fromPhase]??J.fromPhase} → ${Se[J.toPhase]??J.toPhase}`]}),yt&&yt.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[Ot&&h.jsx("span",{className:"font-mono",children:Ot}),Ot&&": ",Math.round(yt.completeness*100),"% complete"," · ",yt.wordCount," words",((Z=(lt=yt.sections)==null?void 0:lt.missing)==null?void 0:Z.length)>0&&h.jsxs("span",{className:"text-amber-400",children:[" (missing: ",yt.sections.missing.join(", "),")"]}),!yt.meetsMinWordCount&&h.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),yt&&!yt.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[Ot??"Artifact"," not found"]}),d&&h.jsx(RZ,{gate:J,onResolveGate:d})]},J.id)}),ct.map(J=>{const yt={approved:"text-success",revised:"text-amber-400",killed:"text-destructive"};return h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:kn[J.stepId]??`${Se[J.fromPhase]??J.fromPhase} → ${Se[J.toPhase]??J.toPhase}`}),h.jsx(er,{variant:"outline",className:nt("text-[10px] px-1.5 py-0 h-4 ml-auto",yt[J.outcome]||""),children:J.outcome})]},J.id)})]})]})})(),((D=($=t.evidence)==null?void 0:$.stratumViolations)==null?void 0:D.length)>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1.5",children:["Blocked — Ensure Violations",t.evidence.violatedAt&&h.jsx("span",{className:"ml-2 font-normal normal-case text-muted-foreground",children:kl(t.evidence.violatedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((R,X)=>h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:R})]},X))})]}),((_=t.evidence)==null?void 0:_.stratumTrace)&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:["Stratum Trace",t.evidence.tracedAt&&h.jsx("span",{className:"ml-2 font-normal normal-case",children:kl(t.evidence.tracedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(R=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded bg-muted/30",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"hsl(var(--success))"}}),h.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:R.step_id}),R.attempts>1&&h.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[R.attempts,"x"]}),R.duration_ms!=null&&h.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:R.duration_ms<1e3?`${R.duration_ms}ms`:`${(R.duration_ms/1e3).toFixed(1)}s`})]},R.step_id))})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",kl(t.createdAt)]}),h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",kl(t.updatedAt)]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsxs("div",{className:"relative",children:[h.jsxs(Rt,{variant:"outline",size:"sm",className:nt("h-7 text-xs gap-1",S&&"bg-accent/10 border-accent"),onClick:()=>E(!S),children:[h.jsx(iI,{className:"h-3 w-3"})," Connect"]}),S&&h.jsx($Z,{item:t,items:e,onCreateConnection:o,onDismiss:()=>E(!1)})]}),h.jsxs(Rt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:F,children:[h.jsx(a1,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&h.jsxs(Rt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[h.jsx(Vl,{className:"h-3 w-3"})," Pressure Test",G>0&&h.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:G})]}),t.status!=="killed"&&h.jsxs(Rt,{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 R=await $t(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!R.ok){const X=await R.json();console.error("[vision] Lifecycle kill failed:",X.error)}}catch(R){console.error("[vision] Lifecycle kill failed:",R.message)}else i(t.id,{status:"killed"})},children:[h.jsx(mg,{className:"h-3 w-3"})," Kill"]}),s&&h.jsxs(Rt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>{window.confirm(`Delete "${t.title}" permanently? This cannot be undone.`)&&s(t.id)},title:"Permanently delete this item",children:[h.jsx(mg,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const M_=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];M_.map(t=>t.id);const WZ={overview:Bi,pipeline:s1,sessions:n1,errors:Vc,files:Vf};function qZ({activeTab:t="overview",onTabChange:e,errorCount:r=0}){return h.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:M_.map(({id:n,label:i})=>{const s=WZ[n],o=n===t,a=n==="errors"?r:0;return h.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:[h.jsx(s,{style:{width:10,height:10}}),i,a>0&&h.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 fy=[{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 pf(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 HZ({item:t,activeBuild:e}){const[r,n]=C.useState(null),i=(t==null?void 0:t.phaseHistory)||[],s=(t==null?void 0:t.featureCode)||(t==null?void 0:t.text)||"";return h.jsxs("div",{className:"p-3",children:[h.jsx("div",{className:"flex items-center gap-0 mb-3",children:fy.map((o,a)=>{const l=pf(o.id,i,e,s),c=gm[l],u=r===o.id;return h.jsxs(Vt.Fragment,{children:[a>0&&h.jsx("div",{className:"flex-1 h-px",style:{background:l==="pending"?"hsl(var(--muted-foreground) / 0.2)":c,minWidth:"8px"}}),h.jsxs("button",{onClick:()=>n(u?null:o.id),className:"relative flex flex-col items-center group",title:o.label,children:[h.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:c,background:l==="complete"||l==="failed"?c:"transparent"}}),h.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)})}),h.jsx("div",{className:"flex justify-between px-0.5",children:fy.map(o=>{const a=pf(o.id,i,e,s);return h.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider",style:{color:a==="pending"?"hsl(var(--muted-foreground) / 0.4)":gm[a]},children:o.label},o.id)})}),r&&h.jsx("div",{className:"mt-3 p-2 rounded border border-border/50 bg-muted/20",children:h.jsx(UZ,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function UZ({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=pf(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 h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs font-semibold text-foreground capitalize",children:t}),h.jsx("span",{className:`text-[10px] font-medium ${o[i]}`,children:i})]}),(s==null?void 0:s.summary)&&h.jsx("p",{className:"text-[10px] text-muted-foreground",children:s.summary}),(s==null?void 0:s.durationMs)!=null&&h.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)&&h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Agent: ",s.agent]}),i==="active"&&r&&h.jsx("p",{className:"text-[10px] text-accent",children:"Running..."}),i==="pending"&&h.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Not started"})]})}function GZ(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 VZ(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function YZ({featureCode:t,sessions:e=[],items:r=[]}){const[n,i]=C.useState(null),s=C.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=C.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?h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"No sessions for this feature."}):h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.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 h.jsxs("div",{children:[h.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:[h.jsx("span",{className:"text-[10px] font-mono text-accent shrink-0 w-12 truncate",children:a.source||"agent"}),h.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 w-16 truncate",children:a.classification||a.workType||"—"}),h.jsxs("span",{className:"text-[9px] text-muted-foreground tabular-nums flex gap-1.5 shrink-0",children:[h.jsxs("span",{title:"reads",children:[a.reads||0,"r"]}),h.jsxs("span",{title:"writes",children:[a.writes||0,"w"]}),h.jsxs("span",{title:"errors",style:a.errors>0?{color:"hsl(var(--destructive))"}:{},children:[a.errors||0,"e"]})]}),h.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:VZ(a.durationMs)}),h.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:GZ(a.startedAt||a.createdAt)})]}),l&&a.summary&&h.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 XZ(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 qu=10;function KZ({featureCode:t,errors:e=[],items:r=[]}){const[n,i]=C.useState(null),[s,o]=C.useState(!1),a=C.useMemo(()=>t?new Set(r.filter(u=>{var d;return((d=u.lifecycle)==null?void 0:d.featureCode)===t||u.featureCode===t||u.feature_code===t}).map(u=>u.id)):new Set,[t,r]),l=C.useMemo(()=>!t&&a.size===0?[]:e.filter(u=>!!(t&&u.featureCode===t||u.itemId&&a.has(u.itemId)||t&&u.message&&u.message.includes(t))),[e,t,a]);if(l.length===0)return h.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[h.jsx(IM,{style:{width:20,height:20,color:"hsl(var(--success, 160 60% 45%))"}}),h.jsx("span",{className:"text-[11px] italic",children:"No errors for this feature."})]});const c=s?l:l.slice(0,qu);return h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Errors (",l.length,")"]}),c.map((u,d)=>{const p=n===d;return h.jsxs("button",{onClick:()=>i(p?null:d),className:"flex flex-col w-full px-2 py-1.5 text-left rounded hover:bg-destructive/5 transition-colors",children:[h.jsxs("div",{className:"flex items-center gap-2 w-full",children:[h.jsx("span",{className:"text-[10px] text-destructive shrink-0",children:"✕"}),h.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0 w-16 truncate",children:u.tool||u.toolName||"unknown"}),h.jsx("span",{className:`text-[10px] text-foreground flex-1 ${p?"":"line-clamp-2"} truncate`,children:u.message||u.error||"Unknown error"}),h.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0 ml-auto",children:XZ(u.timestamp||u.createdAt)})]}),p&&h.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>qu&&h.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-qu," more"]})]})}function ZZ(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function QZ(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 JZ({featureCode:t,onOpenFile:e}){const[r,n]=C.useState([]),[i,s]=C.useState(!0);C.useEffect(()=>{const l=new AbortController;return s(!0),$t("/api/files",{signal:l.signal}).then(c=>c.json()).then(c=>{l.signal.aborted||(n(Array.isArray(c)?c:c.files||[]),s(!1))}).catch(c=>{l.signal.aborted||(n([]),s(!1))}),()=>l.abort()},[t]);const o=`docs/features/${t}/`,a=C.useMemo(()=>r.filter(l=>(typeof l=="string"?l:l.path||l.name||"").startsWith(o)),[r,o]);return i?h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Loading files..."}):a.length===0?h.jsxs("div",{className:"p-3 flex flex-col items-center gap-2 text-muted-foreground",children:[h.jsx(Vf,{style:{width:20,height:20,opacity:.5}}),h.jsx("span",{className:"text-[11px] italic",children:"No files in feature folder."})]}):h.jsxs("div",{className:"p-2 space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground px-1 mb-1",children:["Files (",a.length,")"]}),a.map((l,c)=>{const u=typeof l=="string"?l:l.path||l.name||"",d=u.split("/").pop(),p=typeof l=="object"?l.size:null,f=typeof l=="object"?l.modified||l.mtime:null;return h.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:[h.jsx(Bi,{className:"h-3 w-3 shrink-0 text-accent"}),h.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:d}),p!=null&&h.jsx("span",{className:"text-[9px] text-muted-foreground tabular-nums shrink-0",children:ZZ(p)}),f&&h.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:QZ(f)})]},c)})]})}function tQ({itemId:t,onSelect:e,onClose:r,onOpenFile:n,onViewInGraph:i,onViewInTree:s}){var w;const{items:o,connections:a,gates:l,updateItem:c,deleteItem:u,createConnection:d,deleteConnection:p,resolveGate:f,activeBuild:m,sessions:x,agentErrors:g}=pr(Di(T=>({items:T.items,connections:T.connections,gates:T.gates,updateItem:T.updateItem,deleteItem:T.deleteItem,createConnection:T.createConnection,deleteConnection:T.deleteConnection,resolveGate:T.resolveGate,activeBuild:T.activeBuild,sessions:T.sessions,agentErrors:T.agentErrors}))),y=o.find(T=>T.id===t)||null,[b,k]=C.useState("overview"),S=((w=y==null?void 0:y.lifecycle)==null?void 0:w.featureCode)||(y==null?void 0:y.featureCode)||(y==null?void 0:y.feature_code)||"",E=C.useMemo(()=>S?g.filter(T=>T.featureCode===S||S&&T.message&&T.message.includes(S)):[],[g,S]);return y?h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsx(qZ,{activeTab:b,onTabChange:k,errorCount:E.length}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[b==="overview"&&h.jsxs(h.Fragment,{children:[h.jsx(zZ,{item:y,items:o,connections:a,gates:l,onUpdate:(T,N)=>c(T,N),onDelete:T=>{u(T),r()},onCreateConnection:d,onDeleteConnection:p,onSelect:e,onClose:r,onPressureTest:()=>{},onResolveGate:f}),h.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 mt-1",style:{borderTop:"1px solid hsl(var(--border))"},children:[i&&h.jsxs("button",{onClick:()=>i(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx("span",{style:{fontSize:10},children:"↑"})," View in Graph"]}),s&&h.jsxs("button",{onClick:()=>s(t),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx("span",{style:{fontSize:10},children:"↓"})," View in Tree"]})]})]}),b==="pipeline"&&h.jsx(HZ,{item:y,activeBuild:m}),b==="sessions"&&h.jsx(YZ,{featureCode:S,sessions:x,items:o}),b==="errors"&&h.jsx(KZ,{featureCode:S,errors:g,items:o}),b==="files"&&h.jsx(JZ,{featureCode:S,onOpenFile:n})]})]}):h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function eQ(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 rQ(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function nQ(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function iQ(t,e,r){var c;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=(c=e==null?void 0:e.per_loop_type)==null?void 0:c[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 sQ(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 py(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const my=[{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 oQ({tierMap:t,tierSummary:e}){const[r,n]=C.useState(null),i=s=>n(o=>o===s?null:s);return h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Tier Pipeline"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[my.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 c,u;return l?(c="bg-muted-foreground/40",u=`${s.id} (${s.name}): skipped`):a===!0?(c="bg-success",u=`${s.id} (${s.name}): passed`):a===!1?(c="bg-destructive",u=`${s.id} (${s.name}): failed`):(c="bg-muted-foreground/20",u=`${s.id} (${s.name}): not run`),h.jsxs(Vt.Fragment,{children:[o>0&&h.jsx("div",{className:"h-px w-3 bg-muted-foreground/20 shrink-0"}),h.jsxs("button",{className:"flex flex-col items-center gap-0.5 group",onClick:()=>i(s.id),title:u,children:[h.jsx("div",{className:`w-2.5 h-2.5 rounded-full transition-all group-hover:scale-125 ${c} ${r===s.id?"ring-1 ring-foreground/40":""}`}),h.jsx("span",{className:"text-[8px] text-muted-foreground leading-none",children:s.label})]})]},s.id)}),(e==null?void 0:e.costSaved)>0&&h.jsxs("span",{className:"ml-2 text-[9px] text-success/80",children:["saved ~$",e.costSaved.toFixed(2)]})]}),r&&h.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=my.find(c=>c.id===r);return o?`${r} (${a==null?void 0:a.name}): skipped — short-circuited by earlier failure`:s===!0?`${r} (${a==null?void 0:a.name}): passed`:s===!1?`${r} (${a==null?void 0:a.name}): failed`:`${r} (${a==null?void 0:a.name}): not run this build`})()})]})}function Hu(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function aQ(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const gy={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function xy(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 lQ({loopState:t,budget:e}){const[r,n]=C.useState(()=>Date.now());C.useEffect(()=>{if(!t||t.status!=="running")return;const s=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(s)},[t]);const i=iQ(t,e,r);return i?h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Live Counters"}),h.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsxs("span",{className:"text-foreground font-mono font-medium",children:["attempt ",i.count,"/",i.maxIterations??"?"]}),h.jsx("span",{className:"text-muted-foreground",children:"·"}),h.jsxs("span",{className:"text-foreground font-mono",children:[xy(i.elapsedMs),i.timeoutMs!=null&&h.jsxs("span",{className:"text-muted-foreground",children:[" / ",xy(i.timeoutMs)]})]}),i.usedIterations!=null&&i.maxTotal!=null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground",children:"·"}),h.jsxs("span",{className:"text-foreground font-mono",children:["cumulative ",i.usedIterations,"/",i.maxTotal]})]})]}),h.jsxs("div",{className:"text-muted-foreground/70 text-[9px]",children:["loop: ",i.loopType]})]})]}):null}function cQ({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=pr(Di(F=>({activeBuild:F.activeBuild,iterationStates:F.iterationStates}))),[o,a]=C.useState(!1),[l,c]=C.useState(null),u=(i==null?void 0:i.featureCode)??null,d=C.useRef(null);C.useEffect(()=>{if(!u){c(null);return}u!==d.current&&(d.current=u,$t(`/api/lifecycle/budget?featureCode=${encodeURIComponent(u)}`).then(F=>F.json()).then(F=>c(F)).catch(()=>{}))},[u]);const{step:p,allSteps:f}=C.useMemo(()=>i!=null&&i.steps?{step:i.steps.find(L=>L.id===t||L.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=C.useMemo(()=>{if(!r||r.length===0)return null;for(let F=r.length-1;F>=0;F--){const L=r[F];if(L.subtype==="health_score"&&typeof L.score=="number")return L}return null},[r]),{tierMap:x,tierSummary:g}=C.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const F={};let L=null;for(const B of e)B.subtype==="gate_tier_result"?F[B.tierId]=B.passed:B.subtype==="gate_tier_summary"&&(L=B);return{tierMap:F,tierSummary:L}},[e]),y=Object.keys(x).length>0||g!==null,b=C.useMemo(()=>{const F=f.filter(L=>L.cost_usd!=null);return F.length===0?[]:[...F].sort((L,B)=>o?(L.cost_usd??0)-(B.cost_usd??0):(B.cost_usd??0)-(L.cost_usd??0))},[f,o]),k=b.length>0?b[0].id:null,S=C.useMemo(()=>eQ(p),[p]),E=C.useMemo(()=>rQ(p),[p]),w=C.useMemo(()=>nQ(s,t),[s,t]),T=C.useMemo(()=>{if(!n||n.length===0)return null;const F=n.filter(W=>W.stepId===t);if(F.length===0)return null;const L=F.filter(W=>W.severity==="violation").length,B=F.filter(W=>W.severity==="warning").length;return{total:F.length,hardViolations:L,warnings:B}},[n,t]);if(!p)return h.jsxs("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:["Step “",t,"” not found in active build."]});const N={done:"text-success",running:"text-accent",failed:"text-destructive",pending:"text-muted-foreground",skipped:"text-muted-foreground"};return h.jsxs("div",{className:"p-3 space-y-3",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Build Step"}),h.jsx("p",{className:"text-sm font-semibold text-foreground font-mono",children:p.id||p.step_id})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Status:"}),h.jsx("span",{className:`text-xs font-medium ${N[p.status]||"text-foreground"}`,children:p.status||"unknown"})]}),S&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Retries"}),h.jsxs("p",{className:"text-xs text-amber-400",children:["Retried ",S.count," ",S.count===1?"time":"times"]}),S.isArray&&S.items.length>0&&h.jsx("div",{className:"mt-1 space-y-0.5",children:S.items.map((F,L)=>h.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",L+1,F.reason?`: ${F.reason}`:""]},L))})]}),p.durationMs!=null&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Duration:"}),h.jsx("span",{className:"text-xs text-foreground",children:p.durationMs<1e3?`${p.durationMs}ms`:p.durationMs<6e4?`${(p.durationMs/1e3).toFixed(1)}s`:`${(p.durationMs/6e4).toFixed(1)}m`})]}),p.summary&&h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Summary:"}),h.jsx("p",{className:"text-xs text-foreground mt-0.5",children:p.summary})]}),p.artifact&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Artifact:"}),h.jsx("span",{className:"text-xs text-foreground font-mono truncate",children:p.artifact})]}),p.agent&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Agent:"}),h.jsx("span",{className:"text-xs text-foreground font-mono",children:p.agent})]}),p.filesChanged&&p.filesChanged.length>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:["Files Changed (",p.filesChanged.length,")"]}),h.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:p.filesChanged.map((F,L)=>h.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:F},L))})]}),(p.input_tokens>0||p.output_tokens>0||p.cost_usd>0)&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1",children:"Tokens & Cost"}),h.jsxs("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:[h.jsx("span",{className:"text-muted-foreground",children:"Input"}),h.jsx("span",{className:"text-muted-foreground",children:"Output"}),h.jsx("span",{className:"text-muted-foreground",children:"Cost"}),h.jsx("span",{className:"text-foreground font-mono",children:(p.input_tokens??0).toLocaleString()}),h.jsx("span",{className:"text-foreground font-mono",children:(p.output_tokens??0).toLocaleString()}),h.jsx("span",{className:"text-foreground font-mono",children:py(p.cost_usd)})]})]}),y&&h.jsx("div",{children:h.jsx(oQ,{tierMap:x,tierSummary:g})}),E.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-destructive mb-1",children:"Postcondition Violations"}),h.jsx("div",{className:"space-y-0.5",children:E.map((F,L)=>h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1 rounded bg-destructive/10",children:[h.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0 mt-1",style:{background:"hsl(var(--destructive))"}}),h.jsx("span",{className:"text-[10px] text-destructive leading-relaxed",children:typeof F=="string"?F:F.message||JSON.stringify(F)})]},L))})]}),T&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-amber-400/80 mb-1",children:"Capability Findings"}),h.jsxs("p",{className:"text-xs text-amber-400",children:[T.total," ",T.total===1?"finding":"findings"," ","(",T.hardViolations," ",T.hardViolations===1?"violation":"violations",","," ",T.warnings," ",T.warnings===1?"warning":"warnings",")"]})]}),(w==null?void 0:w.status)==="running"&&h.jsx(lQ,{loopState:w,budget:l}),m!=null&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5",children:"Health Score"}),h.jsxs("div",{className:"flex items-baseline gap-2 mb-2",children:[h.jsx("span",{className:`text-2xl font-bold font-mono tabular-nums ${Hu(m.score)}`,children:m.score}),h.jsx("span",{className:"text-[10px] text-muted-foreground",children:"/100"}),m.trend&&h.jsxs("span",{className:`text-sm font-mono ${Hu(m.score)}`,children:[aQ(m.trend.direction),m.trend.delta!=null&&h.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&&h.jsxs("div",{className:"space-y-1",children:[Object.entries(m.breakdown).map(([F,L])=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:gy[F]??F}),h.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted-foreground/20 overflow-hidden",children:h.jsx("div",{className:`h-full rounded-full transition-all ${L>=80?"bg-success":L>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${L}%`}})}),h.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${Hu(L)}`,children:L})]},F)),m.missing&&m.missing.length>0&&h.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-0.5",children:["No data: ",m.missing.map(F=>gy[F]??F).join(", ")]})]})]}),b.length>1&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Build Cost Breakdown"}),h.jsx("button",{className:"text-[9px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>a(F=>!F),children:o?"cost asc":"cost desc"})]}),h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-[10px] border-collapse",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"text-muted-foreground",children:[h.jsx("th",{className:"text-left pr-2 pb-0.5 font-medium",children:"Step"}),h.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"In"}),h.jsx("th",{className:"text-right pr-2 pb-0.5 font-medium",children:"Out"}),h.jsx("th",{className:"text-right pb-0.5 font-medium",children:"Cost"}),h.jsx("th",{className:"text-right pb-0.5 pl-2 font-medium",children:"Dur"})]})}),h.jsx("tbody",{children:b.map(F=>{const L=F.id===k,B=F.id===t,W=F.durationMs!=null?F.durationMs<1e3?`${F.durationMs}ms`:F.durationMs<6e4?`${(F.durationMs/1e3).toFixed(1)}s`:`${(F.durationMs/6e4).toFixed(1)}m`:"—";return h.jsxs("tr",{className:`${L?"text-amber-400":"text-foreground"} ${B?"font-semibold":""}`,children:[h.jsx("td",{className:"pr-2 py-0.5 font-mono truncate max-w-[80px]",children:F.id}),h.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((F.input_tokens??0)/1e3).toFixed(1),"k"]}),h.jsxs("td",{className:"text-right pr-2 py-0.5 font-mono",children:[((F.output_tokens??0)/1e3).toFixed(1),"k"]}),h.jsx("td",{className:"text-right py-0.5 font-mono",children:py(F.cost_usd)}),h.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:W})]},F.id)})})]})})]})]})}function I_(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 yy(t,e){var l;const r=(e||[]).filter(c=>!c.superseded);if(r.length===0)return"";let n=`# Design Document
718
-
719
- `;const i=(t||[]).filter(c=>c.role==="human"&&c.type==="text").slice(0,3);i.length>0&&(n+=`## Problem
720
-
721
- `,n+=i.map(c=>c.content).join(`
722
-
723
- `),n+=`
724
-
725
- `);for(const c of r){const u=c.selectedOption||{};n+=`## ${c.question}
726
-
727
- `,n+=`**Decision:** ${u.title||u.id||"Selected option"}
728
-
729
- `,Array.isArray(u.bullets)&&u.bullets.length>0&&(n+=u.bullets.map(d=>`- ${d}`).join(`
730
- `),n+=`
731
-
732
- `),c.comment&&(n+=`*Note: ${c.comment}*
733
-
734
- `)}const s=(l=r[r.length-1])==null?void 0:l.timestamp,o=s?(t||[]).filter(c=>c.role==="assistant"&&c.timestamp>s):[],a=[];for(const c of o){if(typeof c.content!="string")continue;const u=c.content.split(`
735
- `);for(const d of u){const p=d.trim();p.endsWith("?")&&p.length>10&&p.length<200&&a.push(p)}}return n+=`## Open Threads
736
-
737
- `,a.length>0?(n+=a.map(c=>`- ${c}`).join(`
738
- `),n+=`
739
- `):n+=`_No open threads._
740
- `,n}function hQ(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const _o={es:null},Wn=Kf((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 c=JSON.parse(localStorage.getItem("compose:designSession")||"{}");r=c.scope||"product",n=c.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 $t(`/api/design/session${a}`),{session:c}=await l.json();if(c){const u=c.messages||[],d=c.decisions||[],p=yy(u,d),f=hQ(u,d);t({session:c,messages:u,decisions:d,status:c.status==="complete"?"complete":"active",scope:r,featureCode:n,draftDoc:i?s:p,docManuallyEdited:i,topicOutline:f,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 $t("/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 $t("/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 $t("/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 $t("/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 $t("/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(_o.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}`);_o.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 c=[...l.researchItems],u=a.id?c.findIndex(d=>d.id===a.id):-1;return u!==-1&&(c[u]={...c[u],summary:a.summary}),{researchItems:c}})}),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:()=>{_o.es&&(_o.es.close(),_o.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=yy(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function uQ(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=Wn(Di(c=>({draftDoc:c.draftDoc,docManuallyEdited:c.docManuallyEdited,updateDraftDoc:c.updateDraftDoc,resetDocEdited:c.resetDocEdited}))),[i,s]=C.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))"}),h.jsxs("div",{className:"h-full flex flex-col",style:{fontFamily:"inherit"},children:[h.jsxs("div",{className:"flex items-center justify-between px-3 py-2 shrink-0",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[12px] font-semibold",style:{color:"hsl(var(--foreground))"},children:"Design Document"}),h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{...l,background:"hsl(var(--muted))"},children:a})]}),!o&&h.jsx("button",{onClick:()=>s(c=>!c),className:"text-[11px] px-2 py-1 rounded transition-colors",style:{color:"hsl(var(--muted-foreground))",background:i?"hsl(var(--accent))":"transparent"},onMouseEnter:c=>{c.currentTarget.style.color="hsl(var(--foreground))"},onMouseLeave:c=>{c.currentTarget.style.color="hsl(var(--muted-foreground))"},children:i?"Preview":"Edit"})]}),h.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:o?h.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?h.jsxs("div",{className:"h-full flex flex-col p-2 gap-2",children:[h.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:c=>r(c.target.value),spellCheck:!1}),h.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:c=>{c.currentTarget.style.color="hsl(var(--foreground))",c.currentTarget.style.borderColor="hsl(var(--foreground))"},onMouseLeave:c=>{c.currentTarget.style.color="hsl(var(--muted-foreground))",c.currentTarget.style.borderColor="hsl(var(--border))"},children:"Reset to auto-generated"})]}):h.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:h.jsx(Rf,{remarkPlugins:[Hf],children:t})})})]})}const dQ=4e3,by={info:{color:"hsl(var(--foreground))",bg:"hsl(var(--muted))"},warn:{color:"hsl(var(--warning, 32 95% 52%))",bg:"hsl(var(--muted))"},error:{color:"hsl(var(--destructive))",bg:"hsl(var(--destructive) / 0.08)"}};function fQ(){const[t,e]=C.useState(null),r=C.useRef(null);if(C.useEffect(()=>{function i(s){const{message:o,level:a="info",ttl:l=dQ}=s.detail??{};o&&(clearTimeout(r.current),e({message:o,level:a}),l>0&&(r.current=setTimeout(()=>e(null),l)))}return window.addEventListener("compose:notify",i),()=>{window.removeEventListener("compose:notify",i),clearTimeout(r.current)}},[]),!t)return null;const n=by[t.level]??by.info;return h.jsxs("div",{className:"h-6 flex items-center justify-between px-3 gap-2 shrink-0 text-[11px] font-mono",style:{background:n.bg,color:n.color,borderTop:"1px solid hsl(var(--border))"},role:"status","aria-live":"polite",children:[h.jsx("span",{className:"flex-1 min-w-0 truncate",children:t.message}),h.jsx("button",{className:"shrink-0 opacity-60 hover:opacity-100 text-[10px]",onClick:()=>{clearTimeout(r.current),e(null)},"aria-label":"Dismiss notification",children:"✕"})]})}const Uu={build:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(217 91% 60%)"},gate:{background:"hsl(38 92% 50% / 0.12)",borderColor:"hsl(38 92% 50% / 0.3)",color:"hsl(38 92% 50%)"},error:{background:"hsl(0 72% 51% / 0.12)",borderColor:"hsl(0 72% 51% / 0.3)",color:"hsl(0 72% 51%)"},done:{background:"hsl(160 60% 45% / 0.12)",borderColor:"hsl(160 60% 45% / 0.3)",color:"hsl(160 60% 45%)"},iteration:{background:"hsl(217 91% 60% / 0.12)",borderColor:"hsl(217 91% 60% / 0.3)",color:"hsl(210 100% 66%)"}},Cy={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 pQ({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?Uu.done:Uu[t])||Uu.build,l=Cy[o]||Cy.steady,c=o==="exit"?"200ms":o==="flash"?"300ms":"200ms";return h.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 ${c} ease, opacity ${c} 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:[h.jsxs("span",{style:{fontSize:"12px",lineHeight:1},children:[t==="build"&&"▶",t==="gate"&&"⚠",t==="error"&&"✕",t==="done"&&"✓",t==="iteration"&&"↻"]}),h.jsx("span",{children:e}),r>0&&h.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&&h.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&&h.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 mQ(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function gQ(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function xQ(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function yQ({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}`:"",c=mQ(t.cumulative_cost_usd),u=c?` · ${c}`:"",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=kn[a.stepId]??(a.fromPhase||a.toPhase||"Gate"),c=Array.isArray(r)?r.find(d=>d.id===a.itemId):null,u=(c==null?void 0:c.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 c=l.loopType==="review"?"review":"coverage",u=`${l.count}/${l.maxIterations}`;let d="";if(l.wallClockTimeout!=null&&l.startedAt){const p=s-new Date(l.startedAt).getTime();d=`, ${gQ(p)}/${xQ(l.wallClockTimeout)}`}o.push({key:`iter-${a}`,type:"iteration",label:`${c} ${u}${d}`})}}if(Array.isArray(n))for(const a of n){const l=a.featureCode||"system",c=(a.message||a.errorType||"error").substring(0,60);o.push({key:`error-${a.timestamp}-${c.substring(0,10)}`,type:"error",label:`${l} · ${c}`,featureCode:l,timestamp:a.timestamp})}return o}function bQ({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=pr(Di(O=>({activeBuild:O.activeBuild,gates:O.gates,items:O.items,recentErrors:O.recentErrors,resolveGate:O.resolveGate,iterationStates:O.iterationStates}))),[l,c]=C.useState(new Map),u=C.useRef([]),d=C.useRef(new Set),p=C.useRef(new Set),[f,m]=C.useState(null),x=C.useRef(null),g=(r==null?void 0:r.featureCode)??null;C.useEffect(()=>{if(!g){m(null),x.current=null;return}g!==x.current&&(x.current=g,$t(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(O=>O.json()).then(O=>m(O)).catch(()=>{}))},[g]);const y=C.useRef(0);C.useEffect(()=>{if(!g)return;const O=a?[...a.values()].reduce((I,M)=>I+(M.count??0),0):0;O!==y.current&&(y.current=O,$t(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(I=>I.json()).then(I=>m(I)).catch(()=>{}))},[a,g]);const b=C.useRef(r),[k,S]=C.useState(null);C.useEffect(()=>{const O=b.current;if(O&&O.featureCode&&!r){S({...O,status:"complete"});const I=setTimeout(()=>S(null),3e3);return b.current=r,()=>clearTimeout(I)}b.current=r},[r]);const E=r||k,[w,T]=C.useState(()=>Date.now()),N=a&&[...a.values()].some(O=>O.status==="running");C.useEffect(()=>{if(!N)return;const O=setInterval(()=>T(Date.now()),1e3);return()=>clearInterval(O)},[N]);const F=C.useMemo(()=>yQ({activeBuild:E,gates:n,items:i,recentErrors:s,iterationStates:a,now:w}),[E,n,i,s,a,w]),L=C.useMemo(()=>F.filter(O=>!d.current.has(O.key)),[F]);C.useEffect(()=>{const O=new Set(u.current.map(M=>M.key)),I=L.filter(M=>!O.has(M.key)).map(M=>M.key);I.length>0&&(c(M=>{const P=new Map(M);for(const $ of I)P.set($,"enter");return P}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{c(M=>{const P=new Map(M);for(const $ of I)P.get($)==="enter"&&P.set($,"steady");return P})})}));for(const M of L)M.type==="done"&&!p.current.has(M.key)&&(p.current.add(M.key),c(P=>{const $=new Map(P);return $.set(M.key,"flash"),$}),setTimeout(()=>{c(P=>{const $=new Map(P);return $.set(M.key,"exit"),$}),setTimeout(()=>{d.current.add(M.key),c(P=>{const $=new Map(P);return $.delete(M.key),$})},500)},2e3));u.current=L},[L]);const B=C.useCallback(O=>{c(I=>{const M=new Map(I);return M.set(O,"exit"),M}),setTimeout(()=>{d.current.add(O),c(I=>{const M=new Map(I);return M.delete(O),M})},200)},[]),W=C.useCallback(O=>{o&&o(O,"approve","Approved from ops strip")},[o]);if(t==="docs"||L.length===0)return null;const G=sQ(f);return h.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:[L.map(O=>h.jsx(pQ,{type:O.type,label:O.label,retries:O.retries,animationState:l.get(O.key)||"steady",onClick:e?()=>e(O.featureCode):void 0,onApprove:O.type==="gate"&&O.gateId?()=>W(O.gateId):void 0,onDismiss:O.type==="error"?()=>B(O.key):void 0},O.key)),G&&h.jsx("span",{className:"ml-auto text-[9px] text-muted-foreground font-mono shrink-0 opacity-70",title:"Cumulative budget usage: review / coverage",children:G})]})}const Gu=["dashboard","graph","tree","docs","design","gates","pipeline","sessions","ideabox"];function CQ(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function kQ(t){return(t==null?void 0:t[0])??null}const vQ="compose:mainTabs",F_="compose:activeTab";function wQ(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(vQ);if(!e)return[...Gu];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of Gu)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[...Gu]}function SQ(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(F_);if(r&&CQ(t,r))return r}catch{}return kQ(t)}function ky(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(F_,t)}catch{}}function P_(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 D_(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const O_="compose:sidebarOpen",$_="compose:contextPanelOpen";function TQ(){return P_(O_,!0)}function _Q(t){return D_(O_,t)}function EQ(){return P_($_,!1)}function vy(t){return D_($_,t)}const mf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));mf.displayName="Card";const gf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("flex flex-col space-y-1.5 p-6",t),...e}));gf.displayName="CardHeader";const xf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("font-semibold leading-none tracking-tight",t),...e}));xf.displayName="CardTitle";const NQ=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("text-sm text-muted-foreground",t),...e}));NQ.displayName="CardDescription";const yf=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("p-6 pt-0",t),...e}));yf.displayName="CardContent";const jQ=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:nt("flex items-center p-6 pt-0",t),...e}));jQ.displayName="CardFooter";function LQ(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 wy({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,c=!o&&!l,u=t.silent,[d,p]=C.useState(()=>{const m=t.startedAt?new Date(t.startedAt).getTime():Date.now();return(t.completedAt?new Date(t.completedAt).getTime():Date.now())-m});C.useEffect(()=>{if(!o)return;const m=t.startedAt?new Date(t.startedAt).getTime():Date.now(),x=()=>p(Date.now()-m);x();const g=setInterval(x,1e3);return()=>clearInterval(g)},[o,t.startedAt]);const f=t.agentType||t.type||t.agent||"agent";return h.jsxs("div",{className:"px-3 py-2 rounded border border-border bg-muted/20",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsx("span",{className:"text-[11px] text-foreground font-medium truncate",children:f}),h.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[h.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full inline-block",o&&!u&&"bg-green-400",o&&u&&"bg-yellow-400",c&&"bg-emerald-400",l&&"bg-red-400"),style:o&&!u?{animation:"phase-active-pulse 2s ease-in-out infinite"}:void 0}),h.jsx("span",{className:nt("text-[10px]",o&&!u&&"text-green-400",o&&u&&"text-yellow-400",c&&"text-emerald-400",l&&"text-red-400"),children:u?"silent":t.status}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:LQ(d)}),o&&s&&h.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"})]})]}),h.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:e!=null&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:[e," tools"]}),h.jsx("span",{className:"mx-1",children:"·"}),h.jsxs("span",{className:nt(r>0&&"text-red-400"),children:[r??0," err"]}),o&&n&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"mx-1",children:"·"}),h.jsxs("span",{children:[i||"working"," (",n,")"]})]})]})})]})}function Zi(t,e,r){let n=r.initialDeps??[],i,s=!0;function o(){var a,l,c;let u;r.key&&((a=r.debug)!=null&&a.call(r))&&(u=Date.now());const d=t();if(!(d.length!==n.length||d.some((m,x)=>n[x]!==m)))return i;n=d;let f;if(r.key&&((l=r.debug)!=null&&l.call(r))&&(f=Date.now()),i=e(...d),r.key&&((c=r.debug)!=null&&c.call(r))){const m=Math.round((Date.now()-u)*100)/100,x=Math.round((Date.now()-f)*100)/100,g=x/16,y=(b,k)=>{for(b=String(b);b.length<k;)b=" "+b;return b};console.info(`%c⏱ ${y(x,5)} /${y(m,5)} ms`,`
741
- font-size: .6rem;
742
- font-weight: bold;
743
- color: hsl(${Math.max(0,Math.min(120-120*g,120))}deg 100% 31%);`,r==null?void 0:r.key)}return r!=null&&r.onChange&&!(s&&r.skipInitialOnChange)&&r.onChange(i),s=!1,i}return o.updateDeps=a=>{n=a},o}function Sy(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const BQ=(t,e)=>Math.abs(t-e)<1.01,AQ=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}},Ty=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},MQ=t=>t,IQ=t=>{const e=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let i=e;i<=r;i++)n.push(i);return n},FQ=(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(Ty(r)),!n.ResizeObserver)return()=>{};const s=new n.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(Ty(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},_y={passive:!0},Ey=typeof window>"u"?!0:"onscrollend"in window,PQ=(t,e)=>{const r=t.scrollElement;if(!r)return;const n=t.targetWindow;if(!n)return;let i=0;const s=t.options.useScrollendEvent&&Ey?()=>{}:AQ(n,()=>{e(i,!1)},t.options.isScrollingResetDelay),o=u=>()=>{const{horizontal:d,isRtl:p}=t.options;i=d?r.scrollLeft*(p&&-1||1):r.scrollTop,s(),e(i,u)},a=o(!0),l=o(!1);r.addEventListener("scroll",a,_y);const c=t.options.useScrollendEvent&&Ey;return c&&r.addEventListener("scrollend",l,_y),()=>{r.removeEventListener("scroll",a),c&&r.removeEventListener("scrollend",l)}},DQ=(t,e,r)=>{if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}return t[r.options.horizontal?"offsetWidth":"offsetHeight"]},OQ=(t,{adjustments:e=0,behavior:r},n)=>{var i,s;const o=t+e;(s=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[n.options.horizontal?"left":"top"]:o,behavior:r})};class $Q{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var r,n,i;return((i=(n=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let r=null;const n=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const o=()=>{const a=s.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);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=>{Object.entries(r).forEach(([n,i])=>{typeof i>"u"&&delete r[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:MQ,rangeExtractor:IQ,onChange:()=>{},measureElement:DQ,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...r}},this.notify=r=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,r)},this.maybeNotify=Zi(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,n)=>{const i=new Map,s=new Map;for(let o=n-1;o>=0;o--){const a=r[o];if(i.has(a.lane))continue;const 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=Zi(()=>[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.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Zi(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:n,scrollMargin:i,getItemKey:s,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const f of this.laneAssignments.keys())f>=r&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,u),p=new Array(a).fill(void 0);for(let f=0;f<u;f++){const m=d[f];m&&(p[m.lane]=f)}for(let f=u;f<r;f++){const m=s(f),x=this.laneAssignments.get(f);let g,y;const b=l==="estimate"||c.has(m);if(x!==void 0&&this.options.lanes>1){g=x;const w=p[g],T=w!==void 0?d[w]:void 0;y=T?T.end+this.options.gap:n+i}else{const w=this.options.lanes===1?d[f-1]:this.getFurthestMeasurement(d,f);y=w?w.end+this.options.gap:n+i,g=w?w.lane:f%this.options.lanes,this.options.lanes>1&&b&&this.laneAssignments.set(f,g)}const k=c.get(m),S=typeof k=="number"?k:this.options.estimateSize(f),E=y+S;d[f]={index:f,start:y,size:S,end:E,key:m,lane:g},p[g]=f}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Zi(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,i,s)=>this.range=r.length>0&&n>0?RQ({measurements:r,outerSize:n,scrollOffset:i,lanes:s}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Zi(()=>{let r=null,n=null;const i=this.calculateRange();return i&&(r=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,n]},(r,n,i,s,o)=>s===null||o===null?[]:r({startIndex:s,endIndex:o,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const n=this.options.indexAttribute,i=r.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,i-s),a=Math.min(this.options.count-1,i+s);return r>=o&&r<=a}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const n=this.indexFromElement(r),i=this.options.getItemKey(n),s=this.elementsCache.get(i);s!==r&&(s&&this.observer.unobserve(s),this.observer.observe(r),this.elementsCache.set(i,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,n)=>{var i;const s=this.measurementsCache[r];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,a=n-o;a!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,n)),this.notify(!1))},this.getVirtualItems=Zi(()=>[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 Sy(n[R_(0,n.length-1,i=>Sy(n[i]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,n,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=r>=o+s?"end":"start"),n==="center"?r+=(i-s)/2:n==="end"&&(r-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,r),0)},this.getOffsetForIndex=(r,n="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),o=this.measurementsCache[r];if(!o)return;if(n==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=s+this.options.scrollPaddingStart)n="start";else return[s,n];if(n==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.scrollToOffset=(r,{align:n="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(r,n),o=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:n="auto",behavior:i="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const s=this.getOffsetForIndex(r,n);if(!s)return;const[o,a]=s,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.getTotalSize=()=>{var r;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((r=n[n.length-1])==null?void 0:r.end)??0;else{const s=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&s.some(a=>a===null);){const a=n[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:n,behavior:i})=>{this.options.scrollToFn(r,{behavior:i,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,s=1,o=i!==this.scrollState.lastTargetOffset;if(!o&&BQ(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.scrollState=null;return}}else this.scrollState.stableFrames=0,o&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const R_=(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 RQ({measurements:t,outerSize:e,scrollOffset:r,lanes:n}){const i=t.length-1,s=l=>t[l].start;if(t.length<=n)return{startIndex:0,endIndex:i};let o=R_(0,i,s,r),a=o;if(n===1)for(;a<i&&t[a].end<r+e;)a++;else if(n>1){const l=Array(n).fill(0);for(;a<i&&l.some(u=>u<r+e);){const u=t[a];l[u.lane]=u.end,a++}const c=Array(n).fill(r+e);for(;o>=0&&c.some(u=>u>=r);){const u=t[o];c[u.lane]=u.start,o--}o=Math.max(0,o-o%n),a=Math.min(i,a+(n-1-a%n))}return{startIndex:o,endIndex:a}}const Ny=typeof document<"u"?C.useLayoutEffect:C.useEffect;function zQ({useFlushSync:t=!0,...e}){const r=C.useReducer(()=>({}),{})[1],n={...e,onChange:(s,o)=>{var a;t&&o?Jf.flushSync(r):r(),(a=e.onChange)==null||a.call(e,s,o)}},[i]=C.useState(()=>new $Q(n));return i.setOptions(n),Ny(()=>i._didMount(),[]),Ny(()=>i._willUpdate()),i}function WQ(t){return zQ({observeElementRect:FQ,observeElementOffset:PQ,scrollToFn:OQ,...t})}function qQ(t,e,r){var a,l;const n=[],i=(r==null?void 0:r.id)??null;if(Array.isArray(t))for(const c of t){if(n.push({id:`session-start-${c.id}`,timestamp:c.startedAt,category:"session",title:"Session started",detail:c.source?`Source: ${c.source}`:null,severity:"info",sessionId:c.id,meta:{toolCount:c.toolCount,source:c.source}}),c.endedAt&&n.push({id:`session-end-${c.id}`,timestamp:c.endedAt,category:"session",title:`Session ended (${c.toolCount??0} tools${(a=c.errors)!=null&&a.length?`, ${c.errors.length} error${c.errors.length>1?"s":""}`:""})`,detail:null,severity:"info",sessionId:c.id,meta:{toolCount:c.toolCount,errorCount:((l=c.errors)==null?void 0:l.length)??0}}),Array.isArray(c.errors))for(let u=0;u<c.errors.length;u++){const d=c.errors[u];n.push({id:`error-${c.id}-${u}`,timestamp:d.timestamp||c.startedAt,category:"error",title:d.message||`${d.type} error`,detail:d.tool?`Tool: ${d.tool}`:null,severity:d.severity==="error"?"error":"warning",sessionId:c.id,meta:{type:d.type,tool:d.tool}})}if(c.phaseAtBind&&c.phaseAtEnd&&c.phaseAtBind!==c.phaseAtEnd){const u=new Date(c.startedAt).getTime(),d=c.endedAt?new Date(c.endedAt).getTime():u,p=new Date(u+(d-u)*.8).toISOString();n.push({id:`phase-${c.id}`,timestamp:p,category:"phase",title:`Phase: ${c.phaseAtBind} → ${c.phaseAtEnd}`,detail:null,severity:"success",sessionId:c.id,meta:{from:c.phaseAtBind,to:c.phaseAtEnd}})}}if(Array.isArray(e)){const c=i?e.filter(u=>u.itemId===i):e;for(const u of c){if(u.createdAt){const d=kn[u.stepId]??(u.fromPhase&&u.toPhase?`${Se[u.fromPhase]??u.fromPhase} → ${Se[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 p={approve:"approve",approved:"approve",revise:"revise",revised:"revise",kill:"kill",killed:"kill"}[u.outcome]||u.outcome,f={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[p]||u.outcome}`,detail:u.comment||null,severity:f[p]||"info",sessionId:null,meta:{gateId:u.id,outcome:u.outcome,comment:u.comment}})}}}const s=new Set,o=[];for(const c of n)s.has(c.id)||(s.add(c.id),o.push(c));return o.sort((c,u)=>c.timestamp.localeCompare(u.timestamp)),o}const HQ={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function UQ(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 GQ({event:t,onSelectItem:e,style:r}){const n=HQ[t.category]||"●",i=fE[t.category]||"text-zinc-400",s=dE[t.severity]||"text-zinc-400";return h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded",style:r,children:[h.jsx("span",{className:nt("text-[11px] shrink-0 w-4 text-center leading-4",i),children:n}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:nt("text-[11px] truncate",s),children:t.title}),t.detail&&h.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.detail})]}),h.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums shrink-0 leading-4",children:UQ(t.timestamp)})]})}const VQ=["all","phase","gate","session","iteration","error"],jy={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function YQ({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=C.useState("all"),[s,o]=C.useState([]),a=C.useRef(null),l=pr(m=>m.gates),c=pr(m=>m.featureTimeline),u=pr(m=>m.setFeatureTimeline);C.useEffect(()=>{if(!t)return;let m=!1;return $t(`/api/session/history?featureCode=${encodeURIComponent(t)}&limit=50`).then(x=>x.json()).then(x=>{if(m)return;const g=e?(l||[]).filter(b=>b.itemId===e):l||[],y=qQ(x.sessions||[],g,{id:e});o(y)}).catch(()=>{m||o([])}),()=>{m=!0}},[t,e]);const d=C.useMemo(()=>{var g,y;const m=new Map;for(const b of s)m.set(b.id,b);for(const b of c){const k=(g=b.meta)==null?void 0:g.itemId,S=(y=b.meta)==null?void 0:y.featureCode;(!k&&!S||k===e||S===t)&&m.set(b.id,b)}const x=[...m.values()];return x.sort((b,k)=>b.timestamp.localeCompare(k.timestamp)),x},[s,c,e,t]),p=C.useMemo(()=>n==="all"?d:d.filter(m=>m.category===n),[d,n]),f=WQ({count:p.length,getScrollElement:()=>a.current,estimateSize:()=>48,overscan:5});return C.useEffect(()=>{u&&u([])},[t]),t?h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsx("div",{className:"flex flex-wrap gap-1 px-2 py-2 border-b border-border",children:VQ.map(m=>h.jsxs("button",{className:nt("px-2 py-0.5 rounded text-[10px] font-medium transition-colors",n===m?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:()=>i(m),children:[jy[m],m!=="all"&&h.jsx("span",{className:"ml-1 text-[9px] opacity-60",children:d.filter(x=>x.category===m).length})]},m))}),h.jsx("div",{className:"px-2 py-1",children:h.jsxs("span",{className:"text-[10px] text-muted-foreground/50",children:[p.length," event",p.length!==1?"s":""]})}),h.jsx("div",{ref:a,className:"flex-1 overflow-auto",children:p.length===0?h.jsxs("p",{className:"text-[11px] text-muted-foreground/50 px-2 py-4 text-center",children:["No events",n!=="all"?` in "${jy[n]}"`:"","."]}):h.jsx("div",{style:{height:`${f.getTotalSize()}px`,width:"100%",position:"relative"},children:f.getVirtualItems().map(m=>h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${m.size}px`,transform:`translateY(${m.start}px)`},children:h.jsx(GQ,{event:p[m.index],onSelectItem:r})},m.key))})})]}):h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("p",{className:"text-[11px] text-muted-foreground/50",children:"Select a feature to see its timeline."})})}const Xo=["explore_design","prd","architecture","blueprint","plan","execute","report"];function XQ(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 KQ({currentPhase:t}){const e=Xo.indexOf(t);return h.jsx("div",{className:"space-y-1.5",children:Xo.map((r,n)=>{const i=e>n,s=e===n,o=Se[r]??r;return h.jsxs("div",{className:"flex items-center gap-2",style:{animation:`phase-slide-in 300ms ease-out ${n*50}ms both`},children:[i?h.jsx(r1,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?h.jsx(Jb,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):h.jsx($M,{className:"w-3.5 h-3.5 text-muted-foreground/40 shrink-0"}),h.jsx("span",{className:nt("text-[11px] transition-colors duration-500",i&&"text-emerald-400",s&&"text-blue-400 font-medium",!i&&!s&&"text-muted-foreground/50"),children:o})]},r)})})}function ZQ({spawnedAgents:t,activeBuild:e,sessionState:r,agentActivity:n}){const i=(t||[]).filter(a=>a.status==="running"),s=(t||[]).filter(a=>a.status!=="running").slice(-3).reverse(),o=C.useMemo(()=>{const a=["design.md","blueprint.md","plan.md","prd.md","architecture.md"],l=new Set(((e==null?void 0:e.steps)||[]).filter(c=>c.status==="done"||c.status==="completed").map(c=>c.id||c.name));return a.map(c=>({name:c,done:l.has(c)||((e==null?void 0:e.steps)||[]).some(u=>{var d,p;return(u.status==="done"||u.status==="completed")&&(((d=u.id)==null?void 0:d.includes(c.replace(".md","")))||((p=u.name)==null?void 0:p.includes(c.replace(".md",""))))})}))},[e]);return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents"}),i.length===0&&s.length===0&&h.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-1",children:"No agents active"}),h.jsxs("div",{className:"mt-1 space-y-1.5",children:[i.map((a,l)=>h.jsx(wy,{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)=>h.jsx(wy,{agent:a},a.agentId||`r-${l}`))]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Artifacts"}),h.jsx("div",{className:"mt-1 space-y-1",children:o.map(a=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Bi,{className:nt("w-3 h-3",a.done?"text-emerald-400":"text-muted-foreground/40")}),h.jsx("span",{className:nt("text-[11px] font-mono",a.done?"text-foreground":"text-muted-foreground/50"),children:a.name})]},a.name))})]})]})}function QQ({gates:t,allGates:e,items:r,onResolveGate:n}){const i=C.useMemo(()=>{const s=new Map,o=(e||[]).filter(a=>a.resolvedAt&&(a.outcome==="revised"||a.outcome==="revise")).sort((a,l)=>new Date(l.resolvedAt)-new Date(a.resolvedAt));for(const a of t||[]){const l=o.find(c=>c.stepId===a.stepId&&c.itemId===a.itemId);l!=null&&l.artifactSnapshot&&a.artifactSnapshot&&s.set(a.id,{priorSnapshot:l.artifactSnapshot,currentSnapshot:a.artifactSnapshot})}return s},[t,e]);return!t||t.length===0?h.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No gates pending."}):h.jsx("div",{className:"space-y-2",children:t.map(s=>{var l;const o=r.find(c=>c.id===s.itemId),a=(l=s.artifactAssessment)==null?void 0:l.completeness;return h.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/30",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-[11px] text-foreground truncate",children:(o==null?void 0:o.title)??"Unknown"}),h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[kn[s.stepId]??Se[s.fromPhase]??s.fromPhase??"Gate",a!=null&&` · ${Math.round(a*100)}% complete`]}),i.has(s.id)&&h.jsx("div",{className:"mt-1",children:h.jsx(om,{oldText:i.get(s.id).priorSnapshot,newText:i.get(s.id).currentSnapshot})})]}),h.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h.jsx(Rt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-success border-success/30 hover:bg-success/10",onClick:()=>n(s.id,"approved"),children:"Approve"}),h.jsx(Rt,{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(s.id,"revised"),children:"Revise"}),h.jsx(Rt,{variant:"outline",size:"sm",className:"h-6 text-[10px] gap-1 text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>n(s.id,"killed"),children:"Kill"})]})]})},s.id)})})}function JQ({sessions:t,items:e,onSelect:r}){const n=(t||[]).slice(-5).reverse();return n.length===0?h.jsx("p",{className:"text-[11px] text-muted-foreground/50 px-1",children:"No sessions yet."}):h.jsx("div",{className:"space-y-1",children:n.map(i=>{const s=i.featureCode||i.feature_code,o=s?e.find(l=>{var c;return l.featureCode===s||l.feature_code===s||((c=l.lifecycle)==null?void 0:c.featureCode)===s}):null,a=i.startedAt||i.created_date;return h.jsxs("div",{className:nt("flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 transition-colors",o&&"cursor-pointer"),onClick:()=>o&&r(o.id),children:[h.jsx(LI,{className:"w-3 h-3 text-muted-foreground shrink-0"}),h.jsx("span",{className:"text-[11px] text-foreground",children:i.agent||"agent"}),s&&h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:s}),h.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground tabular-nums shrink-0",children:XQ(a)}),h.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full shrink-0",i.status==="active"?"bg-emerald-400":"bg-slate-600")})]},i.id)})})}function tJ({items:t=[],gates:e=[],sessions:r=[],activeBuild:n,spawnedAgents:i=[],featureCode:s,sessionState:o,agentActivity:a,iterationStates:l,onSelect:c,onResolveGate:u,onOpenGate:d}){var S;const p=C.useMemo(()=>t.find(E=>{var w;return E.featureCode===s||((w=E.lifecycle)==null?void 0:w.featureCode)===s}),[t,s]),[f,m]=C.useState(()=>{try{return localStorage.getItem("compose:timeline-open")==="true"}catch{return!1}}),x=C.useCallback(()=>{m(E=>{const w=!E;try{localStorage.setItem("compose:timeline-open",String(w))}catch{}return w})},[]),g=((S=p==null?void 0:p.lifecycle)==null?void 0:S.currentPhase)||(p==null?void 0:p.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,y=Xo.indexOf(g),b=g?Math.max(0,(y+1)/Xo.length):0,k=C.useMemo(()=>{let E=e.filter(w=>w.status==="pending"||!w.resolvedAt);if(s){const w=new Set(t.filter(T=>{var N;return T.featureCode===s||((N=T.lifecycle)==null?void 0:N.featureCode)===s}).map(T=>T.id));E=E.filter(T=>w.has(T.itemId))}return E},[e,t,s]);if(!s){const E=t.filter(w=>w.type==="feature"&&(w.status==="complete"||w.status==="done")).slice(-5);return h.jsx("div",{className:"flex-1 overflow-auto p-4",children:h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No feature in progress."}),h.jsx("p",{className:"text-[11px] text-muted-foreground/70 font-mono",children:"Run /compose <feature-code> in the terminal to start."}),E.length>0&&h.jsxs("div",{className:"mt-6 w-full max-w-sm",children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recently completed"}),h.jsx("div",{className:"mt-2 space-y-1",children:E.map(w=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>c(w.id),children:[h.jsx(r1,{className:"w-3 h-3 text-emerald-400 shrink-0"}),h.jsx("span",{className:"text-[11px] text-foreground truncate",children:w.title}),w.featureCode&&h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-auto shrink-0",children:w.featureCode})]},w.id))})]})]})})}return h.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[h.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-4 min-w-0",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-sm font-semibold text-foreground truncate",children:(p==null?void 0:p.title)??s}),h.jsx(er,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),g&&h.jsx(er,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:Se[g]??g}),h.jsxs("button",{className:nt("ml-auto flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition-colors shrink-0",f?"bg-foreground/10 text-foreground":"text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/30"),onClick:x,children:[h.jsx(oI,{className:"w-3 h-3"}),"Timeline"]})]}),h.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-muted overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full bg-blue-500",style:{width:`${Math.round(b*100)}%`,transition:"width 800ms cubic-bezier(0.4, 0, 0.2, 1)"}})}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:y>=0?`${y+1} of ${Xo.length} phases`:"Phase unknown"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs(mf,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[h.jsx(gf,{className:"p-3 pb-2",children:h.jsx(xf,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),h.jsx(yf,{className:"p-3 pt-0",children:h.jsx(KQ,{currentPhase:g})})]}),h.jsxs(mf,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[h.jsx(gf,{className:"p-3 pb-2",children:h.jsx(xf,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),h.jsx(yf,{className:"p-3 pt-0",children:h.jsx(ZQ,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),l&&l.size>0&&h.jsx("div",{className:"space-y-2",children:[...l.values()].map(E=>h.jsxs("div",{className:"px-3 py-2.5 rounded border border-blue-500/30 bg-blue-500/10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[h.jsxs("span",{className:"text-[11px] text-blue-400 font-medium",children:[E.status==="running"?"↻":E.outcome==="clean"?"✓":"✗"," ",E.loopType==="review"?"Review Loop":"Coverage Sweep"]}),h.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[E.count," of ",E.maxIterations]})]}),h.jsx("div",{className:"h-1.5 rounded-full bg-blue-500/20 overflow-hidden",children:h.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.round(E.count/E.maxIterations*100)}%`,transition:"width 600ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:E.outcome==="clean"?"#22c55e":E.outcome==="max_reached"?"#ef4444":"#3b82f6"}})}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:E.status==="running"?E.loopType==="review"?"Waiting for clean review...":"Waiting for tests passing...":E.outcome==="clean"?"Clean!":E.outcome==="max_reached"?"Max iterations reached":"Aborted"})]},E.loopId))}),h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Pending Gates"}),k.length>0&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-amber-400/15 text-amber-400 font-medium",children:k.length})]}),h.jsx(QQ,{gates:k,allGates:e,items:t,onResolveGate:u})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Recent Sessions"}),h.jsx("div",{className:"mt-2",children:h.jsx(JQ,{sessions:r,items:t,onSelect:c})})]})]}),f&&h.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0",children:[h.jsx("div",{className:"px-3 py-2 border-b border-border",children:h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Event Timeline"})}),h.jsx(YQ,{featureCode:s,itemId:p==null?void 0:p.id,onSelectItem:c})]})]})}function eJ(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 rJ(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:eJ(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function nJ({results:t,onClose:e}){const r=C.useMemo(()=>{const i={P0:0,P1:0,P2:0,killed:0,promoted:0,skipped:0};for(const s of t)s.action==="skip"?i.skipped++:s.action==="kill"?i.killed++:s.action==="promote"?i.promoted++:s.priority==="P0"?i.P0++:s.priority==="P1"?i.P1++:s.priority==="P2"&&i.P2++;return i},[t]),n=t.filter(i=>i.action!=="skip").length;return h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 text-center",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:h.jsx(Ci,{className:"w-5 h-5 text-emerald-400"})}),h.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Triage complete"}),h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Triaged ",n," of ",t.length," ideas"]}),h.jsxs("div",{className:"flex gap-3 text-[11px]",children:[r.P0>0&&h.jsxs("span",{className:"text-red-400",children:[r.P0," P0"]}),r.P1>0&&h.jsxs("span",{className:"text-amber-400",children:[r.P1," P1"]}),r.P2>0&&h.jsxs("span",{className:"text-blue-400",children:[r.P2," P2"]}),r.promoted>0&&h.jsxs("span",{className:"text-emerald-400",children:[r.promoted," promoted"]}),r.killed>0&&h.jsxs("span",{className:"text-muted-foreground",children:[r.killed," killed"]}),r.skipped>0&&h.jsxs("span",{className:"text-muted-foreground/60",children:[r.skipped," skipped"]})]}),h.jsx(Rt,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function iJ({ideas:t,onClose:e}){const{setPriority:r,killIdea:n,promoteIdea:i,ideas:s}=As(),[o,a]=C.useState(()=>[...t]),[l,c]=C.useState(0),[u,d]=C.useState([]),[p,f]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[b,k]=C.useState(!1),S=o[l]??null;o.length-l;const E=C.useMemo(()=>S?rJ(S,s.filter(B=>B.id!==S.id)):[],[S,s]),w=C.useCallback(()=>{const B=l+1;B>=o.length?f(!0):(c(B),y(!1),x(""))},[l,o.length]),T=C.useCallback(async B=>{if(!(!S||b)){k(!0);try{await r(S.id,B),d(W=>[...W,{id:S.id,action:"priority",priority:B}]),w()}finally{k(!1)}}},[S,b,r,w]),N=C.useCallback(async()=>{if(!(!S||b)){k(!0);try{await n(S.id,m),d(B=>[...B,{id:S.id,action:"kill"}]),y(!1),x(""),w()}finally{k(!1)}}},[S,b,n,m,w]),F=C.useCallback(()=>{S&&(d(B=>[...B,{id:S.id,action:"skip"}]),w())},[S,w]),L=C.useCallback(async()=>{if(!(!S||b)){k(!0);try{await i(S.id),d(B=>[...B,{id:S.id,action:"promote"}]),w()}finally{k(!1)}}},[S,b,i,w]);return C.useEffect(()=>{const B=W=>{if(W.key==="Escape"){e();return}g||(W.key==="0"&&T("P0"),W.key==="1"&&T("P1"),W.key==="2"&&T("P2"),(W.key==="s"||W.key==="ArrowRight")&&F(),W.key==="k"&&y(!0))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[g,T,F,e]),h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"hsl(var(--background) / 0.8)",backdropFilter:"blur(4px)"},children:h.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:[h.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[h.jsx(Ci,{className:"w-4 h-4 text-amber-400 shrink-0"}),h.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Triage"}),!p&&h.jsxs("span",{className:"text-[11px] text-muted-foreground ml-1",children:[l+1," of ",o.length," untriaged"]}),h.jsx("div",{className:"flex-1"}),h.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground transition-colors",children:h.jsx(ln,{className:"w-4 h-4"})})]}),!p&&h.jsx("div",{className:"h-1 bg-muted",children:h.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${Math.round(l/o.length*100)}%`}})}),h.jsx("div",{className:"flex-1 p-4",children:p?h.jsx(nJ,{results:u,onClose:e}):S?h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:S.id}),S.cluster&&h.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:S.cluster})]}),h.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:S.title}),S.description&&h.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:S.description}),h.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(S.tags||[]).map(B=>h.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:B},B))}),S.source&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",S.source]})]}),E.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Similar to:"}),h.jsx("div",{className:"space-y-1",children:E.map(B=>h.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded bg-muted/30 border border-border/40",children:[h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:B.id}),h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:B.title})]},B.id))})]}),g&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing (optional)…",value:m,onChange:B=>x(B.target.value),onKeyDown:B=>{B.key==="Enter"&&N(),B.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"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(Rt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),h.jsx(Rt,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:N,disabled:b,children:"Confirm Kill"})]})]})]}):h.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-8",children:"No more untriaged ideas."})}),!p&&S&&!g&&h.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsxs(Rt,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>T("P0"),disabled:b,title:"Press 0",children:["P0 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),h.jsxs(Rt,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>T("P1"),disabled:b,title:"Press 1",children:["P1 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),h.jsxs(Rt,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>T("P2"),disabled:b,title:"Press 2",children:["P2 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"2"})]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[h.jsx(Rt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:L,disabled:b,children:"Promote"}),h.jsxs(Rt,{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 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"k"})]}),h.jsxs(Rt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:F,title:"Press s or →",children:[h.jsx(c1,{className:"w-3 h-3"}),"Skip ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function Ly(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 sJ(t,e){const r=new Date().toISOString().slice(0,10),n=(t.tags||[]).join(", ")||"N/A";return`# ${e}: ${t.title}
744
-
745
- **Date:** ${r}
746
- **Promoted from:** ${t.id}
747
- **Priority:** ${t.priority||"TBD"}
748
- **Tags:** ${n}
749
-
750
- ## Context
751
-
752
- ${t.description||t.title}
753
-
754
- ## Source
755
-
756
- ${t.source||"Internal idea"}
757
-
758
- ## Goals
759
-
760
- - [ ] Define acceptance criteria
761
- - [ ] Identify affected components
762
- - [ ] Estimate effort
763
-
764
- ## Related
765
-
766
- ${t.mapsTo?`- Maps to: ${t.mapsTo}`:"- TBD"}
767
- `.trimStart()}function oJ({step:t,current:e}){const r=e>t,n=e===t;return h.jsx("div",{className:"flex items-center gap-1.5",children:h.jsx("div",{className:nt("w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-semibold border transition-colors",r?"bg-emerald-400/20 border-emerald-400/60 text-emerald-400":n?"bg-accent/20 border-accent/60 text-accent":"bg-muted border-border/40 text-muted-foreground/40"),children:r?h.jsx(ba,{className:"w-3 h-3"}):t})})}function aJ({idea:t,onClose:e}){var E;const{promoteIdea:r}=As(),[n,i]=C.useState(1),[s,o]=C.useState(()=>Ly(t)),[a,l]=C.useState(""),[c,u]=C.useState(""),[d,p]=C.useState(!1),[f,m]=C.useState(null),x=C.useRef(null);C.useEffect(()=>{u(sJ(t,s||"FEAT-?"))},[t,s]),C.useEffect(()=>{n===1&&setTimeout(()=>{var w;return(w=x.current)==null?void 0:w.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(w=>w+1)},b=()=>i(w=>w-1),k=async()=>{if(!d){p(!0);try{await r(t.id,s.trim().toUpperCase()),m({featureCode:s.trim().toUpperCase()}),i(4)}catch(w){l(w.message||"Failed to promote"),i(1)}finally{p(!1)}}},S=["Feature ID","Preview","Confirm"];return h.jsx(hm,{open:!0,onOpenChange:w=>!w&&e(),children:h.jsxs(Th,{className:"max-w-lg",children:[h.jsx(_h,{children:h.jsxs(Eh,{className:"flex items-center gap-2",children:[h.jsx(Ci,{className:"w-4 h-4 text-amber-400"}),"Promote to Feature"]})}),n<4&&h.jsx("div",{className:"px-6 -mt-1 mb-1",children:h.jsx("div",{className:"flex items-center gap-2",children:[1,2,3].map((w,T)=>h.jsxs(Vt.Fragment,{children:[h.jsx(oJ,{step:w,current:n}),h.jsx("span",{className:nt("text-[10px] transition-colors",n===w?"text-foreground font-medium":"text-muted-foreground/60"),children:S[T]}),T<2&&h.jsx(js,{className:"w-3 h-3 text-muted-foreground/30 mx-0.5"})]},w))})}),h.jsxs("div",{className:"px-6 pb-2",children:[n<4&&h.jsxs("div",{className:"mb-4 px-3 py-2 rounded border border-border/50 bg-muted/20",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:t.id}),t.priority&&t.priority!=="—"&&h.jsx("span",{className:nt("text-[9px] px-1 py-0.5 rounded font-mono font-semibold",t.priority==="P0"?"text-red-400":t.priority==="P1"?"text-amber-400":"text-blue-400"),children:t.priority})]}),h.jsx("p",{className:"text-[12px] text-foreground font-medium leading-snug",children:t.title})]}),n===1&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold block mb-1.5",children:"Feature Code"}),h.jsx("input",{ref:x,type:"text",value:s,onChange:w=>{o(w.target.value.toUpperCase()),l("")},onKeyDown:w=>{w.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&&h.jsx("p",{className:"text-[11px] text-destructive mt-1",children:a})]}),t.cluster&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Suggested from cluster: ",h.jsx("span",{className:"text-muted-foreground",children:t.cluster})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold mb-1.5",children:"Suggestions"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:[Ly(t),`COMP-${(((E=t.tags)==null?void 0:E[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((w,T,N)=>N.indexOf(w)===T).map(w=>h.jsx("button",{onClick:()=>{o(w),l("")},className:nt("text-[10px] px-2 py-1 rounded border font-mono transition-colors",s===w?"bg-accent/10 border-accent/60 text-accent":"border-border/40 text-muted-foreground hover:border-border hover:text-foreground"),children:w},w))})]})]}),n===2&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Generated plan.md stub"}),h.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:c}),h.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&&h.jsxs("div",{className:"space-y-3",children:[h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Promote ",h.jsx("span",{className:"text-foreground font-medium",children:t.id})," to feature"," ",h.jsx("span",{className:"font-mono text-accent font-semibold",children:s}),"?"]}),h.jsxs("p",{className:"text-[11px] text-muted-foreground/70",children:["The idea will be marked ",h.jsxs("span",{className:"font-mono",children:["PROMOTED (",s,")"]})," in the ideabox."]})]}),n===4&&f&&h.jsxs("div",{className:"flex flex-col items-center gap-3 py-4 text-center",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-400/20 flex items-center justify-center",children:h.jsx(ba,{className:"w-5 h-5 text-emerald-400"})}),h.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Promoted!"}),h.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t.id," is now linked to feature"," ",h.jsx("span",{className:"font-mono text-accent font-semibold",children:f.featureCode})]}),h.jsx(Rt,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&h.jsxs(um,{children:[n>1&&h.jsxs(Rt,{variant:"ghost",size:"sm",onClick:b,disabled:d,children:[h.jsx(t1,{className:"w-3 h-3 mr-1"}),"Back"]}),h.jsx(Rt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?h.jsxs(Rt,{size:"sm",onClick:y,children:["Next",h.jsx(js,{className:"w-3 h-3 ml-1"})]}):h.jsx(Rt,{size:"sm",onClick:k,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const bf=["S","M","L"],lJ=["high","medium","low"],cJ={"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"},By={"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"},Ay=["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 hJ({idea:t,onSubmit:e,onCancel:r}){const[n,i]=C.useState(t.effort||""),[s,o]=C.useState(t.impact||"");return h.jsxs("div",{className:"p-2 bg-card border border-border rounded-lg shadow-md w-52",children:[h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-2 truncate font-medium",children:[t.id,": ",t.title]}),h.jsxs("div",{className:"mb-2",children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Effort"}),h.jsx("div",{className:"flex gap-1",children:bf.map(a=>h.jsx("button",{onClick:()=>i(a),className:nt("flex-1 text-[10px] py-0.5 rounded border transition-colors",n===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),h.jsxs("div",{className:"mb-2.5",children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1",children:"Impact"}),h.jsx("div",{className:"flex gap-1",children:["high","medium","low"].map(a=>h.jsx("button",{onClick:()=>o(a),className:nt("flex-1 text-[9px] py-0.5 rounded border transition-colors capitalize",s===a?"bg-primary/20 border-primary/50 text-primary":"border-border/40 text-muted-foreground hover:border-border"),children:a},a))})]}),h.jsxs("div",{className:"flex gap-1",children:[h.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"}),h.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 uJ({ideas:t,selectedIdeaId:e,onSelectIdea:r,onUpdateIdea:n}){const[i,s]=C.useState(null),o=C.useMemo(()=>{const u=[...new Set(t.map(p=>p.cluster||"__none__"))],d={};return u.forEach((p,f)=>{d[p]=Ay[f%Ay.length]}),d},[t]),a=C.useMemo(()=>t.filter(u=>u.effort&&u.impact),[t]),l=C.useMemo(()=>t.filter(u=>!u.effort||!u.impact),[t]),c=C.useCallback(async(u,d)=>{await n(u,d),s(null)},[n]);return h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsxs("div",{children:[h.jsx("div",{className:"flex mb-1 ml-12",children:bf.map(u=>h.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),lJ.map(u=>h.jsxs("div",{className:"flex mb-1",children:[h.jsx("div",{className:"w-12 shrink-0 flex items-center justify-end pr-2",children:h.jsx("span",{className:"text-[9px] text-muted-foreground capitalize",children:u})}),bf.map(d=>{const p=`${u}-${d}`,f=cJ[p],m=a.filter(x=>x.impact===u&&x.effort===d);return h.jsxs("div",{className:nt("flex-1 min-h-[90px] rounded border p-1.5 mr-1 relative transition-colors",By[f]||"border-border/30"),children:[h.jsx("span",{className:"absolute top-1 right-1 text-[8px] text-muted-foreground/50 italic",children:f}),h.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 h.jsx("button",{onClick:()=>r==null?void 0:r(x.id),title:`${x.id}: ${x.title}`,className:nt("w-5 h-5 rounded-full border-2 transition-all hover:scale-110 flex items-center justify-center",g,y?"border-foreground ring-1 ring-foreground":"border-transparent")},x.id)})})]},d)})]},u)),h.jsx("div",{className:"flex ml-12",children:h.jsx("div",{className:"flex-1 text-center text-[9px] text-muted-foreground/60 mt-0.5",children:"Effort (S = small, M = medium, L = large)"})})]}),h.jsx("div",{className:"flex flex-wrap gap-3 text-[10px]",children:Object.entries(By).map(([u,d])=>h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:nt("w-2.5 h-2.5 rounded-sm border",d)}),h.jsx("span",{className:"text-muted-foreground",children:u})]},u))}),l.length>0&&h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-2",children:["Unassigned (",l.length,") — click to assign effort/impact"]}),h.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(u=>h.jsxs("div",{className:"relative",children:[h.jsxs("button",{onClick:()=>s((i==null?void 0:i.id)===u.id?null:u),className:nt("text-[10px] px-2 py-1 rounded border transition-colors",(i==null?void 0:i.id)===u.id?"border-accent bg-accent/10 text-foreground":"border-border/50 text-muted-foreground hover:border-border hover:text-foreground"),children:[h.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&&h.jsx("div",{className:"absolute left-0 top-full mt-1 z-10",children:h.jsx(hJ,{idea:u,onSubmit:c,onCancel:()=>s(null)})})]},u.id))})]})]})}function Vu({value:t,max:e,color:r="bg-primary/60"}){const n=e>0?Math.round(t/e*100):0;return h.jsx("div",{className:"flex-1 h-1.5 bg-muted/50 rounded-full overflow-hidden",children:h.jsx("div",{className:nt("h-full rounded-full transition-all",r),style:{width:`${n}%`}})})}function dJ({ideas:t,killed:e}){const[r,n]=C.useState(!1),i=C.useMemo(()=>{var b,k,S,E;const s=[...t,...e||[]],o={};for(const w of s){const T=((b=w.source)==null?void 0:b.trim())||"(no source)",N=T.length>30?T.slice(0,30)+"…":T;o[N]=(o[N]||0)+1}const a=Object.entries(o).sort((w,T)=>T[1]-w[1]).slice(0,6),l=((k=a[0])==null?void 0:k[1])||1,c=s.filter(w=>w.status==="NEW").length,u=s.filter(w=>w.status==="DISCUSSING").length,d=s.filter(w=>{var T;return(T=w.status)==null?void 0:T.startsWith("PROMOTED")}).length,p=(e||[]).length,f=t.length,m=s.length>0?Math.round(p/s.length*100):0,x={};for(const w of s){const T=w.cluster||"(unclustered)";x[T]||(x[T]={total:0,promoted:0}),x[T].total+=1,(S=w.status)!=null&&S.startsWith("PROMOTED")&&(x[T].promoted+=1)}const g=Object.entries(x).sort((w,T)=>T[1].total-w[1].total).slice(0,5),y=((E=g[0])==null?void 0:E[1].total)||1;return{sourceEntries:a,maxSourceCount:l,newCount:c,discussingCount:u,promotedCount:d,killedCount:p,killRate:m,totalActive:f,clusterEntries:g,maxClusterTotal:y}},[t,e]);return t.length===0&&(!e||e.length===0)?null:h.jsxs("div",{className:"mt-1.5",children:[h.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?h.jsx(Ca,{className:"w-3 h-3"}):h.jsx(js,{className:"w-3 h-3"}),h.jsx(EM,{className:"w-3 h-3"}),h.jsx("span",{children:"Analytics"})]}),r&&h.jsxs("div",{className:"mt-2 space-y-3 border border-border/30 rounded-lg p-3 bg-muted/10",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Status Funnel"}),h.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})=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-16 text-[9px] text-muted-foreground shrink-0",children:s}),h.jsx(Vu,{value:o,max:Math.max(i.newCount,i.discussingCount,i.promotedCount,i.killedCount,1),color:a}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))}),i.killRate>0&&h.jsxs("p",{className:"text-[9px] text-muted-foreground/60 mt-1",children:["Kill rate: ",i.killRate,"%"]})]}),i.sourceEntries.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"By Source"}),h.jsx("div",{className:"space-y-1",children:i.sourceEntries.map(([s,o])=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),h.jsx(Vu,{value:o,max:i.maxSourceCount,color:"bg-violet-400/50"}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o})]},s))})]}),i.clusterEntries.length>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[9px] uppercase tracking-wider text-muted-foreground mb-1.5 font-semibold",children:"Cluster Health"}),h.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 h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"w-24 text-[9px] text-muted-foreground truncate shrink-0",title:s,children:s}),h.jsx(Vu,{value:o,max:i.maxClusterTotal,color:"bg-cyan-400/50"}),h.jsx("span",{className:"w-5 text-right text-[9px] text-muted-foreground shrink-0",children:o}),l>0&&h.jsxs("span",{className:"text-[9px] text-blue-400 shrink-0",children:[l,"%"]})]},s)})})]})]})]})}const fJ=[{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 My(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function z_({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 h.jsx("span",{className:nt("inline-block w-2 h-2 rounded-full shrink-0",e),title:t})}function pJ({priority:t}){if(!t||t==="—")return h.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 h.jsx("span",{className:nt("text-[9px] px-1.5 py-0.5 rounded border font-mono font-semibold",e[t]||"border-border/40 text-muted-foreground"),children:t})}function mJ({idea:t,selected:e,onClick:r,onDragStart:n,onDragEnd:i}){var s;return h.jsxs("div",{draggable:!0,onDragStart:o=>n==null?void 0:n(o,t.id),onDragEnd:i,onClick:()=>r==null?void 0:r(t.id),className:nt("group px-3 py-2.5 rounded border cursor-pointer transition-colors select-none","hover:border-accent/50",e?"border-accent/60 bg-accent/5":"border-border/50 bg-card/60"),children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),h.jsx(z_,{status:t.status}),h.jsx("div",{className:"flex-1"}),h.jsx(pJ,{priority:t.priority})]}),h.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&&h.jsxs("div",{className:"flex flex-wrap gap-1 mb-1",children:[t.tags.slice(0,4).map(o=>h.jsx("span",{className:"text-[9px] text-muted-foreground/70 font-mono",children:o},o)),t.tags.length>4&&h.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["+",t.tags.length-4]})]}),t.source&&h.jsx("p",{className:"text-[10px] text-muted-foreground/60 truncate",children:t.source})]})}function gJ({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,b,k,S;const[o,a]=C.useState(""),[l,c]=C.useState(!1),[u,d]=C.useState(!1),[p,f]=C.useState(""),[m,x]=C.useState(!1);if(!t)return null;const g=async()=>{const E=p.trim();if(E){x(!0);try{await s(t.id,"human",E),f("")}finally{x(!1)}}};return h.jsxs("div",{className:"w-80 border-l border-border flex flex-col shrink-0 overflow-hidden",children:[h.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),h.jsx(z_,{status:t.status}),h.jsx("span",{className:"text-[11px] text-muted-foreground flex-1 truncate",children:t.status}),h.jsx("button",{onClick:e,className:"text-muted-foreground/60 hover:text-foreground text-xs px-1",children:"x"})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-3 space-y-3",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Title"}),h.jsx("p",{className:"text-[13px] text-foreground font-medium leading-snug",children:t.title})]}),t.description&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Description"}),h.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:t.description})]}),t.source&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Source"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.source})]}),t.cluster&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Cluster"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.cluster})]}),((y=t.tags)==null?void 0:y.length)>0&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Tags"}),h.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(E=>h.jsx("span",{className:"text-[10px] bg-muted/50 px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:E},E))})]}),t.mapsTo&&h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:"Maps To"}),h.jsx("p",{className:"text-[11px] text-muted-foreground font-mono",children:t.mapsTo})]}),h.jsxs("div",{children:[h.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5 flex items-center gap-1",children:[h.jsx(Gc,{className:"w-3 h-3"}),"Discussion",((b=t.discussion)==null?void 0:b.length)>0&&h.jsxs("span",{className:"text-muted-foreground/50",children:["(",t.discussion.length,")"]})]}),((k=t.discussion)==null?void 0:k.length)>0&&h.jsx("div",{className:"space-y-1.5 mb-2",children:t.discussion.map((E,w)=>h.jsxs("div",{className:"px-2 py-1.5 rounded bg-muted/30 border border-border/30",children:[h.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[h.jsx("span",{className:nt("text-[9px] font-mono font-semibold",E.author==="agent"?"text-blue-400":"text-emerald-400"),children:E.author}),h.jsx("span",{className:"text-[9px] text-muted-foreground/50",children:E.date})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground leading-relaxed",children:E.text})]},w))}),h.jsxs("div",{className:"flex gap-1.5 items-end",children:[h.jsx("input",{type:"text",placeholder:"Add comment…",value:p,onChange:E=>f(E.target.value),onKeyDown:E=>E.key==="Enter"&&!E.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}),h.jsx("button",{onClick:g,disabled:!p.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:h.jsx(Yf,{className:"w-3 h-3"})})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:"Priority"}),h.jsx("div",{className:"flex gap-1.5",children:["P0","P1","P2","—"].map(E=>h.jsx("button",{onClick:()=>i(t.id,E),className:nt("flex-1 text-[10px] px-1.5 py-1 rounded border transition-colors",t.priority===E?E==="P0"?"bg-red-400/20 text-red-400 border-red-400/50":E==="P1"?"bg-amber-400/20 text-amber-400 border-amber-400/50":E==="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:E==="—"?"none":E},E))})]})]}),!((S=t.status)!=null&&S.startsWith("PROMOTED"))&&t.status!=="KILLED"&&h.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[h.jsx(Rt,{size:"sm",className:"w-full h-7 text-[11px]",onClick:()=>r(t),children:"Promote to Feature"}),l?h.jsxs("div",{className:"space-y-1.5",children:[h.jsx("input",{autoFocus:!0,type:"text",placeholder:"Reason for killing…",value:o,onChange:E=>a(E.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"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsx(Rt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{c(!1),a("")},children:"Cancel"}),h.jsx(Rt,{size:"sm",className:"flex-1 h-7 text-[10px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:()=>{n(t.id,o),c(!1),a("")},children:"Confirm Kill"})]})]}):h.jsx(Rt,{size:"sm",variant:"outline",className:"w-full h-7 text-[11px] text-destructive border-destructive/30 hover:bg-destructive/10",onClick:()=>c(!0),children:"Kill"})]})]})}function xJ({killed:t,onResurrect:e}){const[r,n]=C.useState(!1);return t.length===0?null:h.jsxs("div",{className:"mt-4 border border-border/40 rounded-lg overflow-hidden",children:[h.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?h.jsx(Ca,{className:"w-3 h-3 text-muted-foreground"}):h.jsx(js,{className:"w-3 h-3 text-muted-foreground"}),h.jsx("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Graveyard"}),h.jsxs("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:["(",t.length,")"]})]}),r&&h.jsx("div",{className:"p-3 grid grid-cols-1 gap-2 bg-muted/10",children:t.map(i=>h.jsx("div",{className:"px-3 py-2 rounded border border-border/40 bg-card/40",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[h.jsx(er,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0 opacity-60",children:i.id}),h.jsx("p",{className:"text-[11px] text-muted-foreground/70 line-clamp-1 font-medium",children:i.title})]}),i.killedDate&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/50",children:["Killed ",i.killedDate,i.killedReason?` — ${i.killedReason}`:""]})]}),h.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 yJ(){const{ideas:t,killed:e,loading:r,error:n,selectedIdeaId:i,filters:s,hydrate:o,setPriority:a,killIdea:l,resurrectIdea:c,setSelectedIdea:u,updateFilters:d,addDiscussion:p,updateIdea:f}=As(),[m,x]=C.useState(!1),[g,y]=C.useState(null),[b,k]=C.useState(null),[S,E]=C.useState(null),[w,T]=C.useState("cards"),N=C.useMemo(()=>{var X;const P=t.filter(A=>A.status==="NEW").length,$=t.filter(A=>!A.priority||A.priority==="—").length,D=t.filter(A=>A.priority==="P0").length,_={};t.filter(A=>A.priority==="P0"&&A.cluster).forEach(A=>{_[A.cluster]=(_[A.cluster]||0)+1});const R=((X=Object.entries(_).sort((A,ct)=>ct[1]-A[1])[0])==null?void 0:X[0])??null;return{newCount:P,untriaged:$,p0Count:D,topCluster:R}},[t]),F=C.useMemo(()=>{const P=new Set;return t.forEach($=>($.tags||[]).forEach(D=>P.add(D))),[...P].sort()},[t]),L=C.useMemo(()=>t.filter(P=>{var $;if(s.tag&&!(($=P.tags)!=null&&$.includes(s.tag))||s.status&&(P.status||"").split(/\s+/)[0]!==s.status||s.priority&&P.priority!==s.priority)return!1;if(s.search){const D=s.search.toLowerCase();if(!`${P.title} ${P.description} ${P.id} ${(P.tags||[]).join(" ")}`.toLowerCase().includes(D))return!1}return!0}),[t,s]),B=C.useMemo(()=>{const P=new Map,$=[];L.forEach(R=>{R.cluster?(P.has(R.cluster)||P.set(R.cluster,[]),P.get(R.cluster).push(R)):$.push(R)});const D=R=>[...R].sort((X,A)=>My(X.priority)-My(A.priority)),_=[];for(const[R,X]of P)_.push({cluster:R,ideas:D(X)});return $.length>0&&_.push({cluster:null,ideas:D($)}),_},[L]),W=C.useMemo(()=>t.find(P=>P.id===i)||e.find(P=>P.id===i)||null,[t,e,i]),G=C.useCallback((P,$)=>{k($),P.dataTransfer.effectAllowed="move"},[]),O=C.useCallback(()=>{k(null),E(null)},[]),I=C.useCallback((P,$)=>{P.preventDefault(),P.dataTransfer.dropEffect="move",E($)},[]),M=C.useCallback(async(P,$)=>{P.preventDefault(),b&&await a(b,$),k(null),E(null)},[b,a]);return h.jsxs("div",{className:"flex-1 flex flex-row overflow-hidden",children:[h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[h.jsxs("div",{className:"px-4 py-2.5 border-b border-border shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx(Ci,{className:"w-4 h-4 text-amber-400 shrink-0"}),h.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Ideabox"}),r&&h.jsx(Gl,{className:"w-3 h-3 text-muted-foreground animate-spin"}),h.jsx("div",{className:"flex-1"}),h.jsxs("div",{className:"flex items-center gap-0.5 border border-border/50 rounded-md p-0.5",children:[h.jsx("button",{onClick:()=>T("cards"),className:nt("text-[10px] px-2 py-0.5 rounded transition-colors",w==="cards"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Cards"}),h.jsx("button",{onClick:()=>T("matrix"),className:nt("text-[10px] px-2 py-0.5 rounded transition-colors",w==="matrix"?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:"Matrix"})]}),h.jsx("button",{onClick:()=>o(),className:"text-[10px] text-muted-foreground/60 hover:text-muted-foreground transition-colors",title:"Refresh",children:h.jsx(Gl,{className:"w-3 h-3"})}),h.jsxs(Rt,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:N.untriaged===0,children:["Triage (",N.untriaged,")"]})]}),h.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[N.newCount>0&&h.jsxs("span",{className:"text-emerald-400",children:[N.newCount," new"]}),h.jsxs("span",{children:[N.untriaged," untriaged"]}),N.p0Count>0&&h.jsxs("span",{className:"text-red-400",children:[N.p0Count," P0"]}),N.topCluster&&h.jsxs("span",{children:["top cluster: ",h.jsx("span",{className:"text-foreground",children:N.topCluster})]}),h.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),h.jsx(dJ,{ideas:t,killed:e})]}),h.jsxs("div",{className:"px-4 py-2 border-b border-border shrink-0 flex items-center gap-2 flex-wrap",children:[h.jsx(YM,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsxs("select",{value:s.tag,onChange:P=>d({tag:P.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All tags"}),F.map(P=>h.jsx("option",{value:P,children:P},P))]}),h.jsxs("select",{value:s.status,onChange:P=>d({status:P.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All statuses"}),h.jsx("option",{value:"NEW",children:"New"}),h.jsx("option",{value:"DISCUSSING",children:"Discussing"}),h.jsx("option",{value:"PROMOTED",children:"Promoted"})]}),h.jsxs("select",{value:s.priority,onChange:P=>d({priority:P.target.value}),className:"text-[11px] bg-muted text-foreground px-2 py-1 rounded border border-border/50 cursor-pointer h-6",children:[h.jsx("option",{value:"",children:"All priorities"}),h.jsx("option",{value:"P0",children:"P0"}),h.jsx("option",{value:"P1",children:"P1"}),h.jsx("option",{value:"P2",children:"P2"}),h.jsx("option",{value:"—",children:"Untriaged"})]}),h.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[120px]",children:[h.jsx(Zn,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:P=>d({search:P.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)&&h.jsx("button",{onClick:()=>As.getState().clearFilters(),className:"text-[10px] text-muted-foreground/60 hover:text-foreground transition-colors",children:"Clear"})]}),h.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[n&&h.jsx("div",{className:"mb-4 px-3 py-2 rounded border border-destructive/30 bg-destructive/10",children:h.jsx("p",{className:"text-[11px] text-destructive",children:n})}),w==="matrix"&&h.jsx(uJ,{ideas:L,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:f}),w==="cards"&&L.length===0&&!r&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center gap-2",children:[h.jsx(Ci,{className:"w-8 h-8 text-muted-foreground/30"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"No ideas yet."}),h.jsxs("p",{className:"text-[11px] text-muted-foreground/60",children:["Use the CLI: ",h.jsx("span",{className:"font-mono",children:'compose idea "Your idea title"'})]})]}),w==="cards"&&B.map(({cluster:P,ideas:$})=>h.jsxs("div",{className:"mb-6",children:[P&&h.jsxs("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold mb-3 flex items-center gap-2",children:[h.jsx("span",{children:P}),h.jsxs("span",{className:"text-muted-foreground/40 normal-case tracking-normal font-normal",children:["(",$.length,")"]})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3",children:fJ.map(D=>{const _=$.filter(X=>X.priority===D.key),R=S===D.key&&b;return h.jsxs("div",{className:nt("rounded-lg border p-2 min-h-[80px] transition-colors",D.bg,D.border,R&&"ring-1 ring-accent"),onDragOver:X=>I(X,D.key),onDrop:X=>M(X,D.key),children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[h.jsx("span",{className:nt("text-[10px] font-semibold uppercase tracking-wider",D.color),children:D.label}),h.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["(",_.length,")"]})]}),h.jsxs("div",{className:"space-y-1.5",children:[_.map(X=>h.jsx(mJ,{idea:X,selected:i===X.id,onClick:u,onDragStart:G,onDragEnd:O},X.id)),_.length===0&&h.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},D.key)})})]},P||"__unclustered__")),w==="cards"&&h.jsx(xJ,{killed:e,onResurrect:c})]})]}),W&&h.jsx(gJ,{idea:W,onClose:()=>u(null),onPromote:P=>y(P),onKill:l,onSetPriority:a,onAddDiscussion:p}),m&&h.jsx(iJ,{ideas:t.filter(P=>!P.priority||P.priority==="—"),onClose:()=>x(!1)}),g&&h.jsx(aJ,{idea:g,onClose:()=>y(null)})]})}const bJ=["A","B","C","D","E","F","G","H"];function CJ({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)?bJ[s]??t.id:t.id;return h.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)&&h.jsx("span",{className:"absolute top-2 right-2 text-accent",children:r?h.jsx(ba,{style:{width:14,height:14}}):h.jsx(_I,{style:{width:14,height:14}})}),h.jsxs("span",{className:"block text-[12px] font-bold text-foreground",children:[o,". ",t.title]}),((a=t.bullets)==null?void 0:a.length)>0&&h.jsx("ul",{className:"mt-1.5 space-y-0.5 list-none pl-0",children:t.bullets.map((l,c)=>h.jsxs("li",{className:"text-[11px] text-muted-foreground leading-snug",children:[h.jsx("span",{className:"mr-1",children:"•"}),l]},c))})]})}function kJ(){const{session:t,messages:e,decisions:r,status:n,error:i,streamingMessage:s,designDocPath:o,hydrate:a,startSession:l,sendMessage:c,selectCard:u,completeDesign:d,connectSSE:p,disconnectSSE:f,reset:m}=Wn(),[x,g]=C.useState(""),[y,b]=C.useState(null),[k,S]=C.useState(""),E=C.useRef(null);C.useEffect(()=>(Wn.setState({scope:null,featureCode:null}),a(),()=>f()),[]),C.useEffect(()=>{var B;(B=E.current)==null||B.scrollIntoView({behavior:"smooth"})},[e,s]);const w=C.useCallback(()=>{x.trim()&&(c(x.trim()),g(""))},[x,c]),T=C.useCallback((B,W)=>{b({messageIndex:W,cardId:B})},[]),N=C.useCallback(()=>{y&&(u(y.cardId,k||null,y.messageIndex),b(null),S(""))},[y,k,u]),F=n==="streaming"||n==="summarizing",L=e.reduce((B,W,G)=>W.role==="assistant"&&W.content&&I_(W.content).parts.some(O=>O.type==="decision")?G:B,-1);return t?h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[i&&h.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"&&h.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:[h.jsx(pg,{style:{width:12,height:12},className:"text-green-400"}),h.jsx("span",{className:"text-green-400 font-medium",children:"Design complete."}),o&&h.jsxs("span",{className:"text-muted-foreground",children:["Document written to ",h.jsx("code",{className:"text-foreground",children:o})]}),h.jsx("div",{className:"flex-1"}),h.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"})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.map((B,W)=>h.jsx(Iy,{messageIndex:W,message:B,onCardSelect:T,selectedCard:y,isStreaming:F,cardsDisabled:F||W!==L},W)),s&&h.jsx(Iy,{message:s,onCardSelect:T,selectedCard:y,isStreaming:F}),h.jsx("div",{ref:E})]}),n!=="complete"&&h.jsxs("div",{className:"border-t border-border p-3 shrink-0",children:[y?h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Selected: ",h.jsx("span",{className:"font-semibold text-foreground",children:y.cardId})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:k,onChange:B=>S(B.target.value),onKeyDown:B=>B.key==="Enter"&&N(),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"}),h.jsx("button",{onClick:N,disabled:F,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"}),h.jsx("button",{onClick:()=>{b(null),S("")},className:"px-3 py-1.5 text-[11px] rounded border border-border text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}):h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{type:"text",value:x,onChange:B=>g(B.target.value),onKeyDown:B=>B.key==="Enter"&&!B.shiftKey&&w(),placeholder:F?"Waiting for response...":"Type a response...",disabled:F,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"}),h.jsx("button",{onClick:w,disabled:F||!x.trim(),className:"px-3 py-1.5 rounded bg-accent text-accent-foreground disabled:opacity-50 transition-opacity",children:h.jsx(Yf,{style:{width:14,height:14}})})]}),n==="active"&&r.length>=2&&h.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:[h.jsx(pg,{style:{width:12,height:12}}),"Complete Design"]})]})]}):h.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8",children:[h.jsx(Gc,{className:"text-muted-foreground",style:{width:48,height:48}}),h.jsx("h2",{className:"text-[14px] font-semibold text-foreground",children:"Start a Design Conversation"}),h.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&&h.jsx("p",{className:"text-[11px] text-red-400 text-center max-w-md",children:i}),h.jsxs("div",{className:"flex gap-2",children:[h.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"}),h.jsx("button",{onClick:()=>{const B=prompt("Feature code:");B&&l("feature",B)},className:"px-4 py-2 text-[11px] font-medium rounded border border-border text-foreground hover:bg-muted transition-colors",children:"Feature Design"})]})]})}function Iy({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,c;const o=t.role==="human",a=!o&&t.content?I_(t.content):null;return h.jsx("div",{className:nt("flex",o?"justify-end":"justify-start"),children:h.jsx("div",{className:nt("max-w-[85%] rounded-lg px-3 py-2 text-[12px]",o?"bg-accent/20 text-foreground":"bg-muted text-foreground"),children:o?h.jsx("div",{children:t.type==="card_select"?h.jsxs("span",{children:["Selected ",h.jsx("strong",{children:(l=t.content)==null?void 0:l.cardId}),(c=t.content)!=null&&c.comment?`: ${t.content.comment}`:""]}):h.jsx("span",{children:t.content})}):a?h.jsx("div",{className:"space-y-3",children:a.parts.map((u,d)=>{var p,f;return u.type==="text"?h.jsx("div",{className:"whitespace-pre-wrap",children:u.content},d):h.jsxs("div",{className:"space-y-2",children:[h.jsx("div",{className:"flex flex-col gap-2 mt-2",children:(p=u.content.options)==null?void 0:p.map(m=>{var x;return h.jsx(CJ,{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)})}),((f=u.content.recommendation)==null?void 0:f.rationale)&&h.jsx("div",{className:"text-[11px] text-muted-foreground italic mt-1",children:u.content.recommendation.rationale})]},d)})}):h.jsx("div",{className:"whitespace-pre-wrap",children:t.content})})})}const vJ=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),wJ=new Set(["WebSearch","web_search"]);function SJ({expanded:t}){return h.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:h.jsx("path",{d:"M3 2L7 5L3 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function TJ(){return h.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:[h.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--accent))",strokeWidth:"1.2"}),h.jsx("path",{d:"M3 5l1.5 1.5L7 3.5",stroke:"hsl(var(--accent))",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function _J(){return h.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",style:{flexShrink:0},children:h.jsx("circle",{cx:"5",cy:"5",r:"4",stroke:"hsl(var(--muted-foreground))",strokeWidth:"1.2"})})}function Yu({title:t,count:e,defaultExpanded:r,children:n}){const[i,s]=C.useState(r);return h.jsxs("div",{className:"border-b",style:{borderColor:"hsl(var(--sidebar-border))"},children:[h.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:[h.jsx(SJ,{expanded:i}),h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider flex-1",style:{color:"hsl(var(--muted-foreground))"},children:t}),e>0&&h.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&&h.jsx("div",{className:"pb-1",children:n})]})}function vl(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function Fy(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function EJ({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>vJ.has(o.tool)),n=t.filter(o=>wJ.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return h.jsx(Hn,{className:"flex-1",children:h.jsxs("div",{children:[h.jsx(Yu,{title:"Topic Outline",count:e.length,defaultExpanded:e.length>0,children:e.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No topics yet"}):h.jsx("ul",{className:"px-3 space-y-1 pt-0.5",children:e.map((o,a)=>h.jsxs("li",{className:"flex items-start gap-1.5 py-0.5",children:[h.jsx("span",{className:"mt-0.5",children:o.decided?h.jsx(TJ,{}):h.jsx(_J,{})}),h.jsx("span",{className:"text-[11px] leading-snug",style:{color:o.decided?"hsl(var(--foreground))":"hsl(var(--muted-foreground))"},children:o.title})]},a))})}),h.jsx(Yu,{title:"Codebase Refs",count:r.length,defaultExpanded:r.length>0,children:r.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No file references yet"}):h.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:i.map((o,a)=>h.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.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}),h.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:vl(Fy(o.tool,o.input),50)})]}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:vl(o.summary,100)})]},a))})}),h.jsx(Yu,{title:"Web Searches",count:n.length,defaultExpanded:n.length>0,children:n.length===0?h.jsx("p",{className:"px-3 py-2 text-[10px]",style:{color:"hsl(var(--muted-foreground))"},children:"No web searches yet"}):h.jsx("ul",{className:"px-2 space-y-1 pt-0.5",children:s.map((o,a)=>h.jsxs("li",{className:"px-2 py-1.5 rounded-md",style:{background:"hsl(var(--sidebar-accent) / 0.3)"},children:[h.jsx("p",{className:"text-[10px] font-medium leading-snug",style:{color:"hsl(var(--foreground))"},children:vl(Fy(o.tool,o.input),80)}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:vl(o.summary,100)})]},a))})})]})})}function NJ({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=C.useState("decisions"),o=t.filter(c=>!c.superseded).length,a=Wn(c=>c.researchItems)||[],l=Wn(c=>c.topicOutline)||[];return h.jsxs("aside",{className:"shrink-0 flex flex-col bg-sidebar border-r border-sidebar-border",style:{width:n??208},children:[h.jsx("div",{className:"p-3 pb-0",children:h.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"hsl(var(--foreground))"},children:"Design"})}),h.jsxs("div",{className:"flex px-2 pt-2 gap-1",style:{borderBottom:"1px solid hsl(var(--sidebar-border))"},children:[h.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&&h.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})]}),h.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&&h.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"&&h.jsx(Hn,{className:"flex-1",children:t.length===0?h.jsx("div",{className:"px-3 py-6 text-center text-[11px]",style:{color:"hsl(var(--muted-foreground))"},children:"No decisions yet"}):h.jsx("div",{className:"px-2 pb-2 pt-1",children:t.map((c,u)=>{var d;return h.jsxs("button",{disabled:c.superseded||r,onClick:()=>!c.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 ${c.superseded||r?"cursor-not-allowed opacity-40":"cursor-pointer hover:bg-sidebar-accent/50"}`,children:[h.jsx("span",{className:"text-[11px] font-medium leading-tight",style:{color:"hsl(var(--foreground))",textDecoration:c.superseded?"line-through":void 0},children:((d=c.selectedOption)==null?void 0:d.title)||c.question}),c.comment&&h.jsx("span",{className:"text-[10px] leading-snug mt-0.5",style:{color:"hsl(var(--muted-foreground))"},children:c.comment}),c.superseded&&h.jsx("span",{className:"text-[9px] mt-0.5 uppercase tracking-wider font-medium",style:{color:"hsl(var(--muted-foreground))"},children:"superseded"})]},u)})})}),i==="research"&&h.jsx(EJ,{researchItems:a,topicOutline:l})]})}function jJ(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function LJ(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 BJ(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 AJ=320,MJ=40,IJ={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function W_(t){return t?`compose:${t}:openLoopsCollapsed`:null}function Py(t){const e=W_(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function FJ(t,e){const r=W_(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function PJ({onConfirm:t,onCancel:e}){const[r,n]=C.useState("deferred"),[i,s]=C.useState(""),[o,a]=C.useState(""),l=c=>{c.preventDefault(),i.trim()&&t({kind:r,summary:i.trim(),ttl_days:o?parseInt(o,10):void 0})};return h.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:c=>{c.target===c.currentTarget&&e()},children:h.jsxs("form",{onSubmit:l,style:{background:"#1e1e2e",borderRadius:8,padding:24,width:360,display:"flex",flexDirection:"column",gap:12},children:[h.jsx("h3",{style:{margin:0,color:"#cdd6f4",fontSize:14},children:"Add Open Loop"}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Kind",h.jsxs("select",{value:r,onChange:c=>n(c.target.value),style:{display:"block",width:"100%",marginTop:4,background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,padding:"4px 8px"},children:[h.jsx("option",{value:"deferred",children:"Deferred"}),h.jsx("option",{value:"blocked",children:"Blocked"}),h.jsx("option",{value:"open_question",children:"Open Question"})]})]}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["Summary (max 280 chars)",h.jsx("textarea",{"data-testid":"add-loop-summary",value:i,onChange:c=>s(c.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"}})]}),h.jsxs("label",{style:{color:"#a6adc8",fontSize:12},children:["TTL days (optional, default 90)",h.jsx("input",{type:"number",value:o,onChange:c=>a(c.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"}})]}),h.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[h.jsx("button",{type:"button",onClick:e,style:{padding:"6px 16px",background:"#313244",color:"#cdd6f4",border:"1px solid #45475a",borderRadius:4,cursor:"pointer"},children:"Cancel"}),h.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 DJ({loop:t,onResolve:e,nowMs:r}){const n=BJ(t,r),i=!!t.resolution;return h.jsxs("div",{"data-testid":`loop-row-${t.id}`,style:{padding:"8px 12px",borderBottom:"1px solid #313244",opacity:i?.5:1},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx("span",{style:{fontSize:10,color:"#6c7086",background:"#313244",borderRadius:3,padding:"1px 5px"},children:IJ[t.kind]||t.kind}),n&&!i&&h.jsx("span",{"data-testid":`stale-badge-${t.id}`,style:{fontSize:10,color:"#f38ba8",background:"#3e1111",borderRadius:3,padding:"1px 5px"},children:">TTL"}),h.jsx("span",{style:{fontSize:10,color:"#6c7086",marginLeft:"auto"},children:LJ(t.created_at,r)})]}),h.jsx("p",{style:{margin:"4px 0 6px",fontSize:12,color:n&&!i?"#f38ba8":"#cdd6f4",lineHeight:1.4},children:t.summary}),!i&&h.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&&h.jsx("span",{style:{fontSize:11,color:"#a6e3a1"},children:"Resolved"})]})}function OJ({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var g,y;const[i,s]=C.useState(()=>Py(t)),[o,a]=C.useState(!1),[l,c]=C.useState(()=>Date.now());C.useEffect(()=>{const b=setInterval(()=>c(Date.now()),6e4);return()=>clearInterval(b)},[]),C.useEffect(()=>{s(Py(t))},[t]);const u=C.useCallback(()=>{s(b=>{const k=!b;return FJ(t,k),k})},[t]),d=C.useMemo(()=>!t||!e?null:e.find(b=>{var k;return((k=b.lifecycle)==null?void 0:k.featureCode)===t})??null,[t,e]),p=((y=(g=d==null?void 0:d.lifecycle)==null?void 0:g.lifecycle_ext)==null?void 0:y.open_loops)??[],f=C.useMemo(()=>jJ(p.filter(b=>b.resolution==null)),[p]),m=C.useCallback(async b=>{if(a(!1),r)try{await r(t,b)}catch(k){console.error("[OpenLoopsPanel] addLoop failed:",k.message)}},[t,r]),x=C.useCallback(async b=>{if(n){const k=window.prompt("Resolve note (optional):")||"";try{await n(t,b,{note:k})}catch(S){console.error("[OpenLoopsPanel] resolveLoop failed:",S.message)}}},[t,n]);return t?i?h.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:MJ,background:"#181825",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:12,borderLeft:"1px solid #313244",flexShrink:0},children:[h.jsx("button",{"data-testid":"open-loops-expand-btn",onClick:u,title:`Open loops (${f.length})`,style:{background:"none",border:"none",cursor:"pointer",color:"#a6adc8",fontSize:18},children:"↺"}),f.length>0&&h.jsx("span",{style:{fontSize:10,color:"#f5c2e7",marginTop:4},children:f.length})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"open-loops-panel",style:{width:AJ,background:"#181825",display:"flex",flexDirection:"column",borderLeft:"1px solid #313244",flexShrink:0,overflow:"hidden"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid #313244",gap:8},children:[h.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"#cdd6f4",flex:1},children:["Open Loops ",f.length>0&&h.jsxs("span",{style:{color:"#a6adc8"},children:["(",f.length,")"]})]}),h.jsx("button",{"data-testid":"add-loop-btn",onClick:()=>a(!0),title:"Add open loop",style:{background:"none",border:"1px solid #45475a",color:"#a6e3a1",borderRadius:4,padding:"2px 8px",cursor:"pointer",fontSize:12},children:"+"}),h.jsx("button",{"data-testid":"open-loops-collapse-btn",onClick:u,title:"Collapse",style:{background:"none",border:"none",cursor:"pointer",color:"#6c7086",fontSize:16},children:"›"})]}),h.jsx("div",{style:{flex:1,overflowY:"auto"},children:f.length===0?h.jsxs("div",{"data-testid":"open-loops-empty",style:{padding:"16px 12px",color:"#6c7086",fontSize:12,textAlign:"center"},children:["No open loops for this feature",h.jsx("br",{}),h.jsx("button",{onClick:()=>a(!0),style:{marginTop:8,background:"none",border:"1px solid #45475a",color:"#a6adc8",borderRadius:4,padding:"3px 10px",cursor:"pointer",fontSize:11},children:"+ Add loop"})]}):f.map(b=>h.jsx(DJ,{loop:b,onResolve:x,nowMs:l},b.id))})]}),o&&h.jsx(PJ,{onConfirm:m,onCancel:()=>a(!1)})]}):null}const Qi={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},$J=new Set(["blocks","informs"]);function Dy(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 RJ(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function zJ(t,e,r,n){if(!t)return{};const i={},{featureCode:s,status:o,currentStepId:a}=t;if(!s)return{};if(o==="failed")i[s]=Qi.error;else if(o==="running"){const c=a&&a.endsWith("_gate"),u=Dy(e,s);c&&u&&n.some(p=>p.itemId===u.id&&!p.resolvedAt)?i[s]=Qi.gate_pending:i[s]=Qi.building}const l=Dy(e,s);if(l&&(i[s]===Qi.building||i[s]===Qi.gate_pending)){const c=new Set([l.id]),u=WJ(c,r),d=new Map(e.map(p=>[p.id,RJ(p)]));for(const p of u){const f=d.get(p);f&&!i[f]&&(i[f]=Qi.blocked_downstream)}}return i}function WJ(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)$J.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 qJ(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 c=l.agentType||"claude",u=pE[c]||"#3b82f6";r.push({data:{id:`agent-${l.agentId}`,label:`${c}
768
- ${l.agentId.slice(0,6)}`,isAgentNode:!0,agentType:c,agentStatus:l.status||"running",agentColor:u,parent:"agent-topology"}});const p=l.parentSessionId&&i.has(l.parentSessionId)?`agent-${l.parentSessionId}`:"agent-session",f=`relay-${p}-agent-${l.agentId}`;n.has(f)||n.set(f,{data:{id:f,source:p,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 c=a(l.fromAgentId),u=a(l.toAgentId),d=l.direction==="dispatch"?`relay-${c}-${u}`:`relay-${u}-${c}`;o.add(d)}return{nodes:r,edges:[...n.values()],activeEdgeIds:o}}class Sr extends Vt.Component{constructor(){super(...arguments);ne(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?h.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:[h.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"}),h.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)}),h.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 HJ extends Vt.Component{constructor(){super(...arguments);ne(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){var r,n;return this.state.error?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.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:[h.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)]}),h.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"})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(Vy,{})})]}):this.props.children}}const Cf="compose:fontSize",UJ="compose:theme",Ko=13,kf=10,vf=20;function GJ(){try{const t=parseInt(localStorage.getItem(Cf),10);return t>=kf&&t<=vf?t:Ko}catch{return Ko}}const Oy=new URLSearchParams(window.location.search).get("popout");function VJ(){return Oy?h.jsx(WK,{path:Oy}):h.jsx(HJ,{children:h.jsx(XJ,{})})}function YJ({activeView:t,items:e,filteredItems:r,phaseFilteredItems:n,phaseFilteredGates:i,connections:s,filteredConnections:o,sessions:a,activeBuild:l,pipelineDraft:c,gates:u,settings:d,selectedPhase:p,selectedItemId:f,buildStateMap:m,agentOverlay:x,spawnedAgents:g,agentRelays:y,docsSelectedFile:b,onDocsSelectedFileChange:k,docsPreviousView:S,onDocsBack:E,visibleTracks:w,hiddenGroups:T,onSelect:N,onUpdate:F,onCreate:L,onDelete:B,onOpenGate:W,onCreateConnection:G,onDeleteConnection:O,onRefreshBuild:I,onSelectStep:M,onResolveGate:P,onUpdateSettings:$,onResetSettings:D,projectRoot:_,featureCode:R,focusActive:X,onToggleFocus:A,sessionState:ct,agentActivity:st,iterationStates:J}){switch(t){case"dashboard":return h.jsx(tJ,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:g,featureCode:R,sessionState:ct,agentActivity:st,iterationStates:J,onSelect:N,onResolveGate:P,onOpenGate:W});case"tree":return h.jsx(Z1,{items:r,connections:o,selectedItemId:f,onSelect:N,onCreate:L,featureCode:R,focusActive:X,onToggleFocus:A});case"graph":return h.jsx(J1,{items:e,connections:s,selectedItemId:f,onSelect:N,visibleTracks:w,hiddenGroups:T,buildStateMap:m,resolveGate:P,gates:u,spawnedAgents:g,agentRelays:y,agentOverlay:x,featureCode:R,focusActive:X,onToggleFocus:A});case"pipeline":return h.jsx(PT,{activeBuild:l,pipelineDraft:c,onSelectStep:M,onRefresh:I});case"sessions":return h.jsx(WT,{sessions:a,items:e,onSelectItem:N,featureCode:R,focusActive:X,onToggleFocus:A});case"gates":return h.jsx(AT,{gates:i,items:n,onResolve:P,onSelect:N,featureCode:R,focusActive:X,onToggleFocus:A});case"docs":return h.jsx(LT,{items:n,selectedFile:b,onSelectedFileChange:k,previousView:S,onBack:E,featureCode:R,focusActive:X,onToggleFocus:A});case"design":return h.jsx(kJ,{},_);case"ideabox":return h.jsx(yJ,{});case"settings":return h.jsx(FT,{settings:d,onSettingsChange:$,onReset:D});case"stratum":return h.jsx(KK,{});default:return h.jsxs("div",{className:"flex-1 flex items-center justify-center text-[12px] text-muted-foreground italic",children:["View “",t,"” not found."]})}}function XJ(){const{refresh:t}=sE(),e=Wn(q=>q.decisions),r=Wn(q=>q.status),[n,i]=C.useState(GJ),[s,o]=C.useState(()=>document.documentElement.classList.contains("dark")),[a]=C.useState(wQ),[l,c]=C.useState(()=>SQ(a)),[u,d]=C.useState(aZ),[p,f]=C.useState(TQ),[m,x]=C.useState(EQ),[g,y]=C.useState(null),[b,k]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[S,E]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:w,connections:T,connected:N,uiCommand:F,clearUICommand:L,recentChanges:B,createItem:W,updateItem:G,deleteItem:O,createConnection:I,deleteConnection:M,agentActivity:P,agentErrors:$,spawnedAgents:D,agentRelays:_,sessionState:R,registerSnapshotProvider:X,gates:A,gateEvent:ct,resolveGate:st,settings:J,updateSettings:yt,resetSettings:Ot,activeBuild:lt,setActiveBuild:Z,pipelineDraft:at,sessions:vt,iterationStates:Et,selectedPhase:Mt,setSelectedPhase:re,statusSnapshots:xe,setStatusSnapshot:Re}=pr(Di(q=>({items:q.items,connections:q.connections,connected:q.connected,uiCommand:q.uiCommand,clearUICommand:q.clearUICommand,recentChanges:q.recentChanges,createItem:q.createItem,updateItem:q.updateItem,deleteItem:q.deleteItem,createConnection:q.createConnection,deleteConnection:q.deleteConnection,agentActivity:q.agentActivity,agentErrors:q.agentErrors,spawnedAgents:q.spawnedAgents,agentRelays:q.agentRelays,sessionState:q.sessionState,registerSnapshotProvider:q.registerSnapshotProvider,gates:q.gates,gateEvent:q.gateEvent,resolveGate:q.resolveGate,settings:q.settings,updateSettings:q.updateSettings,resetSettings:q.resetSettings,activeBuild:q.activeBuild,setActiveBuild:q.setActiveBuild,pipelineDraft:q.pipelineDraft,sessions:q.sessions,iterationStates:q.iterationStates,selectedPhase:q.selectedPhase,setSelectedPhase:q.setSelectedPhase,statusSnapshots:q.statusSnapshots,setStatusSnapshot:q.setStatusSnapshot}))),Kt=(R==null?void 0:R.featureCode)||null;C.useEffect(()=>{Kt&&(xe&&xe[Kt]||$t(`/api/lifecycle/status?featureCode=${encodeURIComponent(Kt)}`).then(q=>q.json()).then(q=>{q!=null&&q.snapshot&&Re&&Re(Kt,q.snapshot)}).catch(()=>{}))},[Kt,xe,Re]);const[_e,V]=C.useState(null),it=C.useRef(!!localStorage.getItem("compose:activeView")),[ut,jt]=C.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[tt,mt]=C.useState(""),U=C.useCallback(q=>{k(q),localStorage.setItem("compose:contextWidthPx",String(Math.round(q)))},[]),et=C.useRef(!1),Tt=C.useCallback(q=>{q.preventDefault(),et.current=!0;const St=me=>{if(!et.current)return;const ar=me.clientX-16,ro=Math.max(160,Math.min(window.innerWidth*.4,ar));E(ro),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(ro)))},wt=()=>{et.current=!1,document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",wt)};document.addEventListener("mousemove",St),document.addEventListener("mouseup",wt)},[]),[zt,Yt]=C.useState(null),[ve,sr]=C.useState(null),[ae,yr]=C.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[ue,pe]=C.useState(()=>{try{const q=localStorage.getItem("compose:visibleTracks");if(q){const St=JSON.parse(q);return new Set(St)}}catch{}return null}),[br,Ke]=C.useState(new Set),[jh,Xs]=C.useState(!1),Ks=C.useCallback(q=>{Ke(St=>{const wt=new Set(St);return wt.has(q)?wt.delete(q):wt.add(q),wt})},[]),[Ia,ri]=C.useState(null),[Lh,ni]=C.useState(!1),[we,Kr]=C.useState(!1),[Bh,Zs]=C.useState(!1),[Qs,Js]=C.useState(""),[ii,Fa]=C.useState(""),[Cr,Dr]=C.useState(!1);C.useEffect(()=>{$t("/api/project").then(q=>q.json()).then(q=>{Js(q.name||""),Fa(q.targetRoot||"")}).catch(()=>{})},[]);const Pa=C.useCallback(async q=>{try{const wt=await(await $t("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:q})})).json();if(!wt.ok)return;await t(),Js(wt.name),Fa(wt.targetRoot),Dr(!1)}catch{}},[t]),to=u===Ue.MAXIMIZED,eo=C.useCallback(q=>{c(q),ky(q),jt(q)},[]),ze=C.useCallback(q=>{jt(q),c(q),ky(q)},[]);C.useEffect(()=>{localStorage.setItem("compose:activeView",ut),ut!=="docs"&&(sr(null),Yt(null))},[ut]),C.useEffect(()=>{ae?localStorage.setItem("compose:selectedTrack",ae):localStorage.removeItem("compose:selectedTrack")},[ae]),C.useEffect(()=>{_e?sessionStorage.setItem("vision-selectedItemId",_e):sessionStorage.removeItem("vision-selectedItemId")},[_e]),C.useEffect(()=>{try{ue?localStorage.setItem("compose:visibleTracks",JSON.stringify([...ue])):localStorage.removeItem("compose:visibleTracks")}catch{}},[ue]);const Lr=C.useRef(!1);C.useEffect(()=>{var q;Lr.current||it.current||(q=J==null?void 0:J.ui)!=null&&q.defaultView&&(ze(J.ui.defaultView),Lr.current=!0)},[J]),C.useEffect(()=>{F&&(F.view&&ze(F.view),F.phase!==void 0&&re(F.phase),F.select!==void 0&&Q(F.select),L())},[F,L]),C.useEffect(()=>{const q=()=>{var wt;return["INPUT","TEXTAREA","SELECT"].includes((wt=document.activeElement)==null?void 0:wt.tagName)},St=wt=>{(wt.metaKey||wt.ctrlKey)&&wt.key==="k"&&(wt.preventDefault(),ni(me=>!me)),(wt.metaKey||wt.ctrlKey)&&wt.key==="n"&&(wt.preventDefault(),Kr(!0)),wt.key===","&&!wt.metaKey&&!wt.ctrlKey&&!q()&&Zs(!0)};return window.addEventListener("keydown",St),()=>window.removeEventListener("keydown",St)},[]);const jn=C.useMemo(()=>{let q=w;if(Mt&&(q=q.filter(St=>St.phase===Mt)),ae&&(q=q.filter(St=>{const wt=(St.description||"").match(/Track:\s*(\w+)/i);return wt&&wt[1].toLowerCase()===ae})),tt){const St=tt.toLowerCase();q=q.filter(wt=>wt.title.toLowerCase().includes(St)||(wt.description||"").toLowerCase().includes(St))}return q},[w,Mt,ae,tt]),Oi=C.useMemo(()=>Mt?w.filter(q=>q.phase===Mt):w,[w,Mt]),Da=C.useMemo(()=>new Set(Oi.map(q=>q.id)),[Oi]),Oa=C.useMemo(()=>Mt?A.filter(q=>Da.has(q.itemId)):A,[A,Da,Mt]),$a=C.useMemo(()=>{if(!Mt&&!ae&&!tt)return T;const q=new Set(jn.map(St=>St.id));return T.filter(St=>q.has(St.fromId)&&q.has(St.toId))},[T,jn,Mt,ae,tt]),Ra=C.useMemo(()=>zJ(lt,w,T,A),[lt,w,T,A]),Nt=C.useMemo(()=>qJ(D,_),[D,_]),z=C.useCallback(q=>{y(q)},[]),Q=C.useCallback(q=>{V(St=>St===q?(z(null),null):(z({type:"item",id:q}),q))},[z]),gt=C.useCallback(async q=>{try{await $t(`/api/agent/${q}/stop`,{method:"POST",headers:Do({"Content-Type":"application/json"})})}catch(St){console.error(`[App] Failed to stop agent ${q}:`,St.message)}},[]),se=C.useRef(lt);C.useEffect(()=>{!se.current&&lt&&lt.featureItemId&&Q(lt.featureItemId),se.current=lt},[lt]);const Ee=C.useCallback(q=>{if(!q)return;const St=w.find(wt=>{var me,ar;return((me=wt.lifecycle)==null?void 0:me.featureCode)===q||wt.featureCode===q||wt.feature_code===q||((ar=wt.title)==null?void 0:ar.includes(q))});St&&Q(St.id)},[w,Q]);C.useEffect(()=>{const q=St=>{const{featureCode:wt}=St.detail||{};wt&&Ee(wt)};return window.addEventListener("compose:select-feature",q),()=>window.removeEventListener("compose:select-feature",q)},[Ee]);const de=C.useCallback(q=>w.find(St=>{var wt;return((wt=St.lifecycle)==null?void 0:wt.featureCode)===q})||null,[w]),We=C.useCallback(async(q,St)=>{const wt=de(q);if(!wt)throw new Error(`No item found for feature ${q}`);const me=await $t(`/api/vision/items/${wt.id}/loops`,{method:"POST",headers:Do({"Content-Type":"application/json"}),body:JSON.stringify(St)});if(!me.ok)throw new Error(`Add loop failed: ${me.status}`)},[de]),or=C.useCallback(async(q,St,{note:wt})=>{const me=de(q);if(!me)throw new Error(`No item found for feature ${q}`);const ar=await $t(`/api/vision/items/${me.id}/loops/${St}/resolve`,{method:"POST",headers:Do({"Content-Type":"application/json"}),body:JSON.stringify({note:wt})});if(!ar.ok)throw new Error(`Resolve loop failed: ${ar.status}`)},[de]);C.useEffect(()=>{X(()=>({activeView:ut,selectedPhase:Mt,searchQuery:tt,selectedItemId:_e,totalItems:w.length,filteredCount:jn.length,connected:N}))},[X,ut,Mt,tt,_e,w.length,jn.length,N]),C.useEffect(()=>{const q=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"))});return q.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>q.disconnect()},[]),C.useEffect(()=>{g&&!m&&(x(!0),vy(!0))},[g]),C.useEffect(()=>{ut==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[ut]);const kr=C.useCallback(()=>{const q=s?"light":"dark";document.documentElement.classList.toggle("dark",q==="dark"),localStorage.setItem(UJ,q),$t("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:q}})}).catch(()=>{})},[s]),$i=C.useCallback(q=>{i(St=>{const wt=Math.min(Math.max(St+q,kf),vf);return localStorage.setItem(Cf,wt),wt})},[]),Ne=C.useCallback(()=>{i(Ko),localStorage.setItem(Cf,Ko)},[]),za=C.useCallback(q=>{d(q),lZ(q)},[]),Wa=C.useCallback(()=>{f(q=>(_Q(!q),!q))},[]),q_=C.useCallback(()=>{x(q=>(vy(!q),!q))},[]),fm=C.useCallback((q,St)=>{G(q,St)},[G]),H_=C.useCallback(async()=>{const St=await W({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Mt||"vision"});St&&St.id&&Q(St.id)},[W,Mt]),U_=C.useCallback(async q=>{await O(q),_e===q&&(V(null),z(null))},[O,_e,z]),Ah=C.useCallback(q=>{const St=A.find(wt=>wt.id===q);St&&(V(St.itemId),z({type:"item",id:St.itemId}))},[A,z]),G_=C.useCallback(async q=>I(q),[I]),V_=C.useCallback(async q=>M(q),[M]),Y_=C.useCallback(()=>{$t("/api/build/state").then(q=>q.json()).then(q=>Z(q.state??null)).catch(()=>{})},[Z]),X_=C.useCallback(q=>{z({type:"step",id:q})},[z]),qa=C.useCallback(q=>{const St=w.find(ar=>ar.id===q);if(!St)return;const wt=(St.description||"").match(/Track:\s*(\w+)/i),me=wt?wt[1].toLowerCase():null;ae&&me&&ae!==me&&yr(null),me&&ue&&!ue.has(me)&&pe(ar=>{const ro=new Set(ar);return ro.add(me),ro})},[w,ae,ue]),K_=C.useCallback(q=>{qa(q),V(q),z({type:"item",id:q}),ze("graph")},[ze,z,qa]),Z_=C.useCallback(q=>{qa(q),V(q),z({type:"item",id:q}),ze("tree")},[ze,z,qa]),Q_=C.useCallback(q=>{sr(ut),Yt(q),ze("docs")},[ut,ze]),J_=C.useCallback(()=>{ve&&(ze(ve),sr(null),Yt(null))},[ve,ze]);return h.jsx(Yc.Provider,{value:B,children:h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[h.jsx(Sr,{zone:"header",children:h.jsxs("header",{className:"h-9 flex items-center px-3 gap-3 shrink-0 justify-between",style:{borderBottom:"1px solid hsl(var(--border))"},children:[h.jsxs("div",{className:"flex items-center shrink-0 gap-2 relative",children:[h.jsx("span",{className:"text-xs font-semibold tracking-widest uppercase text-accent",children:"Compose"}),h.jsx("button",{className:"text-[10px] uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors",onClick:()=>Dr(q=>!q),title:ii||"Switch project",children:Qs||"no project"}),Cr&&h.jsxs("div",{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:[h.jsxs("div",{className:"text-[10px] text-muted-foreground mb-1 px-1",children:["Current: ",ii]}),h.jsx("input",{autoFocus:!0,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...",defaultValue:ii,onKeyDown:q=>{q.key==="Enter"&&Pa(q.target.value),q.key==="Escape"&&Dr(!1)}})]})]}),h.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:h.jsx(QK,{tabs:a,activeTab:l,onTabChange:eo,onOpenPalette:()=>ni(q=>!q),badges:{gates:A.filter(q=>!q.resolvedAt).length}})}),h.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!N&&h.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),h.jsx("button",{className:"compose-btn-icon",onClick:kr,title:s?"Switch to light mode":"Switch to dark mode",children:s?"☀":"☾"}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("button",{className:"compose-btn-icon",onClick:()=>$i(-1),disabled:n<=kf,title:"Decrease font size",children:"A−"}),h.jsx("span",{className:"text-[10px] tabular-nums min-w-[20px] text-center text-muted-foreground",children:n}),h.jsx("button",{className:"compose-btn-icon",onClick:()=>$i(1),disabled:n>=vf,title:"Increase font size",children:"A+"})]}),h.jsx("button",{className:"compose-btn-icon",onClick:Ne,disabled:n===Ko,title:"Reset font size",children:"1:1"})]})]})}),h.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[!to&&h.jsxs("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[h.jsx(Sr,{zone:"sidebar",children:h.jsxs("div",{className:"flex h-full shrink-0",style:{borderRight:"1px solid hsl(var(--border))"},children:[h.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:Wa,title:p?"Collapse sidebar":"Expand sidebar","aria-expanded":p,"aria-label":"Toggle sidebar",style:{background:"hsl(var(--muted) / 0.3)"},children:p?"‹":"›"}),p&&h.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}),p&&(ut==="design"?h.jsx(NJ,{decisions:e,sessionComplete:r==="complete",onReviseDecision:q=>Wn.getState().reviseDecision(q),widthPx:S}):h.jsx(X1,{items:w,gates:A,activeBuild:lt,onViewChange:ze,selectedPhase:Mt,onPhaseSelect:re,selectedTrack:ae,onTrackSelect:yr,visibleTracks:ue,onToggleVisibleTrack:(q,St)=>pe(wt=>{if(!wt){const ar=new Set(St);return ar.delete(q),ar}const me=new Set(wt);return me.has(q)?me.delete(q):me.add(q),St&&me.size>=St.length?null:me}),onShowAllTracks:()=>pe(null),hiddenGroups:br,onToggleGroup:Ks,searchQuery:tt,onSearchChange:mt,connected:N,agentActivity:P,agentErrors:$,spawnedAgents:D,agentRelays:_,sessionState:R,onSelectItem:Q,onStopAgent:gt,onThemeChange:yt,onNewItem:()=>Kr(!0),widthPx:S}))]})}),h.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[h.jsx(j_,{featureCode:Kt,snapshot:Kt?(xe==null?void 0:xe[Kt])??null:null}),Kt&&h.jsx(N_,{currentFeatureCode:Kt}),h.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:h.jsx(Sr,{children:h.jsx(YJ,{activeView:ut,items:w,filteredItems:jn,phaseFilteredItems:Oi,phaseFilteredGates:Oa,connections:T,filteredConnections:$a,sessions:vt,activeBuild:lt,pipelineDraft:at,gates:A,settings:J,selectedPhase:Mt,selectedItemId:_e,onSelect:Q,onUpdate:fm,onCreate:H_,onDelete:U_,onOpenGate:Ah,onCreateConnection:G_,onDeleteConnection:V_,onRefreshBuild:Y_,onSelectStep:X_,onResolveGate:st,onUpdateSettings:yt,onResetSettings:Ot,visibleTracks:ue,hiddenGroups:br,buildStateMap:Ra,agentOverlay:Nt,spawnedAgents:D,agentRelays:_,docsSelectedFile:zt,onDocsSelectedFileChange:Yt,docsPreviousView:ve,onDocsBack:J_,projectRoot:ii,featureCode:Kt,focusActive:jh,onToggleFocus:()=>Xs(q=>!q),sessionState:R,agentActivity:P,iterationStates:Et})})})]}),ut!=="docs"&&h.jsx(Sr,{children:h.jsxs(pZ,{isOpen:m,onToggle:q_,widthPx:b,onResizePx:U,activeBuild:lt,gates:A,agentErrors:$,items:w,children:[(g==null?void 0:g.type)==="item"&&h.jsx(tQ,{itemId:g.id,onSelect:q=>{y({type:"item",id:q}),V(q)},onClose:()=>{y(null),V(null)},onOpenFile:Q_,onViewInGraph:K_,onViewInTree:Z_}),(g==null?void 0:g.type)==="step"&&h.jsx(cQ,{stepId:g.id,tierEvents:lt==null?void 0:lt.tierEvents,healthEvents:(lt==null?void 0:lt.health_score)!=null?[{score:lt.health_score,breakdown:lt.health_breakdown,missing:lt.health_missing}]:void 0,capabilityEvents:lt==null?void 0:lt.capabilityEvents}),(g==null?void 0:g.type)==="design-doc"&&h.jsx(uQ,{})]})}),Kt&&ut!=="docs"&&h.jsx(Sr,{zone:"open loops panel",children:h.jsx(OJ,{featureCode:Kt,items:w,onAddLoop:We,onResolveLoop:or})})]}),h.jsx(Sr,{zone:"ops strip",children:h.jsx(bQ,{activeView:ut,onSelectFeature:Ee})}),h.jsx(Sr,{zone:"agent bar",children:h.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",to?"flex-1 min-h-0":oZ(u)].join(" "),children:h.jsx(uZ,{barState:u,onStateChange:za})})})]}),h.jsx(Sr,{zone:"notifications",children:h.jsx(fQ,{})}),h.jsx(Sr,{zone:"gate notifications",children:h.jsx(E_,{onOpenGate:Ah})}),h.jsx(Sr,{zone:"challenge modal",children:Ia&&(()=>{const q=w.find(St=>St.id===Ia);return q?h.jsx(IT,{item:q,items:w,connections:T,onUpdate:fm,onClose:()=>ri(null)}):null})()}),h.jsx(MT,{event:ct,items:w,onNavigate:()=>ze("gates")}),h.jsx(Sr,{zone:"command palette",children:h.jsx(qT,{open:Lh,onClose:()=>ni(!1),onSelectItem:q=>{Q(q),ni(!1)},onSelectGate:q=>{Ah(q),ni(!1)}})}),h.jsx(Sr,{zone:"item form",children:h.jsx(T_,{open:we,onClose:()=>Kr(!1)})}),h.jsx(Sr,{zone:"settings",children:h.jsx(__,{open:Bh,onClose:()=>Zs(!1),settings:J,onSettingsChange:yt})})]})})}const jtt=Object.freeze(Object.defineProperty({__proto__:null,default:VJ},Symbol.toStringTag,{value:"Module"}));export{wC as $,ntt as A,Rn as B,h4 as C,be as D,UP as E,zp as F,dC as G,b9 as H,SR as I,L6 as J,X4 as K,ta as L,ett as M,fh as N,TP as O,kC as P,Qg as Q,mR as R,Td as S,y9 as T,va as U,Vr as V,K as W,Y as X,MP as Y,h9 as Z,v as _,$P as a,Mi as a$,uR as a0,bp as a1,att as a2,htt as a3,qi as a4,yx as a5,xx as a6,dtt as a7,utt as a8,ctt as a9,kt as aA,vtt as aB,OW as aC,MW as aD,AW as aE,P7 as aF,rC as aG,dR as aH,ttt as aI,dh as aJ,wc as aK,fw as aL,mp as aM,Dn as aN,na as aO,ux as aP,UO as aQ,Oz as aR,uw as aS,iw as aT,W8 as aU,Cc as aV,q8 as aW,Na as aX,ui as aY,Mz as aZ,Ox as a_,stt as aa,ott as ab,ltt as ac,ptt as ad,ftt as ae,aW as af,SS as ag,Stt as ah,A6 as ai,ir as aj,En as ak,go as al,Wp as am,bw as an,_i as ao,ww as ap,Dt as aq,sn as ar,La as as,I7 as at,M7 as au,xt as av,cq as aw,wtt as ax,Ttt as ay,ktt as az,OP as b,H8 as b0,Ip as b1,z8 as b2,V8 as b3,Us as b4,Dz as b5,o9 as b6,Q8 as b7,Jz as b8,Ap as b9,a9 as bA,Mp as bB,c9 as bC,jtt as bD,j0 as ba,Ct as bb,Sw as bc,fr as bd,OO as be,pp as bf,DC as bg,Ta as bh,RC as bi,itt as bj,c4 as bk,Hs as bl,Hz as bm,Aq as bn,Ea as bo,vc as bp,ti as bq,lh as br,Mx as bs,Fp as bt,ow as bu,hw as bv,$8 as bw,lf as bx,s9 as by,Qz as bz,te as c,Ut as d,vC as e,Ie as f,zP as g,wn as h,Gr as i,F6 as j,wa as k,rt as l,kw as m,rtt as n,Ett as o,WP as p,qP as q,_tt as r,RP as s,B6 as t,Wr as u,EW as v,v9 as w,mtt as x,Ms as y,DP as z};