@smartmemory/compose 0.1.44-beta → 0.2.1-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 (77) hide show
  1. package/README.md +1 -1
  2. package/bin/compose.js +71 -35
  3. package/dist/assets/App-VU2lfA8m.js +770 -0
  4. package/dist/assets/{arc-N74_SuiS.js → arc-CIeqpX37.js} +1 -1
  5. package/dist/assets/{architectureDiagram-3BPJPVTR-DHOb5xas.js → architectureDiagram-3BPJPVTR-itmOSZLE.js} +1 -1
  6. package/dist/assets/{blockDiagram-GPEHLZMM-DR9b_xXC.js → blockDiagram-GPEHLZMM-N7MotI_5.js} +8 -8
  7. package/dist/assets/{c4Diagram-AAUBKEIU-EXIx4J1v.js → c4Diagram-AAUBKEIU-DRKW39LH.js} +1 -1
  8. package/dist/assets/channel-DugSMLKi.js +1 -0
  9. package/dist/assets/{chunk-2J33WTMH-CyZqa6ub.js → chunk-2J33WTMH-CF6iSwEb.js} +1 -1
  10. package/dist/assets/{chunk-4BX2VUAB-SjPmvNaj.js → chunk-4BX2VUAB-BTe-QE0R.js} +1 -1
  11. package/dist/assets/{chunk-55IACEB6-Cnu3mdms.js → chunk-55IACEB6-E2hHEsl9.js} +1 -1
  12. package/dist/assets/{chunk-727SXJPM-DNj5i6fj.js → chunk-727SXJPM-CBRmkSvh.js} +1 -1
  13. package/dist/assets/{chunk-AQP2D5EJ-BIVskOlI.js → chunk-AQP2D5EJ-BdtQ63fN.js} +1 -1
  14. package/dist/assets/{chunk-FMBD7UC4-BWlLU-hh.js → chunk-FMBD7UC4-DfYQ2YmB.js} +1 -1
  15. package/dist/assets/{chunk-ND2GUHAM-DQEknadH.js → chunk-ND2GUHAM-CDrOVOW5.js} +1 -1
  16. package/dist/assets/{chunk-QZHKN3VN-CUYnhnAB.js → chunk-QZHKN3VN-DwjqJ9xB.js} +1 -1
  17. package/dist/assets/classDiagram-4FO5ZUOK-D2RRwp7J.js +1 -0
  18. package/dist/assets/classDiagram-v2-Q7XG4LA2-D2RRwp7J.js +1 -0
  19. package/dist/assets/{cose-bilkent-S5V4N54A-X3n23b12.js → cose-bilkent-S5V4N54A-MHpsrtBZ.js} +1 -1
  20. package/dist/assets/{dagre-BM42HDAG-C0SrhQ_X.js → dagre-BM42HDAG-DaPz_mPt.js} +1 -1
  21. package/dist/assets/{diagram-2AECGRRQ-Bc3qx6pJ.js → diagram-2AECGRRQ-DIdstuOm.js} +1 -1
  22. package/dist/assets/{diagram-5GNKFQAL-UiCrD06F.js → diagram-5GNKFQAL-DbkTGVES.js} +1 -1
  23. package/dist/assets/{diagram-KO2AKTUF-B9Vn5KyO.js → diagram-KO2AKTUF-BPalYJed.js} +1 -1
  24. package/dist/assets/{diagram-LMA3HP47-DLOYeLM3.js → diagram-LMA3HP47-vnySSoyd.js} +1 -1
  25. package/dist/assets/{diagram-OG6HWLK6-CXjh2miZ.js → diagram-OG6HWLK6-Dv3BUJft.js} +1 -1
  26. package/dist/assets/{erDiagram-TEJ5UH35-EmDzXNsM.js → erDiagram-TEJ5UH35-B3OLgtKK.js} +1 -1
  27. package/dist/assets/{flowDiagram-I6XJVG4X-vk6E_ebo.js → flowDiagram-I6XJVG4X-DdpxVf-5.js} +1 -1
  28. package/dist/assets/{ganttDiagram-6RSMTGT7-DYYSAjNx.js → ganttDiagram-6RSMTGT7-QALT_Lj9.js} +4 -4
  29. package/dist/assets/{gitGraphDiagram-PVQCEYII-CWPZVbhV.js → gitGraphDiagram-PVQCEYII-nITcPPED.js} +1 -1
  30. package/dist/assets/{graph-uO5hwVZK.js → graph-DnLKqSPg.js} +2 -2
  31. package/dist/assets/{index-BYYTTzUT.js → index-CLb8RFcn.js} +3 -3
  32. package/dist/assets/index-jqUffYBL.css +1 -0
  33. package/dist/assets/{infoDiagram-5YYISTIA-Dsu-eeJm.js → infoDiagram-5YYISTIA-CjlRce3x.js} +1 -1
  34. package/dist/assets/{ishikawaDiagram-YF4QCWOH-BP1SP8WA.js → ishikawaDiagram-YF4QCWOH-OyKVgxOz.js} +1 -1
  35. package/dist/assets/{journeyDiagram-JHISSGLW-DkE5By_R.js → journeyDiagram-JHISSGLW-3FaFyfLR.js} +1 -1
  36. package/dist/assets/{kanban-definition-UN3LZRKU-Cf_230xs.js → kanban-definition-UN3LZRKU-DUPnRo3q.js} +1 -1
  37. package/dist/assets/{linear-B-paxRBQ.js → linear-BeL8i3rv.js} +1 -1
  38. package/dist/assets/{mindmap-definition-RKZ34NQL-DAp6uJ_b.js → mindmap-definition-RKZ34NQL-C0CwWNdR.js} +1 -1
  39. package/dist/assets/mobile-qvdJ5p0m.js +17 -0
  40. package/dist/assets/{pieDiagram-4H26LBE5-CbYY5KL0.js → pieDiagram-4H26LBE5-DaU2jPjX.js} +1 -1
  41. package/dist/assets/{quadrantDiagram-W4KKPZXB-D5S4_ac5.js → quadrantDiagram-W4KKPZXB-HFtjZSAT.js} +1 -1
  42. package/dist/assets/{requirementDiagram-4Y6WPE33-BrPWCnHz.js → requirementDiagram-4Y6WPE33-CX_Mz3gv.js} +1 -1
  43. package/dist/assets/{sankeyDiagram-5OEKKPKP-CP8j1mcl.js → sankeyDiagram-5OEKKPKP-BR2_eTy9.js} +1 -1
  44. package/dist/assets/{sequenceDiagram-3UESZ5HK-c8DuhvUj.js → sequenceDiagram-3UESZ5HK-CtHp0Qnp.js} +1 -1
  45. package/dist/assets/{stateDiagram-AJRCARHV-KO9G1Jrm.js → stateDiagram-AJRCARHV-DmiEmD6G.js} +1 -1
  46. package/dist/assets/stateDiagram-v2-BHNVJYJU-7rdO1Tgp.js +1 -0
  47. package/dist/assets/{timeline-definition-PNZ67QCA-Cs2HLlbG.js → timeline-definition-PNZ67QCA-GSHqrJ3A.js} +1 -1
  48. package/dist/assets/{vennDiagram-CIIHVFJN-rcSRidqI.js → vennDiagram-CIIHVFJN-CNxhQnCU.js} +1 -1
  49. package/dist/assets/{wardley-L42UT6IY-BsajGfii.js → wardley-L42UT6IY-Bf-gQIFY.js} +1 -1
  50. package/dist/assets/{wardleyDiagram-YWT4CUSO-CSWALc_m.js → wardleyDiagram-YWT4CUSO-RGxoapr7.js} +1 -1
  51. package/dist/assets/{xychartDiagram-2RQKCTM6-jC4Q0GvG.js → xychartDiagram-2RQKCTM6-1_H1qVde.js} +1 -1
  52. package/dist/index.html +3 -3
  53. package/lib/build.js +3 -2
  54. package/lib/feature-code.js +14 -4
  55. package/lib/feature-json.js +33 -2
  56. package/lib/feature-validator.js +135 -11
  57. package/lib/feature-writer.js +83 -3
  58. package/lib/migrate-roadmap.js +16 -2
  59. package/lib/project-paths.js +16 -0
  60. package/lib/roadmap-config.js +50 -0
  61. package/lib/roadmap-gen.js +46 -31
  62. package/lib/roadmap-heading.js +85 -0
  63. package/lib/roadmap-parser.js +69 -18
  64. package/lib/roadmap-preservers.js +60 -19
  65. package/lib/roadmap-roundtrip.js +137 -0
  66. package/lib/vision-writer.js +42 -14
  67. package/lib/xref-sync.js +160 -0
  68. package/package.json +1 -1
  69. package/server/compose-mcp.js +2 -1
  70. package/server/vision-store.js +1 -1
  71. package/dist/assets/App-CdP799CF.js +0 -768
  72. package/dist/assets/channel-yPY0IE15.js +0 -1
  73. package/dist/assets/classDiagram-4FO5ZUOK-SGKYXTP4.js +0 -1
  74. package/dist/assets/classDiagram-v2-Q7XG4LA2-SGKYXTP4.js +0 -1
  75. package/dist/assets/index-Dh2rRpBR.css +0 -1
  76. package/dist/assets/mobile-BwduHUEq.js +0 -17
  77. package/dist/assets/stateDiagram-v2-BHNVJYJU-eVyb8_R4.js +0 -1
@@ -1,768 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-BM42HDAG-C0SrhQ_X.js","assets/graph-BEmEBUp_.js","assets/layout-Bw0msyOw.js","assets/mobile-BwduHUEq.js","assets/mobile-5PV1E6OC.css","assets/index-BYYTTzUT.js","assets/index-Dh2rRpBR.css","assets/graph-uO5hwVZK.js","assets/cose-bilkent-S5V4N54A-X3n23b12.js","assets/c4Diagram-AAUBKEIU-EXIx4J1v.js","assets/chunk-ND2GUHAM-DQEknadH.js","assets/flowDiagram-I6XJVG4X-vk6E_ebo.js","assets/chunk-FMBD7UC4-BWlLU-hh.js","assets/chunk-55IACEB6-Cnu3mdms.js","assets/chunk-2J33WTMH-CyZqa6ub.js","assets/channel-yPY0IE15.js","assets/erDiagram-TEJ5UH35-EmDzXNsM.js","assets/gitGraphDiagram-PVQCEYII-CWPZVbhV.js","assets/chunk-4BX2VUAB-SjPmvNaj.js","assets/chunk-QZHKN3VN-CUYnhnAB.js","assets/wardley-L42UT6IY-BsajGfii.js","assets/ganttDiagram-6RSMTGT7-DYYSAjNx.js","assets/linear-B-paxRBQ.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-CrowFXzY.js","assets/infoDiagram-5YYISTIA-Dsu-eeJm.js","assets/pieDiagram-4H26LBE5-CbYY5KL0.js","assets/arc-N74_SuiS.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-W4KKPZXB-D5S4_ac5.js","assets/xychartDiagram-2RQKCTM6-jC4Q0GvG.js","assets/requirementDiagram-4Y6WPE33-BrPWCnHz.js","assets/sequenceDiagram-3UESZ5HK-c8DuhvUj.js","assets/classDiagram-4FO5ZUOK-SGKYXTP4.js","assets/chunk-727SXJPM-DNj5i6fj.js","assets/classDiagram-v2-Q7XG4LA2-SGKYXTP4.js","assets/stateDiagram-AJRCARHV-KO9G1Jrm.js","assets/chunk-AQP2D5EJ-BIVskOlI.js","assets/stateDiagram-v2-BHNVJYJU-eVyb8_R4.js","assets/journeyDiagram-JHISSGLW-DkE5By_R.js","assets/timeline-definition-PNZ67QCA-Cs2HLlbG.js","assets/mindmap-definition-RKZ34NQL-DAp6uJ_b.js","assets/kanban-definition-UN3LZRKU-Cf_230xs.js","assets/sankeyDiagram-5OEKKPKP-CP8j1mcl.js","assets/diagram-LMA3HP47-DLOYeLM3.js","assets/diagram-2AECGRRQ-Bc3qx6pJ.js","assets/blockDiagram-GPEHLZMM-DR9b_xXC.js","assets/diagram-5GNKFQAL-UiCrD06F.js","assets/architectureDiagram-3BPJPVTR-DHOb5xas.js","assets/diagram-KO2AKTUF-B9Vn5KyO.js","assets/ishikawaDiagram-YF4QCWOH-BP1SP8WA.js","assets/vennDiagram-CIIHVFJN-rcSRidqI.js","assets/diagram-OG6HWLK6-CXjh2miZ.js","assets/wardleyDiagram-YWT4CUSO-CSWALc_m.js"])))=>i.map(i=>d[i]);
2
- var h_=Object.defineProperty;var u_=(t,e,r)=>e in t?h_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var ne=(t,e,r)=>u_(t,typeof e!="symbol"?e+"":e,r);import{r as C,j as h,R as Xt,b as d_,g as Lc,f as zt,d as f_,a as rf,w as Po}from"./mobile-BwduHUEq.js";import{r as p_,_ as Jt,u as m_}from"./index-BYYTTzUT.js";import{a as ua,b as iy,f as g_}from"./graph-uO5hwVZK.js";const gr={feature:"#3b82f6",track:"#06b6d4",decision:"#22c55e",task:"#94a3b8",spec:"#8b5cf6",idea:"#f59e0b",question:"#ec4899",evaluation:"#f97316",thread:"#64748b",artifact:"#a855f7"},Hn={planned:"#64748b",ready:"#0ea5e9",in_progress:"#3b82f6",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#475569",killed:"#1e293b"},x_=["planned","ready","in_progress","review","complete","blocked","parked","killed"],sy=["vision","specification","planning","implementation","verification","release"],Il={vision:"Vision",specification:"Specification",planning:"Planning",implementation:"Implementation",verification:"Verification",release:"Release"},nf=["Untested","Low","Moderate","High","Crystallized"],_e={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"},oy={explore_design:"design.md",prd:"prd.md",architecture:"architecture.md",blueprint:"blueprint.md",plan:"plan.md",report:"report.md"},ay=["claude","codex","gemini","human","unassigned"],Yp={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"},gh=[{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 Xo(t,e){const r=kn[t.stepId]??(t.fromPhase&&t.toPhase?`${_e[t.fromPhase]??t.fromPhase} → ${_e[t.toPhase]??t.toPhase}`:"Gate"),n=(e==null?void 0:e.title)||t.featureCode||null;return n?`${r} — ${n}`:r}const Xp={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"}},y_={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%)"},Kp={complete:"hsl(var(--success, 160 60% 45%))",active:"hsl(var(--accent))",failed:"hsl(var(--destructive))",pending:"hsl(var(--muted-foreground) / 0.3)"},b_={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"},C_={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"}},k_={bg:"bg-muted/30",border:"border-border",text:"text-muted-foreground"},Zp=["bg-slate-600","bg-rose-500","bg-amber-500","bg-emerald-500","bg-emerald-500"],v_={info:"text-zinc-400",success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"},w_={phase:"text-blue-400",gate:"text-purple-400",session:"text-zinc-400",iteration:"text-blue-300",error:"text-red-400"},S_={"compose-explorer":"#06b6d4","compose-architect":"#a855f7",codex:"#10b981",claude:"#3b82f6"},Qp={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))"},ly={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 T_(t,e){return!Array.isArray(t)||t.length===0?"hidden":e?"expanded":"collapsed"}function __(t){return`violations (${Array.isArray(t)?t.length:0})`}function E_(t){return t?"▾":"▸"}function N_({violations:t=[],expanded:e,onToggle:r}){const[n,i]=C.useState(!1),s=e!==void 0,o=s?e:n,a=T_(t,o);if(a==="hidden")return null;function l(){s?r==null||r():i(d=>!d)}const c=E_(o),u=__(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 j_({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(N_,{violations:s,expanded:!0,onToggle:()=>n(!1)})]})}const L_=/\b(Error|error:|Traceback|FAILED|ENOENT|Cannot find)\b/,Jp=20;function B_({summary:t,output:e}){const[r,n]=C.useState(!1),[i,s]=C.useState(!1),o=e?L_.test(e):!1,a=e!=null&&e.length>0,l=a?e.split(`
3
- `):[],c=l.length>Jp,u=r&&!i&&c?l.slice(0,Jp):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 A_={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 M_(t){return y_[A_[t]||"thinking"]}function I_(t){return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:""}function F_(t){return t==null?"":t<.001?"<$0.001":`$${t.toFixed(3)}`}function P_({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 D_({block:t}){const e=M_(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(P_,{input:t.input})]})}function O_({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(Xt.Fragment,{children:[h.jsx(D_,{block:n}),s&&t._toolResult&&h.jsx(B_,{summary:t._toolResult.summary,output:t._toolResult.output})]},i)}return null})})}function R_({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:I_(t.duration_ms)}),t.total_cost_usd!=null&&h.jsx("span",{style:{color:"hsl(var(--muted-foreground))"},children:F_(t.total_cost_usd)}),e&&t.errors&&h.jsx("span",{style:{color:"hsl(var(--destructive))"},children:t.errors.join("; ")})]})}function $_({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 z_({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(j_,{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(O_,{msg:t}):t.type==="user"?h.jsx($_,{msg:t}):t.type==="result"?h.jsx(R_,{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 W_({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 cy="compose:verboseStream",Fl={verboseStream:!1};function hy(){return Fl.verboseStream}function q_(t,e){Fl.verboseStream=!!t;const r=typeof localStorage<"u"?localStorage:null;if(r)try{r.setItem(cy,String(Fl.verboseStream))}catch{}}function H_(t){const e=typeof localStorage<"u"?localStorage:null;if(e)try{const r=e.getItem(cy);r!==null&&(Fl.verboseStream=r==="true")}catch{}}function U_(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 G_(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 uy=parseInt("4002",10),V_="compose-agent-session",tm=500,Y_=8,X_=2e3,em={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"},K_={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking",waiting:"Waiting for gate approval"};H_();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 Z_(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=em[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=em[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 xh(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>Y_&&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 rm(){const t=ht.sourceStatus.build,e=ht.sourceStatus.interactive;(e==null?void 0:e.status)==="working"?xh(e.status,e.tool,e.category):(t==null?void 0:t.status)==="working"?xh(t.status,t.tool,t.category):ht._idleTimer=setTimeout(()=>{ht._idleTimer=null,xh("idle",null,null)},X_)}function Bu(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=Z_(t);if(e){const u=e._source==="build"?"build":"interactive";ht.sourceStatus[u]=e,e.status==="idle"?(ht.parallelTasks=null,rm()):(ht._idleTimer&&(clearTimeout(ht._idleTimer),ht._idleTimer=null),rm())}t.type==="system"&&t.subtype==="init"&&t.session_id&&(ht.sessionId=t.session_id,sessionStorage.setItem(V_,t.session_id));const{include:r,msg:n}=U_(t,hy());r&&(ht.messages=[...ht.messages,n],ht.messages.length>tm&&(ht.messages=ht.messages.slice(-tm)),ht.onMessagesChange&&ht.onMessagesChange(ht.messages))}function Q_(){if(ht.es)return;const t=`${window.location.protocol}//${window.location.hostname}:${uy}/api/agent/stream`,e=d_({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)Bu(i);return}Bu(r)},maxBackoffMs:8e3});ht.es=e}async function yh(t,e){const r=await fetch(`${window.location.protocol}//${window.location.hostname}:${uy}${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 nm(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 dy(){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(T=>T.type==="system"&&(T.subtype==="init"||T.subtype==="connected"));C.useEffect(()=>(ht.onConnectedChange=e,ht.onMessagesChange=n,ht.onAgentStatusChange=s,()=>{ht.onConnectedChange=null,ht.onMessagesChange=null,ht.onAgentStatusChange=null}),[]),C.useEffect(()=>{Q_()},[]),C.useEffect(()=>{var T;(T=u.current)==null||T.scrollIntoView({behavior:"smooth"})},[r.length]),C.useEffect(()=>{if(i.status!=="working"||!i.currentActivity){c(null);return}const T=i.currentActivity.startTime,_=()=>c(Date.now()-T);_();const w=setInterval(_,1e3);return()=>clearInterval(w)},[i.status,(k=i.currentActivity)==null?void 0:k.startTime]);const p=C.useCallback(async T=>{a(!0);const _=T.match(/[A-Z]+-\d+/);_&&window.dispatchEvent(new CustomEvent("compose:select-feature",{detail:{featureCode:_[0]}}));try{d||!ht.sessionId?await yh("/api/agent/session",{prompt:T}):await yh("/api/agent/message",{prompt:T})}catch(w){Bu({type:"error",message:`Failed to send: ${w.message}`})}finally{a(!1)}},[d]),f=C.useCallback(async()=>{try{await yh("/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?K_[i.category]:null,y=t?m?g||"working":"ready":"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((T,_)=>h.jsx("div",{className:"h-1 rounded-full",title:`${T.tool||"thinking"} — ${nm(T.duration)}`,style:{width:Math.max(6,Math.min(20,(T.duration||0)/1e3*2)),background:"hsl(var(--muted-foreground))",opacity:.25+_/5*.5}},_))}),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:nm(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…"})]}),G_(r).map((T,_)=>h.jsx(z_,{msg:T},T.uuid||_)),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(W_,{onSend:p,disabled:m||!t,placeholder:m?"Working…":"Message Claude…"})]})}function J_(t,e){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const tE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rE={};function im(t,e){return(rE.jsx?eE:tE).test(t)}const nE=/[ \t\n\f\r]/g;function iE(t){return typeof t=="object"?t.type==="text"?sm(t.value):!1:sm(t)}function sm(t){return t.replace(nE,"")===""}class da{constructor(e,r,n){this.normal=r,this.property=e,n&&(this.space=n)}}da.prototype.normal={};da.prototype.property={};da.prototype.space=void 0;function fy(t,e){const r={},n={};for(const i of t)Object.assign(r,i.property),Object.assign(n,i.normal);return new da(r,n,e)}function Au(t){return t.toLowerCase()}class xr{constructor(e,r){this.attribute=r,this.property=e}}xr.prototype.attribute="";xr.prototype.booleanish=!1;xr.prototype.boolean=!1;xr.prototype.commaOrSpaceSeparated=!1;xr.prototype.commaSeparated=!1;xr.prototype.defined=!1;xr.prototype.mustUseProperty=!1;xr.prototype.number=!1;xr.prototype.overloadedBoolean=!1;xr.prototype.property="";xr.prototype.spaceSeparated=!1;xr.prototype.space=void 0;let sE=0;const Ut=ji(),Ne=ji(),Mu=ji(),ot=ji(),he=ji(),as=ji(),kr=ji();function ji(){return 2**++sE}const Iu=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ut,booleanish:Ne,commaOrSpaceSeparated:kr,commaSeparated:as,number:ot,overloadedBoolean:Mu,spaceSeparated:he},Symbol.toStringTag,{value:"Module"})),bh=Object.keys(Iu);class sf extends xr{constructor(e,r,n,i){let s=-1;if(super(e,r),om(this,"space",i),typeof n=="number")for(;++s<bh.length;){const o=bh[s];om(this,bh[s],(n&Iu[o])===Iu[o])}}}sf.prototype.defined=!0;function om(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 sf(n,t.transform(t.attributes||{},n),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(s.mustUseProperty=!0),e[n]=s,r[Au(n)]=n,r[Au(s.attribute)]=n}return new da(e,r,t.space)}const py=zs({properties:{ariaActiveDescendant:null,ariaAtomic:Ne,ariaAutoComplete:null,ariaBusy:Ne,ariaChecked:Ne,ariaColCount:ot,ariaColIndex:ot,ariaColSpan:ot,ariaControls:he,ariaCurrent:null,ariaDescribedBy:he,ariaDetails:null,ariaDisabled:Ne,ariaDropEffect:he,ariaErrorMessage:null,ariaExpanded:Ne,ariaFlowTo:he,ariaGrabbed:Ne,ariaHasPopup:null,ariaHidden:Ne,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:he,ariaLevel:ot,ariaLive:null,ariaModal:Ne,ariaMultiLine:Ne,ariaMultiSelectable:Ne,ariaOrientation:null,ariaOwns:he,ariaPlaceholder:null,ariaPosInSet:ot,ariaPressed:Ne,ariaReadOnly:Ne,ariaRelevant:null,ariaRequired:Ne,ariaRoleDescription:he,ariaRowCount:ot,ariaRowIndex:ot,ariaRowSpan:ot,ariaSelected:Ne,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 my(t,e){return e in t?t[e]:e}function gy(t,e){return my(t,e.toLowerCase())}const oE=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:Ut,allowPaymentRequest:Ut,allowUserMedia:Ut,alt:null,as:null,async:Ut,autoCapitalize:null,autoComplete:he,autoFocus:Ut,autoPlay:Ut,blocking:he,capture:null,charSet:null,checked:Ut,cite:null,className:he,cols:ot,colSpan:null,content:null,contentEditable:Ne,controls:Ut,controlsList:he,coords:ot|as,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ut,defer:Ut,dir:null,dirName:null,disabled:Ut,download:Mu,draggable:Ne,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ut,formTarget:null,headers:he,height:ot,hidden:Mu,high:ot,href:null,hrefLang:null,htmlFor:he,httpEquiv:he,id:null,imageSizes:null,imageSrcSet:null,inert:Ut,inputMode:null,integrity:null,is:null,isMap:Ut,itemId:null,itemProp:he,itemRef:he,itemScope:Ut,itemType:he,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ut,low:ot,manifest:null,max:null,maxLength:ot,media:null,method:null,min:null,minLength:ot,multiple:Ut,muted:Ut,name:null,nonce:null,noModule:Ut,noValidate:Ut,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:Ut,optimum:ot,pattern:null,ping:he,placeholder:null,playsInline:Ut,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ut,referrerPolicy:null,rel:he,required:Ut,reversed:Ut,rows:ot,rowSpan:ot,sandbox:he,scope:null,scoped:Ut,seamless:Ut,selected:Ut,shadowRootClonable:Ut,shadowRootDelegatesFocus:Ut,shadowRootMode:null,shape:null,size:ot,sizes:null,slot:null,span:ot,spellCheck:Ne,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:Ut,useMap:null,value:Ne,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:Ut,declare:Ut,event:null,face:null,frame:null,frameBorder:null,hSpace:ot,leftMargin:ot,link:null,longDesc:null,lowSrc:null,marginHeight:ot,marginWidth:ot,noResize:Ut,noHref:Ut,noShade:Ut,noWrap:Ut,object:null,profile:null,prompt:null,rev:null,rightMargin:ot,rules:null,scheme:null,scrolling:Ne,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:Ut,disableRemotePlayback:Ut,prefix:null,property:null,results:ot,security:null,unselectable:null},space:"html",transform:gy}),aE=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:kr,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:Ut,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:kr,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:kr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kr,rev:kr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kr,requiredFeatures:kr,requiredFonts:kr,requiredFormats:kr,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:kr,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:kr,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:kr,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:my}),xy=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()}}),yy=zs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gy}),by=zs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),lE={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"},cE=/[A-Z]/g,am=/-[a-z]/g,hE=/^data[-\w.:]+$/i;function uE(t,e){const r=Au(e);let n=e,i=xr;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&hE.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(am,fE);n="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!am.test(s)){let o=s.replace(cE,dE);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=sf}return new i(n,e)}function dE(t){return"-"+t.toLowerCase()}function fE(t){return t.charAt(1).toUpperCase()}const pE=fy([py,oE,xy,yy,by],"html"),of=fy([py,aE,xy,yy,by],"svg");function mE(t){return t.join(" ").trim()}var Di={},Ch,lm;function gE(){if(lm)return Ch;lm=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 T(O){var I=O.match(e);I&&(b+=I.length);var A=O.lastIndexOf(l);k=~A?O.length-A:k+O.length}function _(){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 E(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 B(O){var I=O.exec(g);if(I){var A=I[0];return T(A),g=g.slice(A.length),I}}function F(){B(r)}function N(O){var I;for(O=O||[];I=M();)I!==!1&&O.push(I);return O}function M(){var O=_();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 E("End of comment missing");var A=g.slice(2,I-2);return k+=2,T(A),g=g.slice(I),k+=2,O({type:p,comment:A})}}function $(){var O=_(),I=B(n);if(I){if(M(),!B(i))return E("property missing ':'");var A=B(s),D=O({type:f,property:x(I[0].replace(t,d)),value:A?x(A[0].replace(t,d)):d});return B(o),D}}function U(){var O=[];N(O);for(var I;I=$();)I!==!1&&(O.push(I),N(O));return O}return F(),U()}function x(g){return g?g.replace(a,d):d}return Ch=m,Ch}var cm;function xE(){if(cm)return Di;cm=1;var t=Di&&Di.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Di,"__esModule",{value:!0}),Di.default=r;const e=t(gE());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 Di}var oo={},hm;function yE(){if(hm)return oo;hm=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.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 oo.camelCase=l,oo}var ao,um;function bE(){if(um)return ao;um=1;var t=ao&&ao.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(xE()),r=yE();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,ao=n,ao}var CE=bE();const kE=Lc(CE),Cy=ky("end"),af=ky("start");function ky(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 vE(t){const e=af(t),r=Cy(t);if(e&&r)return{start:e,end:r}}function Do(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?dm(t.position):"start"in t||"end"in t?dm(t):"line"in t||"column"in t?Fu(t):""}function Fu(t){return fm(t&&t.line)+":"+fm(t&&t.column)}function dm(t){return Fu(t&&t.start)+"-"+Fu(t&&t.end)}function fm(t){return t&&typeof t=="number"?t:1}class Xe 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=Do(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}}Xe.prototype.file="";Xe.prototype.name="";Xe.prototype.reason="";Xe.prototype.message="";Xe.prototype.stack="";Xe.prototype.column=void 0;Xe.prototype.line=void 0;Xe.prototype.ancestors=void 0;Xe.prototype.cause=void 0;Xe.prototype.fatal=void 0;Xe.prototype.place=void 0;Xe.prototype.ruleId=void 0;Xe.prototype.source=void 0;const lf={}.hasOwnProperty,wE=new Map,SE=/[A-Z]/g,TE=new Set(["table","tbody","thead","tfoot","tr"]),_E=new Set(["td","th"]),vy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function EE(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=FE(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=IE(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"?of:pE,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=wy(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function wy(t,e,r){if(e.type==="element")return NE(t,e,r);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return jE(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return BE(t,e,r);if(e.type==="mdxjsEsm")return LE(t,e);if(e.type==="root")return AE(t,e,r);if(e.type==="text")return ME(t,e)}function NE(t,e,r){const n=t.schema;let i=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=of,t.schema=i),t.ancestors.push(e);const s=Ty(t,e.tagName,!1),o=PE(t,e);let a=hf(t,e);return TE.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!iE(l):!0})),Sy(t,o,s,e),cf(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function jE(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)}Ko(t,e.position)}function LE(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Ko(t,e.position)}function BE(t,e,r){const n=t.schema;let i=n;e.name==="svg"&&n.space==="html"&&(i=of,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:Ty(t,e.name,!0),o=DE(t,e),a=hf(t,e);return Sy(t,o,s,e),cf(o,a),t.ancestors.pop(),t.schema=n,t.create(e,s,o,r)}function AE(t,e,r){const n={};return cf(n,hf(t,e)),t.create(e,t.Fragment,n,r)}function ME(t,e){return e.value}function Sy(t,e,r,n){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(e.node=n)}function cf(t,e){if(e.length>0){const r=e.length>1?e:e[0];r&&(t.children=r)}}function IE(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 FE(t,e){return r;function r(n,i,s,o){const a=Array.isArray(s.children),l=af(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 PE(t,e){const r={};let n,i;for(i in e.properties)if(i!=="children"&&lf.call(e.properties,i)){const s=OE(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&_E.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 DE(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 Ko(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 Ko(t,e.position);else s=n.value===null?!0:n.value;r[i]=s}return r}function hf(t,e){const r=[];let n=-1;const i=t.passKeys?new Map:wE;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=wy(t,s,o);a!==void 0&&r.push(a)}return r}function OE(t,e,r){const n=uE(t.schema,e);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?J_(r):mE(r)),n.property==="style"){let i=typeof r=="object"?r:RE(t,String(r));return t.stylePropertyNameCase==="css"&&(i=$E(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&n.space?lE[n.property]||n.property:n.attribute,r]}}function RE(t,e){try{return kE(e,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const n=r,i=new Xe("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=vy+"#cannot-parse-style-attribute",i}}function Ty(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=im(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=im(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const i=n.value;return lf.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(n);Ko(t)}function Ko(t,e){const r=new Xe("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=vy+"#cannot-handle-mdx-estrees-without-createevaluater",r}function $E(t){const e={};let r;for(r in t)lf.call(t,r)&&(e[zE(r)]=t[r]);return e}function zE(t){let e=t.replace(SE,WE);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function WE(t){return"-"+t.toLowerCase()}const kh={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"]},qE={};function uf(t,e){const r=qE,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return _y(t,n,i)}function _y(t,e,r){if(HE(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 pm(t.children,e,r)}return Array.isArray(t)?pm(t,e,r):""}function pm(t,e,r){const n=[];let i=-1;for(;++i<t.length;)n[i]=_y(t[i],e,r);return n.join("")}function HE(t){return!!(t&&typeof t=="object")}const mm=document.createElement("i");function df(t){const e="&"+t+";";mm.innerHTML=e;const r=mm.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===e?!1:r}function vr(t,e,r,n){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(e,r),t.splice(...o);else for(r&&t.splice(e,r);s<n.length;)o=n.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Nr(t,e){return t.length>0?(vr(t,t.length,0,e),t):e}const gm={}.hasOwnProperty;function Ey(t){const e={};let r=-1;for(;++r<t.length;)UE(e,t[r]);return e}function UE(t,e){let r;for(r in e){const i=(gm.call(t,r)?t[r]:void 0)||(t[r]={}),s=e[r];let o;if(s)for(o in s){gm.call(i,o)||(i[o]=[]);const a=s[o];GE(i[o],Array.isArray(a)?a:a?[a]:[])}}}function GE(t,e){let r=-1;const n=[];for(;++r<e.length;)(e[r].add==="after"?t:n).push(e[r]);vr(t,0,0,n)}function Ny(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 Wr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Je=Zn(/[A-Za-z]/),Ve=Zn(/[\dA-Za-z]/),VE=Zn(/[#-'*+\--9=?A-Z^-~]/);function Pl(t){return t!==null&&(t<32||t===127)}const Pu=Zn(/\d/),YE=Zn(/[\dA-Fa-f]/),XE=Zn(/[!-/:-@[-`{-~]/);function Bt(t){return t!==null&&t<-2}function le(t){return t!==null&&(t<0||t===32)}function Kt(t){return t===-2||t===-1||t===32}const Bc=Zn(new RegExp("\\p{P}|\\p{S}","u")),bi=Zn(/\s/);function Zn(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&&Ve(t.charCodeAt(r+1))&&Ve(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 te(t,e,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Kt(l)?(t.enter(r),a(l)):e(l)}function a(l){return Kt(l)&&s++<i?(t.consume(l),a):(t.exit(r),e(l))}}const KE={tokenize:ZE};function ZE(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"),te(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 QE={tokenize:JE},xm={tokenize:tN};function JE(t){const e=this,r=[];let n=0,i,s,o;return a;function a(k){if(n<r.length){const T=r[n];return e.containerState=T[1],t.attempt(T[0].continuation,l,c)(k)}return c(k)}function l(k){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();const T=e.events.length;let _=T,w;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){w=e.events[_][1].end;break}y(n);let E=T;for(;E<e.events.length;)e.events[E][1].end={...w},E++;return vr(e.events,_+1,0,e.events.slice(T)),e.events.length=E,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(xm,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(xm,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,T){const _=e.sliceStream(k);if(T&&_.push(null),k.previous=s,s&&(s.next=k),s=k,i.defineSkip(k.start),i.write(_),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 E=e.events.length;let B=E,F,N;for(;B--;)if(e.events[B][0]==="exit"&&e.events[B][1].type==="chunkFlow"){if(F){N=e.events[B][1].end;break}F=!0}for(y(n),w=E;w<e.events.length;)e.events[w][1].end={...N},w++;vr(e.events,B+1,0,e.events.slice(E)),e.events.length=w}}function y(k){let T=r.length;for(;T-- >k;){const _=r[T];e.containerState=_[1],_[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 tN(t,e,r){return te(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||le(t)||bi(t))return 1;if(Bc(t))return 2}function Ac(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 Du={name:"attention",resolveAll:eN,tokenize:rN};function eN(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};ym(d,-l),ym(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=Nr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])),c=Nr(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Nr(c,Ac(e.parser.constructs.insideSpan.null,t.slice(n+1,r),e)),c=Nr(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=Nr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])):u=0,vr(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 rN(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 ym(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const nN={name:"autolink",tokenize:iN};function iN(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 Je(f)?(t.consume(f),o):f===64?r(f):c(f)}function o(f){return f===43||f===45||f===46||Ve(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||Ve(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||Pl(f)?r(f):(t.consume(f),l)}function c(f){return f===64?(t.consume(f),u):VE(f)?(t.consume(f),c):r(f)}function u(f){return Ve(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||Ve(f))&&n++<63){const m=f===45?p:d;return t.consume(f),m}return r(f)}}const fa={partial:!0,tokenize:sN};function sN(t,e,r){return n;function n(s){return Kt(s)?te(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Bt(s)?e(s):r(s)}}const jy={continuation:{tokenize:aN},exit:lN,name:"blockQuote",tokenize:oN};function oN(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 Kt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function aN(t,e,r){const n=this;return i;function i(o){return Kt(o)?te(t,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(jy,e,r)(o)}}function lN(t){t.exit("blockQuote")}const Ly={name:"characterEscape",tokenize:cN};function cN(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 XE(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):r(s)}}const By={name:"characterReference",tokenize:hN};function hN(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=Ve,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=YE,u):(t.enter("characterReferenceValue"),s=7,o=Pu,u(d))}function u(d){if(d===59&&i){const p=t.exit("characterReferenceValue");return o===Ve&&!df(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 bm={partial:!0,tokenize:dN},Cm={concrete:!0,name:"codeFenced",tokenize:uN};function uN(t,e,r){const n=this,i={partial:!0,tokenize:_};let s=0,o=0,a;return l;function l(w){return c(w)}function c(w){const E=n.events[n.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[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"),Kt(w)?te(t,d,"whitespace")(w):d(w))}function d(w){return w===null||Bt(w)?(t.exit("codeFencedFence"),n.interrupt?e(w):t.check(bm,x,T)(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)):Kt(w)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),te(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,T,g)(w)}function g(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),y}function y(w){return s>0&&Kt(w)?te(t,b,"linePrefix",s+1)(w):b(w)}function b(w){return w===null||Bt(w)?t.check(bm,x,T)(w):(t.enter("codeFlowValue"),k(w))}function k(w){return w===null||Bt(w)?(t.exit("codeFlowValue"),b(w)):(t.consume(w),k)}function T(w){return t.exit("codeFenced"),e(w)}function _(w,E,B){let F=0;return N;function N(I){return w.enter("lineEnding"),w.consume(I),w.exit("lineEnding"),M}function M(I){return w.enter("codeFencedFence"),Kt(I)?te(w,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):$(I)}function $(I){return I===a?(w.enter("codeFencedFenceSequence"),U(I)):B(I)}function U(I){return I===a?(F++,w.consume(I),U):F>=o?(w.exit("codeFencedFenceSequence"),Kt(I)?te(w,O,"whitespace")(I):O(I)):B(I)}function O(I){return I===null||Bt(I)?(w.exit("codeFencedFence"),E(I)):B(I)}}}function dN(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 vh={name:"codeIndented",tokenize:pN},fN={partial:!0,tokenize:mN};function pN(t,e,r){const n=this;return i;function i(c){return t.enter("codeIndented"),te(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(fN,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 mN(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):te(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 gN={name:"codeText",previous:yN,resolve:xN,tokenize:bN};function xN(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 yN(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bN(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 CN{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&&lo(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),lo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),lo(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);lo(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);lo(this.left,r.reverse())}}}function lo(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 Ay(t){const e={};let r=-1,n,i,s,o,a,l,c;const u=new CN(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,kN(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 vr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function kN(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 vN={resolve:SN,tokenize:TN},wN={partial:!0,tokenize:_N};function SN(t){return Ay(t),t}function TN(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(wN,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 _N(t,e,r){const n=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),te(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 My(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||Pl(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||le(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||Pl(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 Iy(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=!Kt(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(t.consume(f),a++,d):d(f)}}function Fy(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"),te(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 Oo(t,e){let r;return n;function n(i){return Bt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r=!0,n):Kt(i)?te(t,n,r?"linePrefix":"lineSuffix")(i):e(i)}}const EN={name:"definition",tokenize:jN},NN={partial:!0,tokenize:LN};function jN(t,e,r){const n=this;let i;return s;function s(f){return t.enter("definition"),o(f)}function o(f){return Iy.call(n,t,a,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Wr(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 le(f)?Oo(t,c)(f):c(f)}function c(f){return My(t,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return t.attempt(NN,d,d)(f)}function d(f){return Kt(f)?te(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 LN(t,e,r){return n;function n(a){return le(a)?Oo(t,i)(a):r(a)}function i(a){return Fy(t,s,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Kt(a)?te(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Bt(a)?e(a):r(a)}}const BN={name:"hardBreakEscape",tokenize:AN};function AN(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 MN={name:"headingAtx",resolve:IN,tokenize:FN};function IN(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"},vr(t,n,r-n+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function FN(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||le(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)):Kt(u)?te(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||le(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const PN=["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"],km=["pre","script","style","textarea"],DN={concrete:!0,name:"htmlFlow",resolveTo:$N,tokenize:zN},ON={partial:!0,tokenize:qN},RN={partial:!0,tokenize:WN};function $N(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 zN(t,e,r){const n=this;let i,s,o,a,l;return c;function c(P){return u(P)}function u(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),d}function d(P){return P===33?(t.consume(P),p):P===47?(t.consume(P),s=!0,x):P===63?(t.consume(P),i=3,n.interrupt?e:S):Je(P)?(t.consume(P),o=String.fromCharCode(P),g):r(P)}function p(P){return P===45?(t.consume(P),i=2,f):P===91?(t.consume(P),i=5,a=0,m):Je(P)?(t.consume(P),i=4,n.interrupt?e:S):r(P)}function f(P){return P===45?(t.consume(P),n.interrupt?e:S):r(P)}function m(P){const st="CDATA[";return P===st.charCodeAt(a++)?(t.consume(P),a===st.length?n.interrupt?e:$:m):r(P)}function x(P){return Je(P)?(t.consume(P),o=String.fromCharCode(P),g):r(P)}function g(P){if(P===null||P===47||P===62||le(P)){const st=P===47,ct=o.toLowerCase();return!st&&!s&&km.includes(ct)?(i=1,n.interrupt?e(P):$(P)):PN.includes(o.toLowerCase())?(i=6,st?(t.consume(P),y):n.interrupt?e(P):$(P)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(P):s?b(P):k(P))}return P===45||Ve(P)?(t.consume(P),o+=String.fromCharCode(P),g):r(P)}function y(P){return P===62?(t.consume(P),n.interrupt?e:$):r(P)}function b(P){return Kt(P)?(t.consume(P),b):N(P)}function k(P){return P===47?(t.consume(P),N):P===58||P===95||Je(P)?(t.consume(P),T):Kt(P)?(t.consume(P),k):N(P)}function T(P){return P===45||P===46||P===58||P===95||Ve(P)?(t.consume(P),T):_(P)}function _(P){return P===61?(t.consume(P),w):Kt(P)?(t.consume(P),_):k(P)}function w(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(t.consume(P),l=P,E):Kt(P)?(t.consume(P),w):B(P)}function E(P){return P===l?(t.consume(P),l=null,F):P===null||Bt(P)?r(P):(t.consume(P),E)}function B(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||le(P)?_(P):(t.consume(P),B)}function F(P){return P===47||P===62||Kt(P)?k(P):r(P)}function N(P){return P===62?(t.consume(P),M):r(P)}function M(P){return P===null||Bt(P)?$(P):Kt(P)?(t.consume(P),M):r(P)}function $(P){return P===45&&i===2?(t.consume(P),A):P===60&&i===1?(t.consume(P),D):P===62&&i===4?(t.consume(P),W):P===63&&i===3?(t.consume(P),S):P===93&&i===5?(t.consume(P),j):Bt(P)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(ON,K,U)(P)):P===null||Bt(P)?(t.exit("htmlFlowData"),U(P)):(t.consume(P),$)}function U(P){return t.check(RN,O,K)(P)}function O(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),I}function I(P){return P===null||Bt(P)?U(P):(t.enter("htmlFlowData"),$(P))}function A(P){return P===45?(t.consume(P),S):$(P)}function D(P){return P===47?(t.consume(P),o="",R):$(P)}function R(P){if(P===62){const st=o.toLowerCase();return km.includes(st)?(t.consume(P),W):$(P)}return Je(P)&&o.length<8?(t.consume(P),o+=String.fromCharCode(P),R):$(P)}function j(P){return P===93?(t.consume(P),S):$(P)}function S(P){return P===62?(t.consume(P),W):P===45&&i===2?(t.consume(P),S):$(P)}function W(P){return P===null||Bt(P)?(t.exit("htmlFlowData"),K(P)):(t.consume(P),W)}function K(P){return t.exit("htmlFlow"),e(P)}}function WN(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 qN(t,e,r){return n;function n(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(fa,e,r)}}const HN={name:"htmlText",tokenize:UN};function UN(t,e,r){const n=this;let i,s,o;return a;function a(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),l}function l(S){return S===33?(t.consume(S),c):S===47?(t.consume(S),_):S===63?(t.consume(S),k):Je(S)?(t.consume(S),B):r(S)}function c(S){return S===45?(t.consume(S),u):S===91?(t.consume(S),s=0,m):Je(S)?(t.consume(S),b):r(S)}function u(S){return S===45?(t.consume(S),f):r(S)}function d(S){return S===null?r(S):S===45?(t.consume(S),p):Bt(S)?(o=d,D(S)):(t.consume(S),d)}function p(S){return S===45?(t.consume(S),f):d(S)}function f(S){return S===62?A(S):S===45?p(S):d(S)}function m(S){const W="CDATA[";return S===W.charCodeAt(s++)?(t.consume(S),s===W.length?x:m):r(S)}function x(S){return S===null?r(S):S===93?(t.consume(S),g):Bt(S)?(o=x,D(S)):(t.consume(S),x)}function g(S){return S===93?(t.consume(S),y):x(S)}function y(S){return S===62?A(S):S===93?(t.consume(S),y):x(S)}function b(S){return S===null||S===62?A(S):Bt(S)?(o=b,D(S)):(t.consume(S),b)}function k(S){return S===null?r(S):S===63?(t.consume(S),T):Bt(S)?(o=k,D(S)):(t.consume(S),k)}function T(S){return S===62?A(S):k(S)}function _(S){return Je(S)?(t.consume(S),w):r(S)}function w(S){return S===45||Ve(S)?(t.consume(S),w):E(S)}function E(S){return Bt(S)?(o=E,D(S)):Kt(S)?(t.consume(S),E):A(S)}function B(S){return S===45||Ve(S)?(t.consume(S),B):S===47||S===62||le(S)?F(S):r(S)}function F(S){return S===47?(t.consume(S),A):S===58||S===95||Je(S)?(t.consume(S),N):Bt(S)?(o=F,D(S)):Kt(S)?(t.consume(S),F):A(S)}function N(S){return S===45||S===46||S===58||S===95||Ve(S)?(t.consume(S),N):M(S)}function M(S){return S===61?(t.consume(S),$):Bt(S)?(o=M,D(S)):Kt(S)?(t.consume(S),M):F(S)}function $(S){return S===null||S===60||S===61||S===62||S===96?r(S):S===34||S===39?(t.consume(S),i=S,U):Bt(S)?(o=$,D(S)):Kt(S)?(t.consume(S),$):(t.consume(S),O)}function U(S){return S===i?(t.consume(S),i=void 0,I):S===null?r(S):Bt(S)?(o=U,D(S)):(t.consume(S),U)}function O(S){return S===null||S===34||S===39||S===60||S===61||S===96?r(S):S===47||S===62||le(S)?F(S):(t.consume(S),O)}function I(S){return S===47||S===62||le(S)?F(S):r(S)}function A(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),e):r(S)}function D(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),R}function R(S){return Kt(S)?te(t,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):j(S)}function j(S){return t.enter("htmlTextData"),o(S)}}const ff={name:"labelEnd",resolveAll:XN,resolveTo:KN,tokenize:ZN},GN={tokenize:QN},VN={tokenize:JN},YN={tokenize:tj};function XN(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&&vr(t,0,t.length,r),t}function KN(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=Nr(a,t.slice(s+1,s+n+3)),a=Nr(a,[["enter",u,e]]),a=Nr(a,Ac(e.parser.constructs.insideSpan.null,t.slice(s+n+4,o-3),e)),a=Nr(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=Nr(a,t.slice(o+1)),a=Nr(a,[["exit",l,e]]),vr(t,s,t.length,a),t}function ZN(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(Wr(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(GN,u,o?u:d)(p):p===91?t.attempt(VN,u,o?c:d)(p):o?u(p):d(p)}function c(p){return t.attempt(YN,u,d)(p)}function u(p){return e(p)}function d(p){return s._balanced=!0,r(p)}}function QN(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 le(d)?Oo(t,s)(d):s(d)}function s(d){return d===41?u(d):My(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return le(d)?Oo(t,l)(d):u(d)}function a(d){return r(d)}function l(d){return d===34||d===39||d===40?Fy(t,c,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return le(d)?Oo(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 JN(t,e,r){const n=this;return i;function i(a){return Iy.call(n,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return n.parser.defined.includes(Wr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):r(a)}function o(a){return r(a)}}function tj(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 ej={name:"labelStartImage",resolveAll:ff.resolveAll,tokenize:rj};function rj(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 nj={name:"labelStartLink",resolveAll:ff.resolveAll,tokenize:ij};function ij(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 wh={name:"lineEnding",tokenize:sj};function sj(t,e){return r;function r(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),te(t,e,"linePrefix")}}const gl={name:"thematicBreak",tokenize:oj};function oj(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"),Kt(c)?te(t,a,"whitespace")(c):a(c))}}const hr={continuation:{tokenize:hj},exit:dj,name:"list",tokenize:cj},aj={partial:!0,tokenize:fj},lj={partial:!0,tokenize:uj};function cj(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:Pu(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(gl,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 Pu(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(fa,n.interrupt?r:u,t.attempt(aj,p,d))}function u(f){return n.containerState.initialBlankLine=!0,s++,p(f)}function d(f){return Kt(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 hj(t,e,r){const n=this;return n.containerState._closeFlow=void 0,t.check(fa,i,s);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,te(t,e,"listItemIndent",n.containerState.size+1)(a)}function s(a){return n.containerState.furtherBlankLines||!Kt(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(lj,e,o)(a))}function o(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,te(t,t.attempt(hr,e,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function uj(t,e,r){const n=this;return te(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 dj(t){t.exit(this.containerState.type)}function fj(t,e,r){const n=this;return te(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!Kt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):r(s)}}const vm={name:"setextUnderline",resolveTo:pj,tokenize:mj};function pj(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 mj(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"),Kt(c)?te(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Bt(c)?(t.exit("setextHeadingLine"),e(c)):r(c)}}const gj={tokenize:xj};function xj(t){const e=this,r=t.attempt(fa,n,t.attempt(this.parser.constructs.flowInitial,i,te(t,t.attempt(this.parser.constructs.flow,i,t.attempt(vN,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 yj={resolveAll:Dy()},bj=Py("string"),Cj=Py("text");function Py(t){return{resolveAll:Dy(t==="text"?kj: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 Dy(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 kj(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 vj={42:hr,43:hr,45:hr,48:hr,49:hr,50:hr,51:hr,52:hr,53:hr,54:hr,55:hr,56:hr,57:hr,62:jy},wj={91:EN},Sj={[-2]:vh,[-1]:vh,32:vh},Tj={35:MN,42:gl,45:[vm,gl],60:DN,61:vm,95:gl,96:Cm,126:Cm},_j={38:By,92:Ly},Ej={[-5]:wh,[-4]:wh,[-3]:wh,33:ej,38:By,42:Du,60:[nN,HN],91:nj,92:[BN,Ly],93:ff,95:Du,96:gN},Nj={null:[Du,yj]},jj={null:[42,95]},Lj={null:[]},Bj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jj,contentInitial:wj,disable:Lj,document:vj,flow:Tj,flowInitial:Sj,insideSpan:Nj,string:_j,text:Ej},Symbol.toStringTag,{value:"Module"}));function Aj(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:E(_),check:E(w),consume:b,enter:k,exit:T,interrupt:E(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(M){return o=Nr(o,M),g(),o[o.length-1]!==null?[]:(B(e,0),c.events=Ac(s,c.events,c),c.events)}function p(M,$){return Ij(f(M),$)}function f(M){return Mj(o,M)}function m(){const{_bufferIndex:M,_index:$,line:U,column:O,offset:I}=n;return{_bufferIndex:M,_index:$,line:U,column:O,offset:I}}function x(M){i[M.line]=M.column,N()}function g(){let M;for(;n._index<o.length;){const $=o[n._index];if(typeof $=="string")for(M=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===M&&n._bufferIndex<$.length;)y($.charCodeAt(n._bufferIndex));else y($)}}function y(M){u=u(M)}function b(M){Bt(M)?(n.line++,n.column=1,n.offset+=M===-3?2:1,N()):M!==-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=M}function k(M,$){const U=$||{};return U.type=M,U.start=m(),c.events.push(["enter",U,c]),a.push(U),U}function T(M){const $=a.pop();return $.end=m(),c.events.push(["exit",$,c]),$}function _(M,$){B(M,$.from)}function w(M,$){$.restore()}function E(M,$){return U;function U(O,I,A){let D,R,j,S;return Array.isArray(O)?K(O):"tokenize"in O?K([O]):W(O);function W(Q){return kt;function kt(wt){const lt=wt!==null&&Q[wt],Z=wt!==null&&Q.null,at=[...Array.isArray(lt)?lt:lt?[lt]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return K(at)(wt)}}function K(Q){return D=Q,R=0,Q.length===0?A:P(Q[R])}function P(Q){return kt;function kt(wt){return S=F(),j=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?ct():Q.tokenize.call($?Object.assign(Object.create(c),$):c,l,st,ct)(wt)}}function st(Q){return M(j,S),I}function ct(Q){return S.restore(),++R<D.length?P(D[R]):A}}}function B(M,$){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&vr(c.events,$,c.events.length-$,M.resolve(c.events.slice($),c)),M.resolveTo&&(c.events=M.resolveTo(c.events,c))}function F(){const M=m(),$=c.previous,U=c.currentConstruct,O=c.events.length,I=Array.from(a);return{from:O,restore:A};function A(){n=M,c.previous=$,c.currentConstruct=U,c.events.length=O,a=I,N()}}function N(){n.line in i&&n.column<2&&(n.column=i[n.line],n.offset+=i[n.line]-1)}}function Mj(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 Ij(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 Fj(t){const n={constructs:Ey([Bj,...(t||{}).extensions||[]]),content:i(KE),defined:[],document:i(QE),flow:i(gj),lazy:{},string:i(bj),text:i(Cj)};return n;function i(s){return o;function o(a){return Aj(n,s,a)}}}function Pj(t){for(;!Ay(t););return t}const wm=/[\0\t\n\r]/g;function Dj(){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(wm.lastIndex=d,c=wm.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 Oj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rj(t){return t.replace(Oj,$j)}function $j(t,e,r){if(e)return e;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),s=i===120||i===88;return Ny(r.slice(s?2:1),s?16:10)}return df(r)||t}const Oy={}.hasOwnProperty;function zj(t,e,r){return e&&typeof e=="object"&&(r=e,e=void 0),Wj(r)(Pj(Fj(r).document().write(Dj()(t,e,!0))))}function Wj(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Be),autolinkProtocol:F,autolinkEmail:F,atxHeading:s(ce),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(Mt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Dt),hardBreakEscape:s(oe),hardBreakTrailing:s(oe),htmlFlow:s(Pe,o),htmlFlowData:F,htmlText:s(Pe,o),htmlTextData:F,image:s(Zt),label:o,link:s(Be),listItem:s(nt),listItemValue:p,listOrdered:s(V,d),listUnordered:s(V),paragraph:s(dt),reference:P,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(ce),strong:s(jt),thematicBreak:s(bt)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:lt,autolinkProtocol:wt,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:ct,characterReferenceMarkerNumeric:ct,characterReferenceValue:Q,characterReference:kt,codeFenced:l(g),codeFencedFence:x,codeFencedFenceInfo:f,codeFencedFenceMeta:m,codeFlowValue:N,codeIndented:l(y),codeText:l(I),codeTextData:N,data:N,definition:l(),definitionDestinationString:T,definitionLabelString:b,definitionTitleString:k,emphasis:l(),hardBreakEscape:l($),hardBreakTrailing:l($),htmlFlow:l(U),htmlFlowData:N,htmlText:l(O),htmlTextData:N,image:l(D),label:j,labelText:R,lineEnding:M,link:l(A),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:st,resourceDestinationString:S,resourceTitleString:W,resource:K,setextHeading:l(B),setextHeadingLineSequence:E,setextHeadingText:w,strong:l(),thematicBreak:l()}};Ry(e,(t||{}).mdastExtensions||[]);const r={};return n;function n(G){let it={type:"root",children:[]};const St={stack:[it],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:r},Ot=[];let $t=-1;for(;++$t<G.length;)if(G[$t][1].type==="listOrdered"||G[$t][1].type==="listUnordered")if(G[$t][0]==="enter")Ot.push($t);else{const Te=Ot.pop();$t=i(G,Te,$t)}for($t=-1;++$t<G.length;){const Te=e[G[$t][0]];Oy.call(Te,G[$t][1].type)&&Te[G[$t][1].type].call(Object.assign({sliceSerialize:G[$t][2].sliceSerialize},St),G[$t][1])}if(St.tokenStack.length>0){const Te=St.tokenStack[St.tokenStack.length-1];(Te[1]||Sm).call(St,void 0,Te[0])}for(it.position={start:Bn(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:Bn(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},$t=-1;++$t<e.transforms.length;)it=e.transforms[$t](it)||it;return it}function i(G,it,St){let Ot=it-1,$t=-1,Te=!1,or,ue,_r,Oe;for(;++Ot<=St;){const xe=G[Ot];switch(xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xe[0]==="enter"?$t++:$t--,Oe=void 0;break}case"lineEndingBlank":{xe[0]==="enter"&&(or&&!Oe&&!$t&&!_r&&(_r=Ot),Oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Oe=void 0}if(!$t&&xe[0]==="enter"&&xe[1].type==="listItemPrefix"||$t===-1&&xe[0]==="exit"&&(xe[1].type==="listUnordered"||xe[1].type==="listOrdered")){if(or){let ar=Ot;for(ue=void 0;ar--;){const ye=G[ar];if(ye[1].type==="lineEnding"||ye[1].type==="lineEndingBlank"){if(ye[0]==="exit")continue;ue&&(G[ue][1].type="lineEndingBlank",Te=!0),ye[1].type="lineEnding",ue=ar}else if(!(ye[1].type==="linePrefix"||ye[1].type==="blockQuotePrefix"||ye[1].type==="blockQuotePrefixWhitespace"||ye[1].type==="blockQuoteMarker"||ye[1].type==="listItemIndent"))break}_r&&(!ue||_r<ue)&&(or._spread=!0),or.end=Object.assign({},ue?G[ue][1].start:xe[1].end),G.splice(ue||Ot,0,["exit",or,xe[2]]),Ot++,St++}if(xe[1].type==="listItemPrefix"){const ar={type:"listItem",_spread:!1,start:Object.assign({},xe[1].start),end:void 0};or=ar,G.splice(Ot,0,["enter",ar,xe[2]]),Ot++,St++,_r=void 0,Oe=!0}}}return G[it][1]._spread=Te,St}function s(G,it){return St;function St(Ot){a.call(this,G(Ot),Ot),it&&it.call(this,Ot)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(G,it,St){this.stack[this.stack.length-1].children.push(G),this.stack.push(G),this.tokenStack.push([it,St||void 0]),G.position={start:Bn(it.start),end:void 0}}function l(G){return it;function it(St){G&&G.call(this,St),c.call(this,St)}}function c(G,it){const St=this.stack.pop(),Ot=this.tokenStack.pop();if(Ot)Ot[0].type!==G.type&&(it?it.call(this,G,Ot[0]):(Ot[1]||Sm).call(this,G,Ot[0]));else throw new Error("Cannot close `"+G.type+"` ("+Do({start:G.start,end:G.end})+"): it’s not open");St.position.end=Bn(G.end)}function u(){return uf(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(G){if(this.data.expectingFirstListItemValue){const it=this.stack[this.stack.length-2];it.start=Number.parseInt(this.sliceSerialize(G),10),this.data.expectingFirstListItemValue=void 0}}function f(){const G=this.resume(),it=this.stack[this.stack.length-1];it.lang=G}function m(){const G=this.resume(),it=this.stack[this.stack.length-1];it.meta=G}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const G=this.resume(),it=this.stack[this.stack.length-1];it.value=G.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const G=this.resume(),it=this.stack[this.stack.length-1];it.value=G.replace(/(\r?\n|\r)$/g,"")}function b(G){const it=this.resume(),St=this.stack[this.stack.length-1];St.label=it,St.identifier=Wr(this.sliceSerialize(G)).toLowerCase()}function k(){const G=this.resume(),it=this.stack[this.stack.length-1];it.title=G}function T(){const G=this.resume(),it=this.stack[this.stack.length-1];it.url=G}function _(G){const it=this.stack[this.stack.length-1];if(!it.depth){const St=this.sliceSerialize(G).length;it.depth=St}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function E(G){const it=this.stack[this.stack.length-1];it.depth=this.sliceSerialize(G).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function F(G){const St=this.stack[this.stack.length-1].children;let Ot=St[St.length-1];(!Ot||Ot.type!=="text")&&(Ot=et(),Ot.position={start:Bn(G.start),end:void 0},St.push(Ot)),this.stack.push(Ot)}function N(G){const it=this.stack.pop();it.value+=this.sliceSerialize(G),it.position.end=Bn(G.end)}function M(G){const it=this.stack[this.stack.length-1];if(this.data.atHardBreak){const St=it.children[it.children.length-1];St.position.end=Bn(G.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(it.type)&&(F.call(this,G),N.call(this,G))}function $(){this.data.atHardBreak=!0}function U(){const G=this.resume(),it=this.stack[this.stack.length-1];it.value=G}function O(){const G=this.resume(),it=this.stack[this.stack.length-1];it.value=G}function I(){const G=this.resume(),it=this.stack[this.stack.length-1];it.value=G}function A(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const it=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=it,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function D(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const it=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=it,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function R(G){const it=this.sliceSerialize(G),St=this.stack[this.stack.length-2];St.label=Rj(it),St.identifier=Wr(it).toLowerCase()}function j(){const G=this.stack[this.stack.length-1],it=this.resume(),St=this.stack[this.stack.length-1];if(this.data.inReference=!0,St.type==="link"){const Ot=G.children;St.children=Ot}else St.alt=it}function S(){const G=this.resume(),it=this.stack[this.stack.length-1];it.url=G}function W(){const G=this.resume(),it=this.stack[this.stack.length-1];it.title=G}function K(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function st(G){const it=this.resume(),St=this.stack[this.stack.length-1];St.label=it,St.identifier=Wr(this.sliceSerialize(G)).toLowerCase(),this.data.referenceType="full"}function ct(G){this.data.characterReferenceType=G.type}function Q(G){const it=this.sliceSerialize(G),St=this.data.characterReferenceType;let Ot;St?(Ot=Ny(it,St==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ot=df(it);const $t=this.stack[this.stack.length-1];$t.value+=Ot}function kt(G){const it=this.stack.pop();it.position.end=Bn(G.end)}function wt(G){N.call(this,G);const it=this.stack[this.stack.length-1];it.url=this.sliceSerialize(G)}function lt(G){N.call(this,G);const it=this.stack[this.stack.length-1];it.url="mailto:"+this.sliceSerialize(G)}function Z(){return{type:"blockquote",children:[]}}function at(){return{type:"code",lang:null,meta:null,value:""}}function vt(){return{type:"inlineCode",value:""}}function Mt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Dt(){return{type:"emphasis",children:[]}}function ce(){return{type:"heading",depth:0,children:[]}}function oe(){return{type:"break"}}function Pe(){return{type:"html",value:""}}function Zt(){return{type:"image",title:null,url:"",alt:null}}function Be(){return{type:"link",title:null,url:"",children:[]}}function V(G){return{type:"list",ordered:G.type==="listOrdered",start:null,spread:G._spread,children:[]}}function nt(G){return{type:"listItem",spread:G._spread,checked:null,children:[]}}function dt(){return{type:"paragraph",children:[]}}function jt(){return{type:"strong",children:[]}}function et(){return{type:"text",value:""}}function bt(){return{type:"thematicBreak"}}}function Bn(t){return{line:t.line,column:t.column,offset:t.offset}}function Ry(t,e){let r=-1;for(;++r<e.length;){const n=e[r];Array.isArray(n)?Ry(t,n):qj(t,n)}}function qj(t,e){let r;for(r in e)if(Oy.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 Sm(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Do({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Do({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Do({start:e.start,end:e.end})+") is still open")}function Hj(t){const e=this;e.parser=r;function r(n){return zj(n,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Uj(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 Gj(t,e){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,r),[t.applyData(e,r),{type:"text",value:`
9
- `}]}function Vj(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 Yj(t,e){const r={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Xj(t,e){const r={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Kj(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 Zj(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 Qj(t,e){if(t.options.allowDangerousHtml){const r={type:"raw",value:e.value};return t.patch(e,r),t.applyData(e,r)}}function $y(t,e){const r=e.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=n:i.push({type:"text",value:n}),i}function Jj(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return $y(t,e);const i={src:Ws(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function t5(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 e5(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 r5(t,e){const r=String(e.identifier).toUpperCase(),n=t.definitionById.get(r);if(!n)return $y(t,e);const i={href:Ws(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function n5(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 i5(t,e,r){const n=t.all(e),i=r?s5(r):zy(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 s5(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=zy(r[n])}return e}function zy(t){const e=t.spread;return e??t.children.length>1}function o5(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 a5(t,e){const r={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function l5(t,e){const r={type:"root",children:t.wrap(t.all(e))};return t.patch(e,r),t.applyData(e,r)}function c5(t,e){const r={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function h5(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=af(e.children[1]),l=Cy(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 u5(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 d5(t,e){const r={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}const Tm=9,_m=32;function f5(t){const e=String(t),r=/\r?\n|\r/g;let n=r.exec(e),i=0;const s=[];for(;n;)s.push(Em(e.slice(i,n.index),i>0,!0),n[0]),i=n.index+n[0].length,n=r.exec(e);return s.push(Em(e.slice(i),i>0,!1)),s.join("")}function Em(t,e,r){let n=0,i=t.length;if(e){let s=t.codePointAt(n);for(;s===Tm||s===_m;)n++,s=t.codePointAt(n)}if(r){let s=t.codePointAt(i-1);for(;s===Tm||s===_m;)i--,s=t.codePointAt(i-1)}return i>n?t.slice(n,i):""}function p5(t,e){const r={type:"text",value:f5(String(e.value))};return t.patch(e,r),t.applyData(e,r)}function m5(t,e){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,r),t.applyData(e,r)}const g5={blockquote:Uj,break:Gj,code:Vj,delete:Yj,emphasis:Xj,footnoteReference:Kj,heading:Zj,html:Qj,imageReference:Jj,image:t5,inlineCode:e5,linkReference:r5,link:n5,listItem:i5,list:o5,paragraph:a5,root:l5,strong:c5,table:h5,tableCell:d5,tableRow:u5,text:p5,thematicBreak:m5,toml:Pa,yaml:Pa,definition:Pa,footnoteDefinition:Pa};function Pa(){}const Wy=-1,Mc=0,Ro=1,Dl=2,pf=3,mf=4,gf=5,xf=6,qy=7,Hy=8,x5=typeof self=="object"?self:globalThis,Nm=(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 x5[t](e)},y5=(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 Mc:case Wy:return r(o,i);case Ro:{const a=r([],i);for(const l of o)a.push(n(l));return a}case Dl:{const a=r({},i);for(const[l,c]of o)a[n(l)]=n(c);return a}case pf:return r(new Date(o),i);case mf:{const{source:a,flags:l}=o;return r(new RegExp(a,l),i)}case gf:{const a=r(new Map,i);for(const[l,c]of o)a.set(n(l),n(c));return a}case xf:{const a=r(new Set,i);for(const l of o)a.add(n(l));return a}case qy:{const{name:a,message:l}=o;return r(Nm(a,l),i)}case Hy: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(Nm(s,o),i)};return n},jm=t=>y5(new Map,t)(0),Oi="",{toString:b5}={},{keys:C5}=Object,co=t=>{const e=typeof t;if(e!=="object"||!t)return[Mc,e];const r=b5.call(t).slice(8,-1);switch(r){case"Array":return[Ro,Oi];case"Object":return[Dl,Oi];case"Date":return[pf,Oi];case"RegExp":return[mf,Oi];case"Map":return[gf,Oi];case"Set":return[xf,Oi];case"DataView":return[Ro,r]}return r.includes("Array")?[Ro,r]:r.includes("Error")?[qy,r]:[Dl,r]},Da=([t,e])=>t===Mc&&(e==="function"||e==="symbol"),k5=(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]=co(o);switch(a){case Mc:{let u=o;switch(l){case"bigint":a=Hy,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([Wy],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 Dl:{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 C5(o))(t||!Da(co(o[p])))&&u.push([s(p),s(o[p])]);return d}case pf:return i([a,o.toISOString()],o);case mf:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case gf:{const u=[],d=i([a,u],o);for(const[p,f]of o)(t||!(Da(co(p))||Da(co(f))))&&u.push([s(p),s(f)]);return d}case xf:{const u=[],d=i([a,u],o);for(const p of o)(t||!Da(co(p)))&&u.push(s(p));return d}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},Lm=(t,{json:e,lossy:r}={})=>{const n=[];return k5(!(e||r),!!e,new Map,n)(t),n},Ol=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?jm(Lm(t,e)):structuredClone(t):(t,e)=>jm(Lm(t,e));function v5(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 w5(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function S5(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||v5,n=t.options.footnoteBackLabel||w5,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:{...Ol(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 Ic=(function(t){if(t==null)return N5;if(typeof t=="function")return Fc(t);if(typeof t=="object")return Array.isArray(t)?T5(t):_5(t);if(typeof t=="string")return E5(t);throw new Error("Expected function, string, or object as test")});function T5(t){const e=[];let r=-1;for(;++r<t.length;)e[r]=Ic(t[r]);return Fc(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function _5(t){const e=t;return Fc(r);function r(n){const i=n;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function E5(t){return Fc(e);function e(r){return r&&r.type===t}}function Fc(t){return e;function e(r,n,i){return!!(j5(r)&&t.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function N5(){return!0}function j5(t){return t!==null&&typeof t=="object"&&"type"in t}const Uy=[],L5=!0,Ou=!1,B5="skip";function Gy(t,e,r,n){let i;typeof e=="function"&&typeof r!="function"?(n=r,r=e):i=e;const s=Ic(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=Uy,m,x,g;if((!e||s(l,c,u[u.length-1]||void 0))&&(f=A5(r(l,u)),f[0]===Ou))return f;if("children"in l&&l.children){const y=l;if(y.children&&f[0]!==B5)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]===Ou)return m;x=typeof m[1]=="number"?m[1]:x+o}}return f}}}function A5(t){return Array.isArray(t)?t:typeof t=="number"?[L5,t]:t==null?Uy:[t]}function yf(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),Gy(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 Ru={}.hasOwnProperty,M5={};function I5(t,e){const r=e||M5,n=new Map,i=new Map,s=new Map,o={...g5,...r.handlers},a={all:c,applyData:P5,definitionById:n,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:r,patch:F5,wrap:O5};return yf(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(Ru.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=Ol(g);return y.children=a.all(u),y}return Ol(u)}return(a.options.unknownHandler||D5)(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=Bm(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=Bm(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function F5(t,e){t.position&&(e.position=vE(t))}function P5(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,Ol(s)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function D5(t,e){const r=e.data||{},n="value"in e&&!(Ru.call(r,"hProperties")||Ru.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 O5(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 Bm(t){let e=0,r=t.charCodeAt(e);for(;r===9||r===32;)e++,r=t.charCodeAt(e);return t.slice(e)}function Am(t,e){const r=I5(t,e),n=r.one(t,void 0),i=S5(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 R5(t,e){return t&&"run"in t?async function(r,n){const i=Am(r,{file:n,...e});await t.run(i,n)}:function(r,n){return Am(r,{file:n,...t||e})}}function Mm(t){if(t)throw t}var Sh,Im;function $5(){if(Im)return Sh;Im=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 Sh=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},Sh}var z5=$5();const Th=Lc(z5);function $u(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 W5(){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?q5(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 q5(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:H5,dirname:U5,extname:G5,join:V5,sep:"/"};function H5(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');pa(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 U5(t){if(pa(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 G5(t){pa(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 V5(...t){let e=-1,r;for(;++e<t.length;)pa(t[e]),t[e]&&(r=r===void 0?t[e]:r+"/"+t[e]);return r===void 0?".":Y5(r)}function Y5(t){pa(t);const e=t.codePointAt(0)===47;let r=X5(t,!e);return r.length===0&&!e&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),e?"/"+r:r}function X5(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 pa(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const K5={cwd:Z5};function Z5(){return"/"}function zu(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Q5(t){if(typeof t=="string")t=new URL(t);else if(!zu(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 J5(t)}function J5(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 _h=["history","path","basename","stem","extname","dirname"];class Vy{constructor(e){let r;e?zu(e)?r={path:e}:typeof e=="string"||tL(e)?r={value:e}:r=e:r={},this.cwd="cwd"in r?"":K5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<_h.length;){const s=_h[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)_h.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?tn.basename(this.path):void 0}set basename(e){Nh(e,"basename"),Eh(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){Fm(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(Eh(e,"extname"),Fm(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){zu(e)&&(e=Q5(e)),Nh(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){Nh(e,"stem"),Eh(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 Xe(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 Eh(t,e){if(t&&t.includes(tn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+tn.sep+"`")}function Nh(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Fm(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function tL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const eL=(function(t){const n=this.constructor.prototype,i=n[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,n),s}),rL={}.hasOwnProperty;class bf extends eL{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=W5()}copy(){const e=new bf;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];e.use(...n)}return e.data(Th(!0,{},this.namespace)),e}data(e,r){return typeof e=="string"?arguments.length===2?(Bh("data",this.frozen),this.namespace[e]=r,this):rL.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Bh("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=Oa(e),n=this.parser||this.Parser;return jh("parse",n),n(String(r),r)}process(e,r){const n=this;return this.freeze(),jh("process",this.parser||this.Parser),Lh("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(s,o){const a=Oa(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);sL(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(),jh("processSync",this.parser||this.Parser),Lh("processSync",this.compiler||this.Compiler),this.process(e,i),Dm("processSync","process",r),n;function i(s,o){r=!0,Mm(s),n=o}}run(e,r,n){Pm(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=Oa(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),Dm("runSync","run",n),i;function s(o,a){Mm(o),i=a,n=!0}}stringify(e,r){this.freeze();const n=Oa(r),i=this.compiler||this.Compiler;return Lh("stringify",i),Pm(e),i(e,n)}use(e,...r){const n=this.attachers,i=this.namespace;if(Bh("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=Th(!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];$u(x)&&$u(f)&&(f=Th(!0,x,f)),n[p]=[c,f,...m]}}}}const nL=new bf().freeze();function jh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Lh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Bh(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 Pm(t){if(!$u(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Dm(t,e,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Oa(t){return iL(t)?t:new Vy(t)}function iL(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function sL(t){return typeof t=="string"||oL(t)}function oL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const aL="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Om=[],Rm={allowDangerousHtml:!0},lL=/^(https?|ircs?|mailto|xmpp)$/i,cL=[{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 Cf(t){const e=hL(t),r=uL(t);return dL(e.runSync(e.parse(r),r),t)}function hL(t){const e=t.rehypePlugins||Om,r=t.remarkPlugins||Om,n=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Rm}:Rm;return nL().use(Hj).use(r).use(R5,n).use(e)}function uL(t){const e=t.children||"",r=new Vy;return typeof e=="string"&&(r.value=e),r}function dL(t,e){const r=e.allowedElements,n=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||fL;for(const u of cL)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+aL+u.id,void 0);return yf(t,c),EE(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 kh)if(Object.hasOwn(kh,f)&&Object.hasOwn(u.properties,f)){const m=u.properties[f],x=kh[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 fL(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||lL.test(t.slice(0,e))?t:""}function $m(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 pL(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mL(t,e,r){const i=Ic((r||{}).ignore||[]),s=gL(e);let o=-1;for(;++o<s.length;)Gy(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 T=k.index,_={index:k.index,input:k.input,stack:[...u,c]};let w=f(...k,_);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=T+1:(m!==T&&b.push({type:"text",value:c.value.slice(m,T)}),Array.isArray(w)?b.push(...w):w&&b.push(w),m=T+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 gL(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([xL(i[0]),yL(i[1])])}return e}function xL(t){return typeof t=="string"?new RegExp(pL(t),"g"):t}function yL(t){return typeof t=="function"?t:function(){return t}}const Ah="phrasing",Mh=["autolink","link","image","label"];function bL(){return{transforms:[_L],enter:{literalAutolink:kL,literalAutolinkEmail:Ih,literalAutolinkHttp:Ih,literalAutolinkWww:Ih},exit:{literalAutolink:TL,literalAutolinkEmail:SL,literalAutolinkHttp:vL,literalAutolinkWww:wL}}}function CL(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ah,notInConstruct:Mh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ah,notInConstruct:Mh},{character:":",before:"[ps]",after:"\\/",inConstruct:Ah,notInConstruct:Mh}]}}function kL(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Ih(t){this.config.enter.autolinkProtocol.call(this,t)}function vL(t){this.config.exit.autolinkProtocol.call(this,t)}function wL(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 SL(t){this.config.exit.autolinkEmail.call(this,t)}function TL(t){this.exit(t)}function _L(t){mL(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,EL],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),NL]],{ignore:["link","linkReference"]})}function EL(t,e,r,n,i){let s="";if(!Yy(i)||(/^w/i.test(e)&&(r=e+r,e="",s="http://"),!jL(r)))return!1;const o=LL(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 NL(t,e,r,n){return!Yy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}function jL(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 LL(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=$m(t,"(");let s=$m(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 Yy(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||bi(r)||Bc(r))&&(!e||r!==47)}Xy.peek=RL;function BL(){this.buffer()}function AL(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function ML(){this.buffer()}function IL(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function FL(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Wr(this.sliceSerialize(t)).toLowerCase(),r.label=e}function PL(t){this.exit(t)}function DL(t){const e=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Wr(this.sliceSerialize(t)).toLowerCase(),r.label=e}function OL(t){this.exit(t)}function RL(){return"["}function Xy(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 $L(){return{enter:{gfmFootnoteCallString:BL,gfmFootnoteCall:AL,gfmFootnoteDefinitionLabelString:ML,gfmFootnoteDefinition:IL},exit:{gfmFootnoteCallString:FL,gfmFootnoteCall:PL,gfmFootnoteDefinitionLabelString:DL,gfmFootnoteDefinition:OL}}}function zL(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:Xy},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?Ky:WL))),c(),l}}function WL(t,e,r){return e===0?t:Ky(t,e,r)}function Ky(t,e,r){return(r?"":" ")+t}const qL=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Zy.peek=YL;function HL(){return{canContainEols:["delete"],enter:{strikethrough:GL},exit:{strikethrough:VL}}}function UL(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:qL}],handlers:{delete:Zy}}}function GL(t){this.enter({type:"delete",children:[]},t)}function VL(t){this.exit(t)}function Zy(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 YL(){return"~"}function XL(t){return t.length}function KL(t,e){const r=e||{},n=(r.align||[]).concat(),i=r.stringLength||XL,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=ZL(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]=zm(n[d]);else{const x=zm(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="",T="";if(r.alignDelimiters!==!1){const _=l[d]-(g[d]||0),w=s[d];w===114?k=" ".repeat(_):w===99?_%2?(k=" ".repeat(_/2+.5),T=" ".repeat(_/2-.5)):(k=" ".repeat(_/2),T=k):T=" ".repeat(_)}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(T),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 ZL(t){return t==null?"":String(t)}function zm(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 QL(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()),JL);return i(),o}function JL(t,e,r){return">"+(r?"":" ")+t}function tB(t,e){return Wm(t,e.inConstruct,!0)&&!Wm(t,e.notInConstruct,!1)}function Wm(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 qm(t,e,r,n){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
21
- `&&tB(r.stack,r.unsafe[i]))return/[ \t]/.test(n.before)?"":" ";return`\\
22
- `}function eB(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 rB(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 nB(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 iB(t,e,r,n){const i=nB(r),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(rB(t,r)){const d=r.enter("codeIndented"),p=r.indentLines(s,sB);return d(),p}const a=r.createTracker(n),l=i.repeat(Math.max(eB(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 sB(t,e,r){return(r?"":" ")+t}function kf(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 oB(t,e,r,n){const i=kf(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 aB(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 Zo(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Rl(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}}Qy.peek=lB;function Qy(t,e,r,n){const i=aB(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=Rl(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=Zo(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Rl(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+Zo(d));const f=o.move(i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function lB(t,e,r){return r.options.emphasis||"*"}function cB(t,e){let r=!1;return yf(t,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,Ou}),!!((!t.depth||t.depth<3)&&uf(t)&&(e.options.setext||r))}function hB(t,e,r,n){const i=Math.max(Math.min(6,t.depth||1),1),s=r.createTracker(n);if(cB(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=Zo(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,r.options.closeAtx&&(c+=" "+o),l(),a(),c}Jy.peek=uB;function Jy(t){return t.value||""}function uB(){return"<"}tb.peek=dB;function tb(t,e,r,n){const i=kf(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 dB(){return"!"}eb.peek=fB;function eb(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 fB(){return"!"}rb.peek=pB;function rb(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 pB(){return"`"}function nb(t,e){const r=uf(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))}ib.peek=mB;function ib(t,e,r,n){const i=kf(r),s=i==='"'?"Quote":"Apostrophe",o=r.createTracker(n);let a,l;if(nb(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 mB(t,e,r){return nb(t,r)?"<":"["}sb.peek=gB;function sb(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 gB(){return"["}function vf(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 xB(t){const e=vf(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 yB(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 ob(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 bB(t,e,r,n){const i=r.enter("list"),s=r.bulletCurrent;let o=t.ordered?yB(r):vf(r);const a=t.ordered?o==="."?")":".":xB(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),ob(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 CB(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 kB(t,e,r,n){const i=CB(r);let s=r.bulletCurrent||vf(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 vB(t,e,r,n){const i=r.enter("paragraph"),s=r.enter("phrasing"),o=r.containerPhrasing(t,n);return s(),i(),o}const wB=Ic(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function SB(t,e,r,n){return(t.children.some(function(o){return wB(o)})?r.containerPhrasing:r.containerFlow).call(r,t,n)}function TB(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}ab.peek=_B;function ab(t,e,r,n){const i=TB(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=Rl(n.before.charCodeAt(n.before.length-1),c,i);u.inside&&(l=Zo(c)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Rl(n.after.charCodeAt(0),d,i);p.inside&&(l=l.slice(0,-1)+Zo(d));const f=o.move(i+i);return s(),r.attentionEncodeSurroundingInfo={after:p.outside,before:u.outside},a+l+f}function _B(t,e,r){return r.options.strong||"*"}function EB(t,e,r,n){return r.safe(t.value,n)}function NB(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 jB(t,e,r){const n=(ob(r)+(r.options.ruleSpaces?" ":"")).repeat(NB(r));return r.options.ruleSpaces?n.slice(0,-1):n}const lb={blockquote:QL,break:qm,code:iB,definition:oB,emphasis:Qy,hardBreak:qm,heading:hB,html:Jy,image:tb,imageReference:eb,inlineCode:rb,link:ib,linkReference:sb,list:bB,listItem:kB,paragraph:vB,root:SB,strong:ab,text:EB,thematicBreak:jB};function LB(){return{enter:{table:BB,tableData:Hm,tableHeader:Hm,tableRow:MB},exit:{codeText:IB,table:AB,tableData:Fh,tableHeader:Fh,tableRow:Fh}}}function BB(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 AB(t){this.exit(t),this.data.inTable=void 0}function MB(t){this.enter({type:"tableRow",children:[]},t)}function Fh(t){this.exit(t)}function Hm(t){this.enter({type:"tableCell",children:[]},t)}function IB(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,FB));const r=this.stack[this.stack.length-1];r.type,r.value=e,this.exit(t)}function FB(t,e){return e==="|"?e:t}function PB(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 KL(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=lb.inlineCode(f,m,x);return x.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function DB(){return{exit:{taskListCheckValueChecked:Um,taskListCheckValueUnchecked:Um,paragraph:RB}}}function OB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$B}}}function Um(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function RB(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 $B(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=lb.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 zB(){return[bL(),$L(),HL(),LB(),DB()]}function WB(t){return{extensions:[CL(),zL(t),UL(),PB(t),OB()]}}const qB={tokenize:XB,partial:!0},cb={tokenize:KB,partial:!0},hb={tokenize:ZB,partial:!0},ub={tokenize:QB,partial:!0},HB={tokenize:JB,partial:!0},db={name:"wwwAutolink",tokenize:VB,previous:pb},fb={name:"protocolAutolink",tokenize:YB,previous:mb},Sn={name:"emailAutolink",tokenize:GB,previous:gb},an={};function UB(){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,fb];an[104]=[Sn,fb];an[87]=[Sn,db];an[119]=[Sn,db];function GB(t,e,r){const n=this;let i,s;return o;function o(d){return!Wu(d)||!gb.call(n,n.previous)||wf(n.events)?r(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return Wu(d)?(t.consume(d),a):d===64?(t.consume(d),l):r(d)}function l(d){return d===46?t.check(HB,u,c)(d):d===45||d===95||Ve(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&&Je(n.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):r(d)}}function VB(t,e,r){const n=this;return i;function i(o){return o!==87&&o!==119||!pb.call(n,n.previous)||wf(n.events)?r(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(qB,t.attempt(cb,t.attempt(hb,s),r),r)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function YB(t,e,r){const n=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&mb.call(n,n.previous)&&!wf(n.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):r(d)}function a(d){if(Je(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const 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||Pl(d)||le(d)||bi(d)||Bc(d)?r(d):t.attempt(cb,t.attempt(hb,u),r)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function XB(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 KB(t,e,r){let n,i,s;return o;function o(c){return c===46||c===95?t.check(ub,l,a)(c):c===null||le(c)||bi(c)||c!==45&&Bc(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 ZB(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(ub,e,s)(o):o===null||le(o)||bi(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&n++,t.consume(o),i}}function QB(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||le(a)||bi(a)?e(a):r(a)}function i(a){return a===null||a===40||a===91||le(a)||bi(a)?e(a):n(a)}function s(a){return Je(a)?o(a):r(a)}function o(a){return a===59?(t.consume(a),n):Je(a)?(t.consume(a),o):r(a)}}function JB(t,e,r){return n;function n(s){return t.consume(s),i}function i(s){return Ve(s)?r(s):e(s)}}function pb(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||le(t)}function mb(t){return!Je(t)}function gb(t){return!(t===47||Wu(t))}function Wu(t){return t===43||t===45||t===46||t===95||Ve(t)}function wf(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 tA={tokenize:lA,partial:!0};function eA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sA,continuation:{tokenize:oA},exit:aA}},text:{91:{name:"gfmFootnoteCall",tokenize:iA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:rA,resolveTo:nA}}}}function rA(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=Wr(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 nA(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 iA(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||le(d))return r(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(Wr(n.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(d)}return le(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 sA(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||le(m))return r(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return s=Wr(n.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return le(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),te(t,f,"gfmFootnoteDefinitionWhitespace")):r(m)}function f(m){return e(m)}}function oA(t,e,r){return t.check(fa,e,t.attempt(tA,e,r))}function aA(t){t.exit("gfmFootnoteDefinition")}function lA(t,e,r){const n=this;return te(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 cA(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&&vr(p,p.length,0,Ac(f,o.slice(c+1,l),a)),vr(p,p.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),vr(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 hA{constructor(){this.map=[]}add(e,r,n){uA(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 uA(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 dA(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 fA(){return{flow:{null:{name:"table",tokenize:pA,resolveAll:mA}}}}function pA(t,e,r){const n=this;let i=0,s=0,o;return a;function a(N){let M=n.events.length-1;for(;M>-1;){const O=n.events[M][1].type;if(O==="lineEnding"||O==="linePrefix")M--;else break}const $=M>-1?n.events[M][1].type:null,U=$==="tableHead"||$==="tableRow"?w:l;return U===w&&n.parser.lazy[n.now().line]?r(N):U(N)}function l(N){return t.enter("tableHead"),t.enter("tableRow"),c(N)}function c(N){return N===124||(o=!0,s+=1),u(N)}function u(N){return N===null?r(N):Bt(N)?s>1?(s=0,n.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),f):r(N):Kt(N)?te(t,u,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(N)))}function d(N){return N===null||N===124||le(N)?(t.exit("data"),u(N)):(t.consume(N),N===92?p:d)}function p(N){return N===92||N===124?(t.consume(N),d):d(N)}function f(N){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(N):(t.enter("tableDelimiterRow"),o=!1,Kt(N)?te(t,m,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?g(N):N===124?(o=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),x):_(N)}function x(N){return Kt(N)?te(t,g,"whitespace")(N):g(N)}function g(N){return N===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),y):N===45?(s+=1,y(N)):N===null||Bt(N)?T(N):_(N)}function y(N){return N===45?(t.enter("tableDelimiterFiller"),b(N)):_(N)}function b(N){return N===45?(t.consume(N),b):N===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),k):(t.exit("tableDelimiterFiller"),k(N))}function k(N){return Kt(N)?te(t,T,"whitespace")(N):T(N)}function T(N){return N===124?m(N):N===null||Bt(N)?!o||i!==s?_(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):_(N)}function _(N){return r(N)}function w(N){return t.enter("tableRow"),E(N)}function E(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),E):N===null||Bt(N)?(t.exit("tableRow"),e(N)):Kt(N)?te(t,E,"whitespace")(N):(t.enter("data"),B(N))}function B(N){return N===null||N===124||le(N)?(t.exit("data"),E(N)):(t.consume(N),N===92?F:B)}function F(N){return N===92||N===124?(t.consume(N),B):B(N)}}function mA(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 hA;for(;++r<t.length;){const f=t[r],m=f[1];f[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(Gm(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=Ra(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=Ra(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=Ra(p,e,s,i,r,d)):o[1]!==0&&(d=Ra(p,e,o,i,r,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=r)}for(l!==0&&Gm(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=dA(e.events,r))}return t}function Ra(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 Gm(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 gA={name:"tasklistCheck",tokenize:yA};function xA(){return{text:{91:gA}}}function yA(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 le(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):Kt(l)?t.check({tokenize:bA},e,r)(l):r(l)}}function bA(t,e,r){return te(t,n,"whitespace");function n(i){return i===null?r(i):e(i)}}function CA(t){return Ey([UB(),eA(),cA(t),fA(),xA()])}const kA={};function Sf(t){const e=this,r=t||kA,n=e.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),s=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(CA(r)),s.push(zB()),o.push(WB(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 xb=(...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 vA=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 wA=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 Vm=t=>{const e=wA(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 SA={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 TA=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 _A=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,...SA,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:xb("lucide",i),...!s&&!TA(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(_A,{ref:s,iconNode:e,className:xb(`lucide-${vA(Vm(t))}`,`lucide-${t}`,n),...i}));return r.displayName=Vm(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 EA=[["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"}]],Tf=Lt("activity",EA);/**
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 NA=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],jA=Lt("arrow-down-to-line",NA);/**
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 LA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],BA=Lt("arrow-left",LA);/**
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 AA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],yb=Lt("arrow-right",AA);/**
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 MA=[["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"}]],IA=Lt("bell",MA);/**
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 FA=[["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",FA);/**
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 PA=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],DA=Lt("chart-no-axes-column",PA);/**
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 OA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ma=Lt("check",OA);/**
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 RA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ga=Lt("chevron-down",RA);/**
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 $A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bb=Lt("chevron-left",$A);/**
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 zA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],js=Lt("chevron-right",zA);/**
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 WA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cb=Lt("chevron-up",WA);/**
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 qA=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],HA=Lt("circle-check-big",qA);/**
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 UA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],kb=Lt("circle-check",UA);/**
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 GA=[["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"}]],VA=Lt("circle-x",GA);/**
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 YA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],XA=Lt("circle",YA);/**
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 KA=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vb=Lt("clock",KA);/**
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 ZA=[["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"}]],_f=Lt("cpu",ZA);/**
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 QA=[["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"}]],wb=Lt("eye",QA);/**
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 JA=[["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"}]],Li=Lt("file-text",JA);/**
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 tM=[["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"}]],eM=Lt("folder-open",tM);/**
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 rM=[["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"}]],Ef=Lt("folder",rM);/**
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 nM=[["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"}]],iM=Lt("funnel",nM);/**
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 sM=[["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"}]],Sb=Lt("git-branch",sM);/**
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 oM=[["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"}]],aM=Lt("inbox",oM);/**
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 lM=[["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"}]],cM=Lt("layers",lM);/**
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 hM=[["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"}]],uM=Lt("layout-dashboard",hM);/**
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 dM=[["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",dM);/**
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 fM=[["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"}]],pM=Lt("link-2",fM);/**
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 mM=[["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"}]],gM=Lt("list",mM);/**
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 xM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tb=Lt("loader-circle",xM);/**
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 yM=[["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"}]],Pc=Lt("message-square",yM);/**
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 bM=[["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"}]],CM=Lt("moon",bM);/**
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 kM=[["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"}]],vM=Lt("network",kM);/**
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 wM=[["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"}]],_b=Lt("pencil",wM);/**
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 SM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Eb=Lt("plus",SM);/**
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 TM=[["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"}]],$l=Lt("refresh-cw",TM);/**
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 _M=[["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"}]],EM=Lt("save",_M);/**
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 NM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qn=Lt("search",NM);/**
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 jM=[["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"}]],Nf=Lt("send",jM);/**
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 LM=[["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",LM);/**
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 BM=[["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"}]],AM=Lt("shield",BM);/**
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 MM=[["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"}]],Nb=Lt("skip-forward",MM);/**
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 IM=[["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"}]],Ym=Lt("sparkles",IM);/**
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 FM=[["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"}]],PM=Lt("star",FM);/**
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 DM=[["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"}]],OM=Lt("sun",DM);/**
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 RM=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],$M=Lt("terminal",RM);/**
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 zM=[["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"}]],Xm=Lt("trash-2",zM);/**
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 WM=[["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"}]],Dc=Lt("triangle-alert",WM);/**
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 qM=[["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"}]],jf=Lt("user",qM);/**
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 HM=[["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"}]],UM=Lt("workflow",HM);/**
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 GM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ln=Lt("x",GM);/**
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 VM=[["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"}]],zl=Lt("zap",VM),Oc=C.createContext({newIds:new Set,changedIds:new Set}),Km=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},YM=(t=>t?Km(t):Km),XM=t=>t;function KM(t,e=XM){const r=Xt.useSyncExternalStore(t.subscribe,Xt.useCallback(()=>e(t.getState()),[t,e]),Xt.useCallback(()=>e(t.getInitialState()),[t,e]));return Xt.useDebugValue(r),r}const Zm=t=>{const e=YM(t),r=n=>KM(e,n);return Object.assign(r,e),r},Lf=(t=>t?Zm(t):Zm),ho=new Map;function ZM(t,e,r){var D,R;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:T,setSettings:_,setPipelineDraft:w,setActiveBuild:E,setSessions:B,setIterationStates:F,setFeatureTimeline:N,EMPTY_CHANGES:M,appendDecisionEvent:$,setDecisionEventsSnapshot:U,setStatusSnapshot:O,clearStatusSnapshots:I}=r,A=N?j=>{N(S=>S.some(W=>W.id===j.id)?S:[...S,j])}:null;if(t.type==="visionState"||t.type==="hydrate"){const j=t.items||[];if(n.current){const S=n.current,W=new Set,K=new Set;for(const P of j){const st=S.get(P.id);st?(st.status!==P.status||st.confidence!==P.confidence||st.title!==P.title)&&K.add(P.id):W.add(P.id)}(W.size>0||K.size>0)&&(m({newIds:W,changedIds:K}),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>m(M),800))}n.current=new Map(j.map(S=>[S.id,S])),u(j),d(t.connections||[]),p(t.gates||[]),B&&B(t.sessions||[]),U&&Array.isArray(t.decisionEventsSnapshot)&&U(t.decisionEventsSnapshot),I&&I()}else if(t.type==="decisionEvent")$&&t.event&&$(t.event);else if(t.type==="decisionEventsSnapshot")U&&Array.isArray(t.events)&&U(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(j=>{const S=[...j,{tool:t.tool,category:t.category||null,detail:t.detail,items:t.items||[],error:t.error||null,timestamp:t.timestamp}];return S.length>20?S.slice(-20):S}),b(j=>j!=null&&j.active?{...j,toolCount:(j.toolCount||0)+1}:j);else if(t.type==="agentSpawned")k(j=>[...j,{agentId:t.agentId,parentSessionId:t.parentSessionId,agentType:t.agentType,status:"running",startedAt:t.startedAt,prompt:t.prompt}]);else if(t.type==="agentSilent")k(j=>j.map(S=>S.agentId===t.agentId?{...S,silent:!0,silentSinceMs:t.silentSinceMs}:S));else if(t.type==="agentKilled")k(j=>j.map(S=>S.agentId===t.agentId?{...S,status:"killed",terminalReason:t.reason,completedAt:new Date().toISOString()}:S));else if(t.type==="agentGC")((D=t.removed)==null?void 0:D.length)>0&&g(j=>{const S=[...j,{tool:"gc",category:"executing",detail:`Cleaned ${t.removed.length} orphan worktree(s)`,items:[],timestamp:t.timestamp}];return S.length>20?S.slice(-20):S});else if(t.type==="agentComplete")k(j=>j.map(S=>S.agentId===t.agentId?S.status==="killed"?S:{...S,status:t.status,completedAt:new Date().toISOString()}:S));else if(t.type==="agentRelay")T(j=>[...j,t].slice(-50));else if(t.type==="sessionStart")l.current&&(clearTimeout(l.current),l.current=null),k(()=>[]),T(()=>[]),b(j=>j&&j.id===t.sessionId?{...j,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}),A&&A({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(j=>j?{...j,active:!1,endedAt:t.timestamp,toolCount:t.toolCount,duration:t.duration,journalSpawned:t.journalSpawned,featureCode:t.featureCode||(j==null?void 0:j.featureCode)||null,phaseAtEnd:t.phaseAtEnd||null}:null),l.current=setTimeout(()=>{b(null),l.current=null},3e3),A&&A({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(j=>j&&{...j,summaries:[...j.summaries||[],{summary:t.summary,intent:t.intent,component:t.component,timestamp:t.timestamp}].slice(-5)});else if(t.type==="sessionBound")b(j=>j&&{...j,featureCode:t.featureCode,featureItemId:t.itemId,phaseAtBind:t.phase,boundAt:t.timestamp});else if(t.type==="agentError")y(j=>{const S=[...j,{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 S.length>10?S.slice(-10):S}),b(j=>j!=null&&j.active?{...j,errorCount:(j.errorCount||0)+1}:j),A&&A({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}),A&&A({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(W=>W.map(K=>K.id===t.gateId?{...K,status:"resolved",outcome:t.outcome,resolvedAt:t.timestamp}:K)),o.current.has(t.gateId))o.current.delete(t.gateId);else{const W=t.itemId??((R=s.current.find(K=>K.id===t.gateId))==null?void 0:R.itemId)??t.gateId;f({type:"resolved",gateId:t.gateId,outcome:t.outcome,itemId:W})}const j=t.outcome==="approve"?"approved":t.outcome==="revise"?"revised":t.outcome==="kill"?"killed":t.outcome,S={approve:"success",revise:"warning",kill:"error"};A&&A({id:`gate-resolved-${t.gateId}`,timestamp:t.timestamp||new Date().toISOString(),category:"gate",title:`Gate ${j}`,detail:null,severity:S[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(j=>{let S;t.type==="iterationStarted"?S=`${t.loopType} loop started (0/${t.maxIterations})`:t.type==="iterationComplete"?S=`${t.loopType??"loop"} loop complete (${t.outcome} after ${t.finalCount} iterations)`:S=`${t.loopType??"loop"} iteration ${t.count}/${t.maxIterations}`;const W=[...j,{tool:"iteration",category:t.loopType||"iteration",detail:S,items:[],timestamp:t.timestamp}];return W.length>20?W.slice(-20):W}),t.type==="iterationStarted")ho.has(t.loopId)&&(clearTimeout(ho.get(t.loopId)),ho.delete(t.loopId)),F(j=>{const S=new Map(j);return S.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}),S});else if(t.type==="iterationUpdate")F(j=>{const S=j.get(t.loopId);if(!S)return j;const W=new Map(j);return W.set(t.loopId,{...S,count:t.count,maxIterations:t.maxIterations}),W});else if(t.type==="iterationComplete"){F(S=>{const W=S.get(t.loopId);if(!W)return S;const K=new Map(S);return K.set(t.loopId,{...W,status:"complete",outcome:t.outcome,count:t.finalCount??W.count}),K});const j=setTimeout(()=>{F(S=>{const W=new Map(S);return W.delete(t.loopId),W}),ho.delete(t.loopId)},5e3);ho.set(t.loopId,j)}if(t.type==="iterationComplete"&&(t.outcome==="max_reached"||t.outcome==="timeout"||t.outcome==="action_limit")){const j={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(S=>{const W=[...S,{errorType:"iteration_limit",severity:"warning",message:j[t.outcome]??`${t.loopType??"Loop"} stopped: ${t.outcome}`,timestamp:t.timestamp}];return W.length>10?W.slice(-10):W}),b(S=>S!=null&&S.active?{...S,errorCount:(S.errorCount||0)+1}:S)}if(A&&(t.type==="iterationStarted"||t.type==="iterationComplete")){const j=t.type==="iterationStarted"?`${t.loopType} loop started (0/${t.maxIterations})`:`${t.loopType??"loop"} loop ${t.outcome} (${t.finalCount} iterations)`;A({id:`iteration-${t.loopId}-${t.type}`,timestamp:t.timestamp,category:"iteration",title:j,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")A&&A({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 j=t.outcome==="skipped"?" (skipped)":t.outcome==="killed"?" (killed)":"",S=t.outcome==="killed"?"error":t.outcome==="skipped"?"info":"success";A&&A({id:`lifecycle-${t.itemId}-${t.from}-${t.to}`,timestamp:t.timestamp,category:"phase",title:`Phase: ${t.from} → ${t.to}${j}`,detail:null,severity:S,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(j=>j.map(S=>{if(S.id!==t.itemId)return S;const W=S.lifecycle?{...S.lifecycle}:{};return W.lifecycle_ext={...W.lifecycle_ext||{},open_loops:t.loops},{...S,lifecycle:W}}));else if(t.type==="driftAxesUpdate")u&&t.itemId&&Array.isArray(t.drift_axes)&&u(j=>j.map(S=>{if(S.id!==t.itemId)return S;const W=S.lifecycle?{...S.lifecycle}:{};return W.lifecycle_ext={...W.lifecycle_ext||{},drift_axes:t.drift_axes},{...S,lifecycle:W}}));else if(t.type==="branchLineageUpdate"){if(u&&t.itemId){const{type:j,itemId:S,...W}=t;u(K=>K.map(P=>{if(P.id!==S)return P;const st=P.lifecycle?{...P.lifecycle}:{};return st.lifecycle_ext={...st.lifecycle_ext||{},branch_lineage:W},{...P,lifecycle:st}}))}}else if(t.type==="settingsState"||t.type==="settingsUpdated")_&&_(t.settings||null);else if(t.type==="buildState")E&&E(j=>{const S=(j==null?void 0:j.flowId)&&t.flowId&&j.flowId===t.flowId;return{...t,tierEvents:S?j.tierEvents??[]:[],capabilityEvents:S?j.capabilityEvents??[]:[],...S&&(j==null?void 0:j.health_score)!=null?{health_score:j.health_score,health_breakdown:j.health_breakdown,health_missing:j.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")E&&E(j=>j&&{...j,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"))E&&E(j=>j&&{...j,tierEvents:[...j.tierEvents||[],t].slice(-50)});else if(t.type==="system"&&t.subtype==="capability_violation")E&&E(j=>j&&{...j,capabilityEvents:[...j.capabilityEvents||[],t].slice(-200)});else if(t.type==="snapshotRequest"&&t.requestId){const{collectDOMSnapshot:j}=e,S=i.current?i.current():{},W=j?j():{},K=c.current;K&&K.send(JSON.stringify({type:"snapshotResponse",requestId:t.requestId,snapshot:{...S,dom:W,timestamp:new Date().toISOString()}}))}}function QM(){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 me={ws:null,snapshotProvider:null,prevItemMap:null,changeTimer:null,sessionEndTimer:null,gates:[],pendingResolveIds:new Set,buildPollInterval:null,recentErrorsInterval:null,connected:!1},Qm={newIds:new Set,changedIds:new Set},mr=Lf((t,e)=>{async function r(o,a){const l=await zt(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}),zt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{}),zt("/api/pipeline/draft").then(o=>o.json()).then(o=>t({pipelineDraft:o.draft??null})).catch(()=>{}),zt("/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);ZM(a,{prevItemMapRef:{get current(){return me.prevItemMap},set current(l){me.prevItemMap=l}},snapshotProviderRef:{get current(){return me.snapshotProvider},set current(l){me.snapshotProvider=l}},gatesRef:{get current(){return me.gates},set current(l){me.gates=l}},pendingResolveIdsRef:{get current(){return me.pendingResolveIds},set current(l){me.pendingResolveIds=l}},changeTimerRef:{get current(){return me.changeTimer},set current(l){me.changeTimer=l}},sessionEndTimerRef:{get current(){return me.sessionEndTimer},set current(l){me.sessionEndTimer=l}},wsRef:{get current(){var l;return((l=me.ws)==null?void 0:l.socket)||null},set current(l){}},collectDOMSnapshot:QM},{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 me.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:Qm})}catch{}}function s(){if(me.disposed||me.ws)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/vision`;me.ws=f_({url:a,onOpen:n,onMessage:i,onClose:()=>t({connected:!1})})}return zt("/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")),me.buildPollInterval=setInterval(()=>{zt("/api/build/state").then(o=>o.json()).then(o=>t({activeBuild:o.state??null})).catch(()=>{})},5e3),me.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:Qm,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=>{me.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)=>{me.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&&me.pendingResolveIds.delete(o),c}catch{return me.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 jb(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=jb(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Lb(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=jb(t))&&(n&&(n+=" "),n+=e);return n}const Jm=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,tg=Lb,Bb=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return tg(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=Jm(u)||Jm(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 tg(t,o,l,r==null?void 0:r.class,r==null?void 0:r.className)},JM=(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},tI=(t,e)=>({classGroupId:t,validator:e}),Ab=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),Wl="-",eg=[],eI="arbitrary..",rI=t=>{const e=iI(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return nI(o);const a=o.split(Wl),l=a[0]===""&&a.length>1?1:0;return Mb(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=n[o],c=r[o];return l?c?JM(c,l):l:c||eg}return r[o]||eg}}},Mb=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],s=r.nextPart.get(i);if(s){const c=Mb(t,e+1,s);if(c)return c}const o=r.validators;if(o===null)return;const a=e===0?t.join(Wl):t.slice(e).join(Wl),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},nI=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?eI+n:void 0})(),iI=t=>{const{theme:e,classGroups:r}=t;return sI(r,e)},sI=(t,e)=>{const r=Ab();for(const n in t){const i=t[n];Bf(i,r,n,e)}return r},Bf=(t,e,r,n)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];oI(o,e,r,n)}},oI=(t,e,r,n)=>{if(typeof t=="string"){aI(t,e,r);return}if(typeof t=="function"){lI(t,e,r,n);return}cI(t,e,r,n)},aI=(t,e,r)=>{const n=t===""?e:Ib(e,t);n.classGroupId=r},lI=(t,e,r,n)=>{if(hI(t)){Bf(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(tI(r,t))},cI=(t,e,r,n)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];Bf(l,Ib(e,a),r,n)}},Ib=(t,e)=>{let r=t;const n=e.split(Wl),i=n.length;for(let s=0;s<i;s++){const o=n[s];let a=r.nextPart.get(o);a||(a=Ab(),r.nextPart.set(o,a)),r=a}return r},hI=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,uI=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)}}},qu="!",rg=":",dI=[],ng=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),fI=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===rg){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(qu)?(p=d.slice(0,-1),f=!0):d.startsWith(qu)&&(p=d.slice(1),f=!0);const m=c&&c>l?c-l:void 0;return ng(s,f,p,m)};if(e){const i=e+rg,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):ng(dI,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},pI=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}},mI=t=>({cache:uI(t.cacheSize),parseClassName:fI(t),sortModifiers:pI(t),postfixLookupClassGroupIds:gI(t),...rI(t)}),gI=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},xI=/\s+/,yI=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s,postfixLookupClassGroupIds:o}=e,a=[],l=t.trim().split(xI);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 E=x.substring(0,g);b=n(E);const B=b&&o[b]?n(x):void 0;B&&B!==b&&(b=B,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(":"),T=m?k+qu:k,_=T+b;if(a.indexOf(_)>-1)continue;a.push(_);const w=i(b,y);for(let E=0;E<w.length;++E){const B=w[E];a.push(T+B)}c=d+(c.length>0?" "+c:c)}return c},bI=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=Fb(r))&&(i&&(i+=" "),i+=n);return i},Fb=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=Fb(t[n]))&&(r&&(r+=" "),r+=e);return r},CI=(t,...e)=>{let r,n,i,s;const o=l=>{const c=e.reduce((u,d)=>d(u),t());return r=mI(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=yI(l,r);return i(l,u),u};return s=o,(...l)=>s(bI(...l))},kI=[],Ae=t=>{const e=r=>r[t]||kI;return e.isThemeGetter=!0,e},Pb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Db=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,wI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SI=/\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$/,TI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_I=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,An=t=>vI.test(t),Yt=t=>!!t&&!Number.isNaN(Number(t)),Zr=t=>!!t&&Number.isInteger(Number(t)),Ph=t=>t.endsWith("%")&&Yt(t.slice(0,-1)),pn=t=>wI.test(t),Ob=()=>!0,NI=t=>SI.test(t)&&!TI.test(t),Af=()=>!1,jI=t=>_I.test(t),LI=t=>EI.test(t),BI=t=>!pt(t)&&!mt(t),AI=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)),MI=t=>Jn(t,zb,Af),pt=t=>Pb.test(t),oi=t=>Jn(t,Wb,NI),ig=t=>Jn(t,zI,Yt),II=t=>Jn(t,Hb,Ob),FI=t=>Jn(t,qb,Af),sg=t=>Jn(t,Rb,Af),PI=t=>Jn(t,$b,LI),$a=t=>Jn(t,Ub,jI),mt=t=>Db.test(t),uo=t=>Bi(t,Wb),DI=t=>Bi(t,qb),og=t=>Bi(t,Rb),OI=t=>Bi(t,zb),RI=t=>Bi(t,$b),za=t=>Bi(t,Ub,!0),$I=t=>Bi(t,Hb,!0),Jn=(t,e,r)=>{const n=Pb.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},Bi=(t,e,r=!1)=>{const n=Db.exec(t);return n?n[1]?e(n[1]):r:!1},Rb=t=>t==="position"||t==="percentage",$b=t=>t==="image"||t==="url",zb=t=>t==="length"||t==="size"||t==="bg-size",Wb=t=>t==="length",zI=t=>t==="number",qb=t=>t==="family-name",Hb=t=>t==="number"||t==="weight",Ub=t=>t==="shadow",WI=()=>{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"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...T(),mt,pt],w=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],B=()=>[mt,pt,l],F=()=>[An,"full","auto",...B()],N=()=>[Zr,"none","subgrid",mt,pt],M=()=>["auto",{span:["full",Zr,mt,pt]},Zr,mt,pt],$=()=>[Zr,"auto",mt,pt],U=()=>["auto","min","max","fr",mt,pt],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...B()],D=()=>[An,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],R=()=>[An,"screen","full","dvw","lvw","svw","min","max","fit",...B()],j=()=>[An,"screen","full","lh","dvh","lvh","svh","min","max","fit",...B()],S=()=>[t,mt,pt],W=()=>[...T(),og,sg,{position:[mt,pt]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",OI,MI,{size:[mt,pt]}],st=()=>[Ph,uo,oi],ct=()=>["","none","full",c,mt,pt],Q=()=>["",Yt,uo,oi],kt=()=>["solid","dashed","dotted","double"],wt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],lt=()=>[Yt,Ph,og,sg],Z=()=>["","none",m,mt,pt],at=()=>["none",Yt,mt,pt],vt=()=>["none",Yt,mt,pt],Mt=()=>[Yt,mt,pt],Dt=()=>[An,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pn],breakpoint:[pn],color:[Ob],container:[pn],"drop-shadow":[pn],ease:["in","out","in-out"],font:[BI],"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",Yt],text:[pn],"text-shadow":[pn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",An,pt,mt,g]}],container:["container"],"container-type":[{"@container":["","normal","size",mt,pt]}],"container-named":[AI],columns:[{columns:[Yt,pt,mt,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:_()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],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",mt,pt]}],basis:[{basis:[An,"full","auto",a,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Yt,An,"auto","initial","none",pt]}],grow:[{grow:["",Yt,mt,pt]}],shrink:[{shrink:["",Yt,mt,pt]}],order:[{order:[Zr,"first","last","none",mt,pt]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"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:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pbs:[{pbs:B()}],pbe:[{pbe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...j()]}],"min-block-size":[{"min-block":["auto",...j()]}],"max-block-size":[{"max-block":["none",...j()]}],w:[{w:[a,"screen",...D()]}],"min-w":[{"min-w":[a,"screen","none",...D()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",r,uo,oi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,$I,II]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ph,pt]}],"font-family":[{font:[DI,FI,e]}],"font-features":[{"font-features":[pt]}],"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,mt,pt]}],"line-clamp":[{"line-clamp":[Yt,"none",mt,ig]}],leading:[{leading:[s,...B()]}],"list-image":[{"list-image":["none",mt,pt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",mt,pt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...kt(),"wavy"]}],"text-decoration-thickness":[{decoration:[Yt,"from-font","auto",mt,oi]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Yt,"auto",mt,pt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"tab-size":[{tab:[Zr,mt,pt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt,pt]}],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",mt,pt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,mt,pt],radial:["",mt,pt],conic:[Zr,mt,pt]},RI,PI]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:st()}],"gradient-via-pos":[{via:st()}],"gradient-to-pos":[{to:st()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:ct()}],"rounded-s":[{"rounded-s":ct()}],"rounded-e":[{"rounded-e":ct()}],"rounded-t":[{"rounded-t":ct()}],"rounded-r":[{"rounded-r":ct()}],"rounded-b":[{"rounded-b":ct()}],"rounded-l":[{"rounded-l":ct()}],"rounded-ss":[{"rounded-ss":ct()}],"rounded-se":[{"rounded-se":ct()}],"rounded-ee":[{"rounded-ee":ct()}],"rounded-es":[{"rounded-es":ct()}],"rounded-tl":[{"rounded-tl":ct()}],"rounded-tr":[{"rounded-tr":ct()}],"rounded-br":[{"rounded-br":ct()}],"rounded-bl":[{"rounded-bl":ct()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...kt(),"hidden","none"]}],"divide-style":[{divide:[...kt(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-bs":[{"border-bs":S()}],"border-color-be":[{"border-be":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...kt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Yt,mt,pt]}],"outline-w":[{outline:["",Yt,uo,oi]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",u,za,$a]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",d,za,$a]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Yt,oi]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",p,za,$a]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Yt,mt,pt]}],"mix-blend":[{"mix-blend":[...wt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":wt()}],"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":[Yt]}],"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":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"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":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"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":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"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":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"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":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"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":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"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":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[mt,pt]}],"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":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Yt]}],"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":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",mt,pt]}],filter:[{filter:["","none",mt,pt]}],blur:[{blur:Z()}],brightness:[{brightness:[Yt,mt,pt]}],contrast:[{contrast:[Yt,mt,pt]}],"drop-shadow":[{"drop-shadow":["","none",f,za,$a]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Yt,mt,pt]}],"hue-rotate":[{"hue-rotate":[Yt,mt,pt]}],invert:[{invert:["",Yt,mt,pt]}],saturate:[{saturate:[Yt,mt,pt]}],sepia:[{sepia:["",Yt,mt,pt]}],"backdrop-filter":[{"backdrop-filter":["","none",mt,pt]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[Yt,mt,pt]}],"backdrop-contrast":[{"backdrop-contrast":[Yt,mt,pt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Yt,mt,pt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Yt,mt,pt]}],"backdrop-invert":[{"backdrop-invert":["",Yt,mt,pt]}],"backdrop-opacity":[{"backdrop-opacity":[Yt,mt,pt]}],"backdrop-saturate":[{"backdrop-saturate":[Yt,mt,pt]}],"backdrop-sepia":[{"backdrop-sepia":["",Yt,mt,pt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",mt,pt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Yt,"initial",mt,pt]}],ease:[{ease:["linear","initial",y,mt,pt]}],delay:[{delay:[Yt,mt,pt]}],animate:[{animate:["none",b,mt,pt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,mt,pt]}],"perspective-origin":[{"perspective-origin":_()}],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:Mt()}],"skew-x":[{"skew-x":Mt()}],"skew-y":[{"skew-y":Mt()}],transform:[{transform:[mt,pt,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Dt()}],"translate-x":[{"translate-x":Dt()}],"translate-y":[{"translate-y":Dt()}],"translate-z":[{"translate-z":Dt()}],"translate-none":["translate-none"],zoom:[{zoom:[Zr,mt,pt]}],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"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",mt,pt]}],"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":S()}],"scrollbar-track-color":[{"scrollbar-track":S()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mbs":[{"scroll-mbs":B()}],"scroll-mbe":[{"scroll-mbe":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pbs":[{"scroll-pbs":B()}],"scroll-pbe":[{"scroll-pbe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",mt,pt]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Yt,uo,oi,ig]}],stroke:[{stroke:["none",...S()]}],"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"]}},qI=CI(WI);function rt(...t){return qI(Lb(t))}const HI=Bb("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function rr({className:t,variant:e,...r}){return h.jsx("div",{className:rt(HI({variant:e}),t),...r})}const Rc=C.forwardRef(({className:t,type:e,...r},n)=>h.jsx("input",{type:e,className:rt("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}));Rc.displayName="Input";var Mf=p_();const UI=Lc(Mf);function ag(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function $c(...t){return e=>{let r=!1;const n=t.map(i=>{const s=ag(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():ag(t[i],null)}}}}function Tr(...t){return C.useCallback($c(...t),t)}function GI(t){const e=VI(t),r=C.forwardRef((n,i)=>{const{children:s,...o}=n,a=C.Children.toArray(s),l=a.find(XI);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 VI(t){const e=C.forwardRef((r,n)=>{const{children:i,...s}=r;if(C.isValidElement(i)){const o=ZI(i),a=KI(s,i.props);return i.type!==C.Fragment&&(a.ref=n?$c(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 YI=Symbol("radix.slottable");function XI(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===YI}function KI(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 ZI(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 QI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yr=QI.reduce((t,e)=>{const r=GI(`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 JI(t,e){t&&Mf.flushSync(()=>t.dispatchEvent(e))}var Ls=globalThis!=null&&globalThis.document?C.useLayoutEffect:()=>{};function t3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var ti=t=>{const{present:e,children:r}=t,n=e3(e),i=typeof r=="function"?r({present:n.isPresent}):C.Children.only(r),s=Tr(n.ref,r3(i));return typeof r=="function"||n.isPresent?C.cloneElement(i,{ref:s}):null};ti.displayName="Presence";function e3(t){const[e,r]=C.useState(),n=C.useRef(null),i=C.useRef(t),s=C.useRef("none"),o=t?"mounted":"unmounted",[a,l]=t3(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{const c=Wa(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=Wa(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=Wa(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=Wa(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 Wa(t){return(t==null?void 0:t.animationName)||"none"}function r3(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 n3(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 Gb(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,i3(i,...e)]}function i3(...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 jr(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 s3=C.createContext(void 0);function o3(t){const e=C.useContext(s3);return t||e||"ltr"}function a3(t,[e,r]){return Math.min(r,Math.max(e,t))}function nr(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 l3(t,e){return C.useReducer((r,n)=>e[r][n]??r,t)}var If="ScrollArea",[Vb]=Gb(If),[c3,Ar]=Vb(If),Yb=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,T]=C.useState(0),[_,w]=C.useState(!1),[E,B]=C.useState(!1),F=Tr(e,M=>l(M)),N=o3(i);return h.jsx(c3,{scope:r,type:n,dir:N,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:p,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:w,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:E,onScrollbarYEnabledChange:B,onCornerWidthChange:b,onCornerHeightChange:T,children:h.jsx(yr.div,{dir:N,...o,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...t.style}})})});Yb.displayName=If;var Xb="ScrollAreaViewport",Kb=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=t,o=Ar(Xb,r),a=C.useRef(null),l=Tr(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(yr.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})})]})});Kb.displayName=Xb;var cn="ScrollAreaScrollbar",Ff=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ar(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(h3,{...n,ref:e,forceMount:r}):i.type==="scroll"?h.jsx(u3,{...n,ref:e,forceMount:r}):i.type==="auto"?h.jsx(Zb,{...n,ref:e,forceMount:r}):i.type==="always"?h.jsx(Pf,{...n,ref:e}):null});Ff.displayName=cn;var h3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ar(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(ti,{present:r||s,children:h.jsx(Zb,{"data-state":s?"visible":"hidden",...n,ref:e})})}),u3=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Ar(cn,t.__scopeScrollArea),s=t.orientation==="horizontal",o=Wc(()=>l("SCROLL_END"),100),[a,l]=l3("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(ti,{present:r||a!=="hidden",children:h.jsx(Pf,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:nr(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:nr(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Zb=C.forwardRef((t,e)=>{const r=Ar(cn,t.__scopeScrollArea),{forceMount:n,...i}=t,[s,o]=C.useState(!1),a=t.orientation==="horizontal",l=Wc(()=>{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(ti,{present:n||s,children:h.jsx(Pf,{"data-state":s?"visible":"hidden",...i,ref:e})})}),Pf=C.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,i=Ar(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=r1(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 x3(p,o.current,a,f)}return r==="horizontal"?h.jsx(d3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,f=lg(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(f3,{...u,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,f=lg(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}),d3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ar(cn,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=Tr(e,l,s.onScrollbarXChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(Jb,{"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),i1(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:Hl(o.paddingLeft),paddingEnd:Hl(o.paddingRight)}})}})}),f3=C.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...i}=t,s=Ar(cn,t.__scopeScrollArea),[o,a]=C.useState(),l=C.useRef(null),c=Tr(e,l,s.onScrollbarYChange);return C.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(Jb,{"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),i1(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:Hl(o.paddingTop),paddingEnd:Hl(o.paddingBottom)}})}})}),[p3,Qb]=Vb(cn),Jb=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=Ar(cn,r),[m,x]=C.useState(null),g=Tr(e,F=>x(F)),y=C.useRef(null),b=C.useRef(""),k=f.viewport,T=n.content-n.viewport,_=jr(u),w=jr(l),E=Wc(d,10);function B(F){if(y.current){const N=F.clientX-y.current.left,M=F.clientY-y.current.top;c({x:N,y:M})}}return C.useEffect(()=>{const F=N=>{const M=N.target;(m==null?void 0:m.contains(M))&&_(N,T)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[k,m,T,_]),C.useEffect(w,[n,w]),Bs(m,E),Bs(f.content,E),h.jsx(p3,{scope:r,scrollbar:m,hasThumb:i,onThumbChange:jr(s),onThumbPointerUp:jr(o),onThumbPositionChange:w,onThumbPointerDown:jr(a),children:h.jsx(yr.div,{...p,ref:g,style:{position:"absolute",...p.style},onPointerDown:nr(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"),B(F))}),onPointerMove:nr(t.onPointerMove,B),onPointerUp:nr(t.onPointerUp,F=>{const N=F.target;N.hasPointerCapture(F.pointerId)&&N.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),ql="ScrollAreaThumb",t1=C.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Qb(ql,t.__scopeScrollArea);return h.jsx(ti,{present:r||i.hasThumb,children:h.jsx(m3,{ref:e,...n})})}),m3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...i}=t,s=Ar(ql,r),o=Qb(ql,r),{onThumbPositionChange:a}=o,l=Tr(e,d=>o.onThumbChange(d)),c=C.useRef(void 0),u=Wc(()=>{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=y3(d,a);c.current=f,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[s.viewport,u,a]),h.jsx(yr.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:nr(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:nr(t.onPointerUp,o.onThumbPointerUp)})});t1.displayName=ql;var Df="ScrollAreaCorner",e1=C.forwardRef((t,e)=>{const r=Ar(Df,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?h.jsx(g3,{...t,ref:e}):null});e1.displayName=Df;var g3=C.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,i=Ar(Df,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(yr.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 Hl(t){return t?parseInt(t,10):0}function r1(t,e){const r=t/e;return isNaN(r)?0:r}function zc(t){const e=r1(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function x3(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 n1([l,c],d)(t)}function lg(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=a3(t,l);return n1([0,o],[0,a])(c)}function n1(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 i1(t,e){return t>0&&t<e}var y3=(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 Wc(t,e){const r=jr(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=jr(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 s1=Yb,b3=Kb,C3=e1;const Un=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(s1,{ref:n,className:rt("relative overflow-hidden",t),...r,children:[h.jsx(b3,{className:"h-full w-full rounded-[inherit]",children:e}),h.jsx(o1,{}),h.jsx(C3,{})]}));Un.displayName=s1.displayName;const o1=C.forwardRef(({className:t,orientation:e="vertical",...r},n)=>h.jsx(Ff,{ref:n,orientation:e,className:rt("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(t1,{className:"relative flex-1 rounded-full bg-border"})}));o1.displayName=Ff.displayName;var k3=Symbol.for("react.lazy"),Ul=rf[" use ".trim().toString()];function v3(t){return typeof t=="object"&&t!==null&&"then"in t}function a1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===k3&&"_payload"in t&&v3(t._payload)}function l1(t){const e=S3(t),r=C.forwardRef((n,i)=>{let{children:s,...o}=n;a1(s)&&typeof Ul=="function"&&(s=Ul(s._payload));const 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}var w3=l1("Slot");function S3(t){const e=C.forwardRef((r,n)=>{let{children:i,...s}=r;if(a1(i)&&typeof Ul=="function"&&(i=Ul(i._payload)),C.isValidElement(i)){const o=N3(i),a=E3(s,i.props);return i.type!==C.Fragment&&(a.ref=n?$c(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 T3=Symbol("radix.slottable");function _3(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===T3}function E3(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 N3(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 j3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],L3=j3.reduce((t,e)=>{const r=l1(`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}},{}),B3="Separator",cg="horizontal",A3=["horizontal","vertical"],c1=C.forwardRef((t,e)=>{const{decorative:r,orientation:n=cg,...i}=t,s=M3(n)?n:cg,a=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return h.jsx(L3.div,{"data-orientation":s,...a,...i,ref:e})});c1.displayName=B3;function M3(t){return A3.includes(t)}var h1=c1;const Gl=C.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},i)=>h.jsx(h1,{ref:i,decorative:r,orientation:e,className:rt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));Gl.displayName=h1.displayName;function I3({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 zt(`/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 F3=Xt.memo(I3);function P3(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 D3({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:P3(n.timestamp)})]},n.id||i)})})]})}const O3=Xt.memo(D3),R3={reading:"Reading",writing:"Writing",executing:"Running",searching:"Searching",fetching:"Fetching",delegating:"Delegating",thinking:"Thinking"},hg={build_error:"Build",test_failure:"Test",lint_error:"Lint",git_conflict:"Conflict",permission_error:"Permission",not_found:"Not Found",runtime_error:"Error"};function Dh(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 $3=Xt.memo(function({startedAt:e,active:r,duration:n}){const[,i]=Xt.useState(0);Xt.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 z3({agentActivity:t,agentErrors:e,sessionState:r,onSelectItem:n,spawnedAgents:i,agentRelays:s,onStopAgent:o}){var x,g,y,b;const[a,l]=Xt.useState(null),[c,u]=Xt.useState({status:"idle",tool:null,category:null,activityLog:[],currentActivity:null}),[,d]=Xt.useState(0),[p,f]=Xt.useState([]),m=Xt.useRef(null);return Xt.useEffect(()=>{const k=T=>u(T.detail);return window.addEventListener("compose:agent-status",k),()=>window.removeEventListener("compose:agent-status",k)},[]),Xt.useEffect(()=>{if(c.status!=="working")return;const k=setInterval(()=>d(T=>T+1),1e3);return()=>clearInterval(k)},[c.status]),Xt.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]),Xt.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:rt("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:rt("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:T=>{T.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(F3,{agentId:a,status:(x=i.find(k=>k.agentId===a))==null?void 0:x.status}),h.jsx(O3,{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($3,{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"?R3[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:Dh(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,T,_)=>h.jsx("div",{className:"h-1 rounded-full",title:`${k.tool||"thinking"} — ${Dh(k.duration)}`,style:{width:Math.max(4,Math.min(16,(k.duration||0)/1e3*2)),background:Qp[k.category]||(c.status==="working"?"var(--color-category-writing)":"hsl(var(--success))"),opacity:.2+T/_.length*.6}},T))}),t&&t.length>0&&h.jsx("div",{className:"mt-1.5 space-y-0.5",children:t.slice(-4).map((k,T)=>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:Qp[k.category]},children:k.category}),k.error?h.jsx("span",{className:"truncate",title:k.error.type,children:hg[k.error.type]||k.error.type}):k.detail?h.jsx("span",{className:"truncate opacity-60",title:k.detail,children:k.detail.split("/").pop()}):null]},T))}),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,T)=>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:hg[k.errorType]||k.errorType}),h.jsx("span",{className:"truncate opacity-70",title:k.message,children:k.message})]},T))]}),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:Dh(Date.now()-new Date(k.startedAt).getTime())})]},k.agentId))]})]})})]})]})}const W3=Xt.memo(z3),$o={DECISION:1,PENDING_GATE:2,BLOCKED:3};function u1(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,$o.BLOCKED,"Blocked"),r.has(s.id)&&i(s,$o.PENDING_GATE,"Pending gate"),s.type==="decision"&&s.status!=="complete"&&s.status!=="killed"&&s.status!=="parked"&&i(s,$o.DECISION,"Open decision");return Array.from(n.values()).sort((s,o)=>o.priority-s.priority)}function q3(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 d1(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=u1(r,n).length,{total:r.length,inProgress:i,blocked:s,pendingGates:a,attentionCount:o}}function H3(t,e){return t&&t===e?null:e}const U3={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"}},G3={bg:"bg-slate-500/10",text:"text-slate-400",dot:"bg-slate-400"};function Of({status:t,className:e}){const r=U3[t]||G3,n=t?t.replace(/_/g," "):"—";return h.jsxs("span",{className:rt("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:rt("w-1 h-1 rounded-full shrink-0",r.dot)}),n]})}const V3={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"},Y3="text-slate-400 bg-slate-500/10 border-slate-500/20";function X3({phase:t,className:e}){const r=V3[t]||Y3;return h.jsx("span",{className:rt("inline-flex items-center px-2 py-0.5 rounded-full border text-xs font-mono",r,e),children:t||"—"})}async function Mn(t,e={}){const r=await zt(t,e),n=await r.json();if(!r.ok)throw new Error(n.error||`HTTP ${r.status}`);return n}let Oh=null;function f1(t){if(Oh)return;const e=window.location.protocol==="https:"?"wss:":"ws:",r=new WebSocket(`${e}//${window.location.host}/ws/vision`);Oh=r,r.onmessage=n=>{try{const i=JSON.parse(n.data);i.type==="ideaboxUpdated"&&t(i)}catch{}},r.onclose=()=>{Oh=null,setTimeout(()=>{f1(t)},3e3)},r.onerror=()=>{}}const As=Lf((t,e)=>(setTimeout(()=>e().hydrate(),0),setTimeout(()=>{f1(()=>{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 Mn("/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 Mn("/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 Mn(`/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 Mn(`/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 Mn(`/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 Mn(`/api/ideabox/ideas/${encodeURIComponent(r)}/resurrect`,{method:"POST"});return await e().hydrate(),n},addDiscussion:async(r,n,i)=>{const s=await Mn(`/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 Mn(`/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 K3({activeBuild:t}){const e=q3(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(zl,{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 Z3({items:t,gates:e,onSelectItem:r,onViewChange:n}){const i=Xt.useMemo(()=>u1(t,e),[t,e]);if(i.length===0)return null;const s=i.slice(0,5),o=i.length-s.length,a=l=>l===$o.BLOCKED?h.jsx(Dc,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--destructive))"}}):l===$o.PENDING_GATE?h.jsx(AM,{className:"h-3 w-3 shrink-0",style:{color:"hsl(var(--warning))"}}):h.jsx(IA,{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(X3,{phase:l.phase,className:"shrink-0 text-[9px] px-1.5 py-0 h-4"}),h.jsx(Of,{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 Q3({items:t,gates:e}){const r=Xt.useMemo(()=>d1(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 J3=new Set(["planned","ready","in_progress","review","blocked","parked"]);function tF({items:t,hiddenGroups:e,onToggleGroup:r}){const n=Xt.useMemo(()=>{const i={},s={};for(const o of t){const a=o.title||"";if(a.startsWith("`docs/")||a.startsWith("docs/")||!J3.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 eF({onViewChange:t}){const e=As(n=>n.ideas),r=Xt.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 p1({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:T,onSelectItem:_,onStopAgent:w,onThemeChange:E,onNewItem:B,widthPx:F}){const N=t||[],M=e||[],$=Xt.useMemo(()=>d1(N,M),[N,M]),[U,O]=Xt.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));Xt.useEffect(()=>{if(typeof document>"u")return;const A=new MutationObserver(()=>{O(document.documentElement.classList.contains("dark"))});return A.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>A.disconnect()},[]);const I=Xt.useCallback(()=>{const A=!U,D=A?"dark":"light";typeof document<"u"&&document.documentElement.classList.toggle("dark",A);try{localStorage.setItem("compose:theme",D)}catch{}E&&E({ui:{theme:D}})},[U,E]);return Xt.useCallback(A=>{s&&s(H3(i,A))},[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"}),B&&h.jsxs("button",{onClick:B,className:"flex items-center gap-1 px-1.5 py-0.5 rounded-md text-xs text-muted-foreground hover:text-foreground bg-sidebar-accent/50 hover:bg-sidebar-accent transition-colors",title:"New item (⌘N)",children:[h.jsx(Eb,{className:"h-3.5 w-3.5"}),h.jsx("span",{children:"New"})]}),h.jsx("button",{onClick:I,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-sidebar-accent transition-colors",title:U?"Switch to light mode":"Switch to dark mode",children:U?h.jsx(OM,{className:"h-3.5 w-3.5"}):h.jsx(CM,{className:"h-3.5 w-3.5"})})]})]}),h.jsx(Q3,{items:N,gates:M})]}),h.jsx(K3,{activeBuild:r}),h.jsx(W3,{agentActivity:g,agentErrors:y,sessionState:T,onSelectItem:_,onStopAgent:w,spawnedAgents:b,agentRelays:k}),$.attentionCount>0&&h.jsxs(h.Fragment,{children:[h.jsx(Gl,{className:"bg-sidebar-border"}),h.jsx(Z3,{items:N,gates:M,onSelectItem:_,onViewChange:n})]}),h.jsx(eF,{onViewChange:n}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("div",{className:"relative",children:[h.jsx(Qn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Rc,{placeholder:"Search...",value:f,onChange:A=>m(A.target.value),className:"h-7 pl-7 text-xs bg-sidebar"})]})}),h.jsx(Gl,{className:"bg-sidebar-border"}),h.jsx(Un,{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(tF,{items:N,hiddenGroups:d,onToggleGroup:p})]})})]})}function rF({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 xa({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 ug=[{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"]}],nF=[{key:"all",label:"All"},{key:"feature",label:"Feature"},{key:"task",label:"Task"},{key:"track",label:"Track"}];function dg({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 m1({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=gr[t.type]||gr.task,d=Hn[t.status]||Hn.planned,{newIds:p,changedIds:f}=C.useContext(Oc),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:rt("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:rt("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(ga,{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:rt("text-sm text-foreground truncate flex-1",t.status==="killed"&&"line-through opacity-50"),children:t.title}),h.jsx(rF,{level:t.confidence||0}),t.phase&&h.jsx(rr,{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(m1,{item:g,children:g._children||[],depth:r+1,selectedItemId:n,onSelect:i,onToggle:s,expandedIds:o},g.id))})]})}function g1({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(_=>{c(w=>{const E=new Set(w);return E.has(_)?E.delete(_):E.add(_),E})},[]),y=C.useMemo(()=>{let _=t;const w=ug.find(E=>E.key===p);if(w!=null&&w.statuses&&(_=_.filter(E=>w.statuses.includes(E.status||"planned"))),m!=="all"&&(_=_.filter(E=>E.type===m)),u){const E=u.toLowerCase();_=_.filter(B=>(B.title||"").toLowerCase().includes(E)||(B.description||"").toLowerCase().includes(E)||(B.type||"").toLowerCase().includes(E)||(B.phase||"").toLowerCase().includes(E))}return o&&s&&(_=_.filter(E=>{var B;return E.featureCode===s||((B=E.lifecycle)==null?void 0:B.featureCode)===s||(E.title||"").includes(s)})),_},[t,u,p,m,o,s]),b=C.useMemo(()=>{const _=new Set(y.map(N=>N.id)),w=new Map;for(const N of y)w.set(N.id,{...N,_children:[]});const E=new Map;for(const N of e)!_.has(N.fromId)||!_.has(N.toId)||(N.type==="informs"?E.has(N.toId)||E.set(N.toId,N.fromId):(N.type==="supports"||N.type==="blocks")&&(E.has(N.fromId)||E.set(N.fromId,N.toId)));for(const N of t)N.parentId&&w.has(N.parentId)&&E.set(N.id,N.parentId);for(const[N]of E){const M=new Set;let $=N;for(;$&&E.has($);){if(M.has($)){E.delete($);break}M.add($),$=E.get($)}}const B=[];for(const N of w.values()){const M=E.get(N.id);M&&w.has(M)?w.get(M)._children.push(N):B.push(N)}const F=N=>{N.sort((M,$)=>(M.confidence||0)-($.confidence||0));for(const M of N)M._children.length>0&&F(M._children)};return F(B),B},[y,e]);Xt.useEffect(()=>{if(u){const _=new Set,w=E=>{for(const B of E)B._children.length>0&&(_.add(B.id),w(B._children))};w(b),c(_)}else l.size===0&&b.length>0&&c(new Set(b.map(_=>_.id)))},[b,u]),Xt.useEffect(()=>{if(!r||b.length===0)return;const _=[],w=(E,B)=>{for(const F of E){if(F.id===B)return!0;if(F._children.length>0&&w(F._children,B))return _.push(F.id),!0}return!1};w(b,r),_.length>0&&c(E=>{const B=new Set(E);for(const F of _)B.add(F);return B}),requestAnimationFrame(()=>{const E=document.querySelector(`[data-item-id="${r}"]`);E&&E.scrollIntoView({block:"center",behavior:"smooth"})})},[r,b]);const k=C.useCallback(()=>{const _=new Set,w=E=>{for(const B of E)B._children.length>0&&(_.add(B.id),w(B._children))};w(b),c(_)},[b]),T=C.useCallback(()=>{c(new Set)},[]);return b.filter(_=>_._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(xa,{featureCode:s,active:o,onToggle:a}),h.jsxs("div",{className:"relative flex-1 max-w-[180px]",children:[h.jsx(Qn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Rc,{placeholder:"Search items...",value:u,onChange:_=>d(_.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:"}),ug.map(_=>h.jsx(dg,{active:p===_.key,onClick:()=>f(_.key),children:_.label},_.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:"}),nF.map(_=>h.jsx(dg,{active:m===_.key,onClick:()=>x(_.key),children:_.label},_.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:T,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent/10 transition-colors",children:"Collapse"}),i&&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(Eb,{className:"h-3.5 w-3.5"})})]}),h.jsx(Un,{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(_=>h.jsx(m1,{item:_,children:_._children,depth:0,selectedItemId:r,onSelect:n,onToggle:g,expandedIds:l},_.id))})})]})}try{ua.use(iy)}catch{}try{ua.use(g_)}catch{}const Vl={planned:"#64748b",ready:"#3b82f6",in_progress:"#fbbf24",review:"#f59e0b",complete:"#22c55e",blocked:"#ef4444",parked:"#6b7280",killed:"#475569"},iF=Object.fromEntries(Object.entries(gr).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("")}`]})),sF=[1,1.5,2,2.5,3],Hu={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"}},fg=[{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 _o(t){return t.group||"other"}const pg=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*[a-z]?$/,Rh=24;function oF(t){if(!t||t.length<=Rh)return t;const e=t.split("-");let r="";for(const n of e){const i=r?r+"-"+n:n;if(i.length>Rh-1)break;r=i}return(r||t.slice(0,Rh-1))+"…"}function aF(t){var i;const e=((i=t.lifecycle)==null?void 0:i.featureCode)||t.featureCode;if(e&&pg.test(e))return e;if(t.id&&pg.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?oF(t.slug):t.id?t.id.slice(0,12):"item"}function mg(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 lF(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=>_o(p)).filter(Boolean))].map(p=>{const f=t.filter(y=>_o(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=>_o(g)===p&&a.has(g.id));s.push({data:{id:`group-${p}`,label:`${mg(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=mg(aF(u),14),f=_o(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=Hu[u.type]||Hu.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 cF(){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(Vl).map(([t,e])=>({selector:`node[status="${t}"]`,style:{"border-color":e,...t==="parked"||t==="killed"?{opacity:.7}:{}}})),...Object.entries(iF).map(([t,e])=>({selector:`node[itemType="${t}"]`,style:{"background-color":e}})),...sF.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 hF({data:t}){if(!t)return null;const{x:e,y:r,item:n}=t,i=Vl[n.status]||Vl.planned,s=gr[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($h,{color:i,children:(n.status||"planned").replace("_"," ")}),h.jsx($h,{color:s,children:n.itemType}),n.phase&&h.jsx($h,{color:"#94a3b8",children:Il[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:[nf[n.confidence||0]," confidence"]})]})}function uF({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 $h({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 x1={fontSize:11,padding:"3px 9px",borderRadius:4,cursor:"pointer",transition:"all 0.15s"};function fo({active:t,onClick:e,children:r}){return h.jsx("button",{onClick:e,style:{...x1,border:`1px solid ${t?"#3b82f6":"#334155"}`,background:t?"#3b82f6":"#1e293b",color:t?"#fff":"#94a3b8"},children:r})}function zh({onClick:t,children:e,title:r}){return h.jsx("button",{onClick:t,title:r,style:{...x1,border:"1px solid #334155",background:"#1e293b",color:"#94a3b8"},children:e})}function qa(){return h.jsx("div",{style:{width:1,height:20,background:"#334155",margin:"0 2px"}})}const dF=["build-building","build-gate-pending","build-blocked-downstream","build-error"],fF={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 pF({badge:t,onClick:e}){const r=fF[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 mF({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 y1({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({}),T=C.useRef(null),[_,w]=C.useState(null),[E,B]=C.useState("active"),[F,N]=C.useState(!0),[M,$]=C.useState(!1),[U,O]=C.useState(null),[I,A]=C.useState(null),[D,R]=C.useState([]),[j,S]=C.useState(!1),[W,K]=C.useState(!1),P=As(V=>V.ideas);C.useEffect(()=>{let V=!1;return zt("/api/graph/layout").then(nt=>nt.ok?nt.json():{positions:{}}).then(nt=>{if(V)return;y.current=nt.positions||{},b.current=!0;const dt=g.current;dt&&Q(dt)}).catch(()=>{b.current=!0}),()=>{V=!0}},[]);const st=C.useCallback(()=>{const V=k.current;k.current={},T.current=null,Object.keys(V).length&&zt("/api/graph/layout",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({positions:V})}).catch(nt=>console.warn("[graph-layout] save failed:",nt))},[]),ct=C.useCallback(V=>{Object.assign(k.current,V),Object.assign(y.current,V),T.current&&clearTimeout(T.current),T.current=setTimeout(st,500)},[st]),Q=C.useCallback(V=>{const nt=y.current,dt={};V.nodes("node[status]").forEach(jt=>{const et=jt.data();if(et.isAgentNode||et.isIdeaNode)return;const bt=jt.id(),G=nt[bt];if(G&&Number.isFinite(G.x)&&Number.isFinite(G.y))jt.position({x:G.x,y:G.y});else{const it=jt.position();Number.isFinite(it.x)&&Number.isFinite(it.y)&&(dt[bt]={x:it.x,y:it.y})}}),Object.keys(dt).length&&ct(dt)},[ct]),kt=C.useRef(!1);C.useEffect(()=>{const V=c==null?void 0:c.some(nt=>nt.status==="running");V&&!kt.current?S(!0):!V&&kt.current&&(c==null?void 0:c.length)>0&&S(!1),kt.current=!!V},[c]);const wt=C.useMemo(()=>t.filter(V=>{const nt=V.title||"";return!nt.startsWith("`docs/")&&!nt.startsWith("docs/")}),[t]),lt=C.useMemo(()=>{let V=wt;const nt=fg.find(dt=>dt.key===E);if(nt!=null&&nt.statuses&&(V=V.filter(dt=>nt.statuses.includes(dt.status||"planned"))),i){const dt=jt=>{const et=(jt.description||"").match(/Track:\s*(\w+)/i);return et?et[1].toLowerCase():jt.type||"other"};V=V.filter(jt=>i.has(dt(jt)))}return(s==null?void 0:s.size)>0&&(V=V.filter(dt=>!s.has(_o(dt)))),V},[wt,E,i,s]),Z=C.useMemo(()=>{const V=new Set(lt.map(nt=>nt.id));return e.filter(nt=>V.has(nt.fromId)&&V.has(nt.toId))},[e,lt]),at=C.useMemo(()=>!d||!d.nodes.length?[]:[...d.nodes,...d.edges],[c]),vt=C.useMemo(()=>{if(!W)return[];new Set(lt.map(nt=>nt.id));const V=[];for(const nt of P){if(!nt.mapsTo)continue;const dt=`idea-${nt.id}`;V.push({data:{id:dt,label:`${nt.id}
341
- ${nt.title.slice(0,20)}${nt.title.length>20?"…":""}`,isIdeaNode:!0,status:"idea",ideaId:nt.id},classes:"idea-node"});const jt=nt.mapsTo.split(",").map(et=>et.trim()).filter(Boolean);for(const et of jt){const bt=lt.find(G=>{var it;return((it=G.lifecycle)==null?void 0:it.featureCode)===et||G.featureCode===et||(G.title||"").startsWith(et)});bt&&V.push({data:{id:`idea-edge-${nt.id}-${bt.id}`,source:dt,target:bt.id,edgeType:"idea",edgeColor:"#f59e0b",edgeStyle:"dashed"}})}}return V},[W,P,lt]),Mt=C.useMemo(()=>{let nt=lF(lt,Z,F,f,p);return j&&at.length>0&&(nt=[...nt,...at]),W&&vt.length>0&&(nt=[...nt,...vt]),nt},[lt,Z,F,j,at,W,vt,f,p]),Dt=C.useMemo(()=>cF(),[]);C.useEffect(()=>{if(!x.current)return;g.current&&(g.current.destroy(),g.current=null);const V=ua({container:x.current,elements:Mt,style:Dt,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&&Q(V),V.fit(void 0,30)}),V.fit(void 0,30),V.on("dragfree","node[status]",nt=>{const dt=nt.target,jt=dt.data();if(jt.isAgentNode||jt.isIdeaNode)return;const et=dt.position();!Number.isFinite(et.x)||!Number.isFinite(et.y)||ct({[dt.id()]:{x:et.x,y:et.y}})}),r){const nt=V.$id(r);nt.length&&Wh(V,nt)}return V.on("mouseover","node[status]",nt=>{const dt=nt.renderedPosition||nt.position,jt=V.container().getBoundingClientRect();w({x:jt.left+dt.x,y:jt.top+dt.y,item:nt.target.data()})}),V.on("mousemove","node[status]",nt=>{const dt=nt.renderedPosition||nt.position,jt=V.container().getBoundingClientRect();w(et=>et?{x:jt.left+dt.x,y:jt.top+dt.y,item:et.item}:null)}),V.on("mouseout","node[status]",()=>w(null)),V.on("tap","node[status]",nt=>{ce.current=!0,Wh(V,nt.target),n(nt.target.id())}),V.on("tap",nt=>{nt.target===V&&V.elements().removeClass("dimmed highlighted")}),V.on("cxttap","node[status]",nt=>{var bt;const dt=nt.target.data();if(dt.isAgentNode||dt.isIdeaNode||dt.isGroup)return;try{(bt=nt.originalEvent)==null||bt.preventDefault()}catch{}const jt=nt.renderedPosition||nt.position,et=V.container().getBoundingClientRect();A({x:et.left+jt.x,y:et.top+jt.y,itemId:nt.target.id(),currentGroup:dt.group||""}),w(null)}),V.container().addEventListener("contextmenu",nt=>nt.preventDefault()),()=>{T.current&&(clearTimeout(T.current),st()),V.destroy(),g.current=null}},[Mt,Dt]);const ce=C.useRef(!1);C.useEffect(()=>{const V=g.current;if(!V||!r)return;const nt=V.$id(r);nt.length&&(V.elements().removeClass("dimmed highlighted"),Wh(V,nt),ce.current||V.animate({center:{eles:nt},duration:200}),ce.current=!1)},[r]),C.useEffect(()=>{const V=g.current;if(V&&(V.nodes().removeClass(dF.join(" ")),!(!o||Object.keys(o).length===0)))for(const[nt,dt]of Object.entries(o)){const jt=`build-${dt.replace(/_/g,"-")}`,et=V.nodes().filter(bt=>{const G=bt.data();return G.slug===nt||G.title===nt||G.featureCode===nt});et.length&&et.addClass(jt)}},[o]),C.useEffect(()=>{const V=g.current;if(!V||!o||!Object.values(o).includes("building"))return;let dt=!0;const jt=setInterval(()=>{const et=V.nodes(".build-building");et.length&&(dt=!dt,et.style("shadow-blur",dt?12:4),et.style("shadow-opacity",dt?.6:.2))},800);return()=>clearInterval(jt)},[o]),C.useEffect(()=>{var et;const V=g.current;if(!V||(V.edges("[?isRelayEdge]").removeClass("relay-active relay-result"),!j||!((et=d==null?void 0:d.activeEdgeIds)!=null&&et.size)))return;const nt=new Set((c||[]).map(bt=>bt.agentId)),dt=bt=>bt==="session"?"agent-session":nt.has(bt)?`agent-${bt}`:"agent-session";for(const bt of d.activeEdgeIds){const G=V.getElementById(bt);if(G.length){const it=u==null?void 0:u.findLast(St=>{const Ot=dt(St.fromAgentId),$t=dt(St.toAgentId);return(St.direction==="dispatch"?`relay-${Ot}-${$t}`:`relay-${$t}-${Ot}`)===bt});G.addClass((it==null?void 0:it.direction)==="result"?"relay-result":"relay-active")}}const jt=setInterval(()=>{const bt=V.edges(".relay-active, .relay-result");if(!bt.length)return;const G=Date.now()/20%100;bt.style("line-dash-offset",-G)},50);return()=>clearInterval(jt)},[j,d==null?void 0:d.activeEdgeIds,u]);const oe=C.useCallback(()=>{const V=g.current;if(!V||!o||Object.keys(o).length===0){R([]);return}const nt=[];for(const[dt,jt]of Object.entries(o)){if(jt!=="gate_pending"&&jt!=="error"&&jt!=="building")continue;const et=V.nodes().filter(it=>{const St=it.data();return St.slug===dt||St.title===dt||St.featureCode===dt});if(!et.length)continue;const bt=et.renderedPosition(),G=et.renderedOuterWidth();nt.push({featureCode:dt,state:jt,x:bt.x+G/2-6,y:bt.y-et.renderedOuterHeight()/2-6,nodeId:et.id()})}R(nt)},[o]);C.useEffect(()=>{const V=g.current;if(V)return V.on("render pan zoom",oe),oe(),()=>{V.removeListener("render pan zoom",oe)}},[oe]);const Pe=C.useCallback(()=>{var V;return(V=g.current)==null?void 0:V.fit(void 0,40)},[]),Zt=C.useCallback(()=>{const V=g.current;V&&V.zoom({level:V.zoom()*1.3,renderedPosition:{x:V.width()/2,y:V.height()/2}})},[]),Be=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(xa,{featureCode:p,active:f,onToggle:m}),p&&h.jsx(qa,{}),h.jsx("span",{style:{fontSize:11,color:"#64748b"},children:"Status:"}),fg.map(V=>h.jsx(fo,{active:E===V.key,onClick:()=>B(V.key),children:V.label},V.key)),h.jsx(qa,{}),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(fo,{active:F,onClick:()=>N(!F),children:"Group"}),h.jsx(fo,{active:j,onClick:()=>S(V=>!V),title:"Show/hide agent topology",children:"Agents"}),h.jsx(fo,{active:W,onClick:()=>K(V=>!V),title:"Show/hide idea nodes (connected to features via mapsTo)",children:"Ideas"}),h.jsx(qa,{}),h.jsx(zh,{onClick:Be,title:"Zoom out",children:"−"}),h.jsx(zh,{onClick:Pe,title:"Fit to view",children:"Fit"}),h.jsx(zh,{onClick:Zt,title:"Zoom in",children:"+"}),h.jsx(qa,{}),h.jsx(fo,{active:M,onClick:()=>$(!M),children:"Legend"})]})]})}),lt.length===0&&!j?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"}),M&&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(qh,{title:"Types",children:Object.entries(gr).map(([V,nt])=>h.jsxs(Uh,{children:[h.jsx(gg,{color:nt}),V]},V))}),h.jsx(Hh,{}),h.jsx(qh,{title:"Status",children:Object.entries(Vl).map(([V,nt])=>h.jsxs(Uh,{children:[h.jsx(gg,{color:nt}),V.replace("_"," ")]},V))}),h.jsx(Hh,{}),h.jsx(qh,{title:"Edges",children:Object.entries(Hu).map(([V,nt])=>h.jsxs(Uh,{children:[h.jsx("svg",{width:"22",height:"6",style:{flexShrink:0},children:h.jsx("line",{x1:"0",y1:"3",x2:"22",y2:"3",stroke:nt.color,strokeWidth:"1.5",strokeDasharray:nt.style==="dashed"?"6,3":"none"})}),V]},V))}),h.jsx(Hh,{}),h.jsxs("div",{style:{fontSize:10,color:"#475569"},children:["Border weight = confidence",h.jsx("br",{}),"Click node to trace deps"]})]}),h.jsx(hF,{data:_}),I&&h.jsx(uF,{data:I,onClose:()=>A(null),onApply:V=>{const nt=I.itemId;A(null),zt(`/api/vision/items/${nt}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({group:V||null})}).catch(dt=>console.warn("[graph] group update failed:",dt))}}),D.map(V=>h.jsx(pF,{badge:V,onClick:V.state==="gate_pending"?()=>O(U===V.featureCode?null:V.featureCode):V.state==="error"?()=>n(V.nodeId):void 0},V.featureCode)),U&&h.jsx(mF,{featureCode:U,gates:l,items:t,badgePositions:D,onResolve:(V,nt)=>{a&&a(V,nt),O(null)},onClose:()=>O(null)})]})]})}function Wh(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 qh({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 Hh(){return h.jsx("div",{style:{height:1,background:"#334155",margin:"6px 0"}})}function Uh({children:t}){return h.jsx("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:3,color:"#94a3b8"},children:t})}function gg({color:t}){return h.jsx("div",{style:{width:10,height:10,borderRadius:2,background:t,flexShrink:0}})}var xl={exports:{}},gF=xl.exports,xg;function xF(){return xg||(xg=1,(function(t,e){(function(r,n){t.exports=n()})(gF,(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"],A=O%100;return"["+O+(I[(A-20)%10]||I[A]||I[0])+"]"}},k=function(O,I,A){var D=String(O);return!D||D.length>=I?O:""+Array(I+1-D.length).join(A)+O},T={s:k,z:function(O){var I=-O.utcOffset(),A=Math.abs(I),D=Math.floor(A/60),R=A%60;return(I<=0?"+":"-")+k(D,2,"0")+":"+k(R,2,"0")},m:function O(I,A){if(I.date()<A.date())return-O(A,I);var D=12*(A.year()-I.year())+(A.month()-I.month()),R=I.clone().add(D,d),j=A-R<0,S=I.clone().add(D+(j?-1:1),d);return+(-(D+(A-R)/(j?R-S:S-R))||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}},_="en",w={};w[_]=b;var E="$isDayjsObject",B=function(O){return O instanceof $||!(!O||!O[E])},F=function O(I,A,D){var R;if(!I)return _;if(typeof I=="string"){var j=I.toLowerCase();w[j]&&(R=j),A&&(w[j]=A,R=j);var S=I.split("-");if(!R&&S.length>1)return O(S[0])}else{var W=I.name;w[W]=I,R=W}return!D&&R&&(_=R),R||!D&&_},N=function(O,I){if(B(O))return O.clone();var A=typeof I=="object"?I:{};return A.date=O,A.args=arguments,new $(A)},M=T;M.l=F,M.i=B,M.w=function(O,I){return N(O,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var $=(function(){function O(A){this.$L=F(A.locale,null,!0),this.parse(A),this.$x=this.$x||A.x||{},this[E]=!0}var I=O.prototype;return I.parse=function(A){this.$d=(function(D){var R=D.date,j=D.utc;if(R===null)return new Date(NaN);if(M.u(R))return new Date;if(R instanceof Date)return new Date(R);if(typeof R=="string"&&!/Z$/i.test(R)){var S=R.match(g);if(S){var W=S[2]-1||0,K=(S[7]||"0").substring(0,3);return j?new Date(Date.UTC(S[1],W,S[3]||1,S[4]||0,S[5]||0,S[6]||0,K)):new Date(S[1],W,S[3]||1,S[4]||0,S[5]||0,S[6]||0,K)}}return new Date(R)})(A),this.init()},I.init=function(){var A=this.$d;this.$y=A.getFullYear(),this.$M=A.getMonth(),this.$D=A.getDate(),this.$W=A.getDay(),this.$H=A.getHours(),this.$m=A.getMinutes(),this.$s=A.getSeconds(),this.$ms=A.getMilliseconds()},I.$utils=function(){return M},I.isValid=function(){return this.$d.toString()!==x},I.isSame=function(A,D){var R=N(A);return this.startOf(D)<=R&&R<=this.endOf(D)},I.isAfter=function(A,D){return N(A)<this.startOf(D)},I.isBefore=function(A,D){return this.endOf(D)<N(A)},I.$g=function(A,D,R){return M.u(A)?this[D]:this.set(R,A)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function(A,D){var R=this,j=!!M.u(D)||D,S=M.p(A),W=function(lt,Z){var at=M.w(R.$u?Date.UTC(R.$y,Z,lt):new Date(R.$y,Z,lt),R);return j?at:at.endOf(c)},K=function(lt,Z){return M.w(R.toDate()[lt].apply(R.toDate("s"),(j?[0,0,0,0]:[23,59,59,999]).slice(Z)),R)},P=this.$W,st=this.$M,ct=this.$D,Q="set"+(this.$u?"UTC":"");switch(S){case f:return j?W(1,0):W(31,11);case d:return j?W(1,st):W(0,st+1);case u:var kt=this.$locale().weekStart||0,wt=(P<kt?P+7:P)-kt;return W(j?ct-wt:ct+(6-wt),st);case c:case m:return K(Q+"Hours",0);case l:return K(Q+"Minutes",1);case a:return K(Q+"Seconds",2);case o:return K(Q+"Milliseconds",3);default:return this.clone()}},I.endOf=function(A){return this.startOf(A,!1)},I.$set=function(A,D){var R,j=M.p(A),S="set"+(this.$u?"UTC":""),W=(R={},R[c]=S+"Date",R[m]=S+"Date",R[d]=S+"Month",R[f]=S+"FullYear",R[l]=S+"Hours",R[a]=S+"Minutes",R[o]=S+"Seconds",R[s]=S+"Milliseconds",R)[j],K=j===c?this.$D+(D-this.$W):D;if(j===d||j===f){var P=this.clone().set(m,1);P.$d[W](K),P.init(),this.$d=P.set(m,Math.min(this.$D,P.daysInMonth())).$d}else W&&this.$d[W](K);return this.init(),this},I.set=function(A,D){return this.clone().$set(A,D)},I.get=function(A){return this[M.p(A)]()},I.add=function(A,D){var R,j=this;A=Number(A);var S=M.p(D),W=function(st){var ct=N(j);return M.w(ct.date(ct.date()+Math.round(st*A)),j)};if(S===d)return this.set(d,this.$M+A);if(S===f)return this.set(f,this.$y+A);if(S===c)return W(1);if(S===u)return W(7);var K=(R={},R[a]=n,R[l]=i,R[o]=r,R)[S]||1,P=this.$d.getTime()+A*K;return M.w(P,this)},I.subtract=function(A,D){return this.add(-1*A,D)},I.format=function(A){var D=this,R=this.$locale();if(!this.isValid())return R.invalidDate||x;var j=A||"YYYY-MM-DDTHH:mm:ssZ",S=M.z(this),W=this.$H,K=this.$m,P=this.$M,st=R.weekdays,ct=R.months,Q=R.meridiem,kt=function(Z,at,vt,Mt){return Z&&(Z[at]||Z(D,j))||vt[at].slice(0,Mt)},wt=function(Z){return M.s(W%12||12,Z,"0")},lt=Q||function(Z,at,vt){var Mt=Z<12?"AM":"PM";return vt?Mt.toLowerCase():Mt};return j.replace(y,(function(Z,at){return at||(function(vt){switch(vt){case"YY":return String(D.$y).slice(-2);case"YYYY":return M.s(D.$y,4,"0");case"M":return P+1;case"MM":return M.s(P+1,2,"0");case"MMM":return kt(R.monthsShort,P,ct,3);case"MMMM":return kt(ct,P);case"D":return D.$D;case"DD":return M.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return kt(R.weekdaysMin,D.$W,st,2);case"ddd":return kt(R.weekdaysShort,D.$W,st,3);case"dddd":return st[D.$W];case"H":return String(W);case"HH":return M.s(W,2,"0");case"h":return wt(1);case"hh":return wt(2);case"a":return lt(W,K,!0);case"A":return lt(W,K,!1);case"m":return String(K);case"mm":return M.s(K,2,"0");case"s":return String(D.$s);case"ss":return M.s(D.$s,2,"0");case"SSS":return M.s(D.$ms,3,"0");case"Z":return S}return null})(Z)||S.replace(":","")}))},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function(A,D,R){var j,S=this,W=M.p(D),K=N(A),P=(K.utcOffset()-this.utcOffset())*n,st=this-K,ct=function(){return M.m(S,K)};switch(W){case f:j=ct()/12;break;case d:j=ct();break;case p:j=ct()/3;break;case u:j=(st-P)/6048e5;break;case c:j=(st-P)/864e5;break;case l:j=st/i;break;case a:j=st/n;break;case o:j=st/r;break;default:j=st}return R?j:M.a(j)},I.daysInMonth=function(){return this.endOf(d).$D},I.$locale=function(){return w[this.$L]},I.locale=function(A,D){if(!A)return this.$L;var R=this.clone(),j=F(A,D,!0);return j&&(R.$L=j),R},I.clone=function(){return M.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})(),U=$.prototype;return N.prototype=U,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",c],["$M",d],["$y",f],["$D",m]].forEach((function(O){U[O[1]]=function(I){return this.$g(I,O[0],O[1])}})),N.extend=function(O,I){return O.$i||(O(I,$,N),O.$i=!0),N},N.locale=F,N.isDayjs=B,N.unix=function(O){return N(1e3*O)},N.en=w[_],N.Ls=w,N.p={},N}))})(xl)),xl.exports}var yF=xF();const bF=Lc(yF);var b1=Object.defineProperty,v=(t,e)=>b1(t,"name",{value:e,configurable:!0}),CF=(t,e)=>{for(var r in e)b1(t,r,{get:e[r],enumerable:!0})},mn={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},J={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},Rf=v(function(t="fatal"){let e=mn.fatal;typeof t=="string"?t.toLowerCase()in mn&&(e=mn[t]):typeof t=="number"&&(e=t),J.trace=()=>{},J.debug=()=>{},J.info=()=>{},J.warn=()=>{},J.error=()=>{},J.fatal=()=>{},e<=mn.fatal&&(J.fatal=console.error?console.error.bind(console,Er("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Er("FATAL"))),e<=mn.error&&(J.error=console.error?console.error.bind(console,Er("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Er("ERROR"))),e<=mn.warn&&(J.warn=console.warn?console.warn.bind(console,Er("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Er("WARN"))),e<=mn.info&&(J.info=console.info?console.info.bind(console,Er("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Er("INFO"))),e<=mn.debug&&(J.debug=console.debug?console.debug.bind(console,Er("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Er("DEBUG"))),e<=mn.trace&&(J.trace=console.debug?console.debug.bind(console,Er("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Er("TRACE")))},"setLogLevel"),Er=v(t=>`%c${bF().format("ss.SSS")} : ${t} : `,"format");const yl={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 yl.hue2rgb(s,i,t+1/3)*255;case"g":return yl.hue2rgb(s,i,t)*255;case"b":return yl.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}}},kF={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},vF={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Rt={channel:yl,lang:kF,unit:vF},Pn={};for(let t=0;t<=255;t++)Pn[t]=Rt.unit.dec2hex(t);const He={ALL:0,RGB:1,HSL:2};class wF{constructor(){this.type=He.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=He.ALL}is(e){return this.type===e}}class SF{constructor(e,r){this.color=r,this.changed=!1,this.data=e,this.type=new wF}set(e,r){return this.color=r,this.changed=!1,this.data=e,this.type.type=He.ALL,this}_ensureHSL(){const e=this.data,{h:r,s:n,l:i}=e;r===void 0&&(e.h=Rt.channel.rgb2hsl(e,"h")),n===void 0&&(e.s=Rt.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=Rt.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r,g:n,b:i}=e;r===void 0&&(e.r=Rt.channel.hsl2rgb(e,"r")),n===void 0&&(e.g=Rt.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=Rt.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,r=e.r;return!this.type.is(He.HSL)&&r!==void 0?r:(this._ensureHSL(),Rt.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,r=e.g;return!this.type.is(He.HSL)&&r!==void 0?r:(this._ensureHSL(),Rt.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,r=e.b;return!this.type.is(He.HSL)&&r!==void 0?r:(this._ensureHSL(),Rt.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,r=e.h;return!this.type.is(He.RGB)&&r!==void 0?r:(this._ensureRGB(),Rt.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,r=e.s;return!this.type.is(He.RGB)&&r!==void 0?r:(this._ensureRGB(),Rt.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,r=e.l;return!this.type.is(He.RGB)&&r!==void 0?r:(this._ensureRGB(),Rt.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(He.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(He.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(He.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(He.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(He.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(He.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const qc=new SF({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 qc.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?`#${Pn[Math.round(e)]}${Pn[Math.round(r)]}${Pn[Math.round(n)]}${Pn[Math.round(i*255)]}`:`#${Pn[Math.round(e)]}${Pn[Math.round(r)]}${Pn[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 Rt.channel.clamp.h(parseFloat(r)*.9);case"rad":return Rt.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return Rt.channel.clamp.h(parseFloat(r)*360)}}return Rt.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 qc.set({h:fi._hue2deg(n),s:Rt.channel.clamp.s(parseFloat(i)),l:Rt.channel.clamp.l(parseFloat(s)),a:o?Rt.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(${Rt.lang.round(e)}, ${Rt.lang.round(r)}%, ${Rt.lang.round(n)}%, ${i})`:`hsl(${Rt.lang.round(e)}, ${Rt.lang.round(r)}%, ${Rt.lang.round(n)}%)`}},zo={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=zo.colors[t];if(e)return cs.parse(e)},stringify:t=>{const e=cs.stringify(t);for(const r in zo.colors)if(zo.colors[r]===e)return r}},Eo={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(Eo.re);if(!r)return;const[,n,i,s,o,a,l,c,u]=r;return qc.set({r:Rt.channel.clamp.r(i?parseFloat(n)*2.55:parseFloat(n)),g:Rt.channel.clamp.g(o?parseFloat(s)*2.55:parseFloat(s)),b:Rt.channel.clamp.b(l?parseFloat(a)*2.55:parseFloat(a)),a:c?Rt.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(${Rt.lang.round(e)}, ${Rt.lang.round(r)}, ${Rt.lang.round(n)}, ${Rt.lang.round(i)})`:`rgb(${Rt.lang.round(e)}, ${Rt.lang.round(r)}, ${Rt.lang.round(n)})`}},sn={format:{keyword:zo,hex:cs,rgb:Eo,rgba:Eo,hsl:fi,hsla:fi},parse:t=>{if(typeof t!="string")return t;const e=cs.parse(t)||Eo.parse(t)||fi.parse(t)||zo.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(He.HSL)||t.data.r===void 0?fi.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?Eo.stringify(t):cs.stringify(t)},C1=(t,e)=>{const r=sn.parse(t);for(const n in e)r[n]=Rt.channel.clamp[n](e[n]);return sn.stringify(r)},zn=(t,e,r=0,n=1)=>{if(typeof t!="number")return C1(t,{a:e});const i=qc.set({r:Rt.channel.clamp.r(t),g:Rt.channel.clamp.g(e),b:Rt.channel.clamp.b(r),a:Rt.channel.clamp.a(n)});return sn.stringify(i)},TF=t=>{const{r:e,g:r,b:n}=sn.parse(t),i=.2126*Rt.channel.toLinear(e)+.7152*Rt.channel.toLinear(r)+.0722*Rt.channel.toLinear(n);return Rt.lang.round(i)},_F=t=>TF(t)>=.5,Gr=t=>!_F(t),k1=(t,e,r)=>{const n=sn.parse(t),i=n[e],s=Rt.channel.clamp[e](i+r);return i!==s&&(n[e]=s),sn.stringify(n)},Y=(t,e)=>k1(t,"l",e),X=(t,e)=>k1(t,"l",-e),L=(t,e)=>{const r=sn.parse(t),n={};for(const i in e)e[i]&&(n[i]=r[i]+e[i]);return C1(t,n)},EF=(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,T=o*d+u*(1-d);return zn(y,b,k,T)},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,EF(r,t,e)};/*! @license DOMPurify 3.4.5 | (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.5/LICENSE */function yg(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function NF(t){if(Array.isArray(t))return t}function jF(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e!==0)for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function LF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
342
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BF(t,e){return NF(t)||jF(t,e)||AF(t,e)||LF()}function AF(t,e){if(t){if(typeof t=="string")return yg(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yg(t,e):void 0}}const v1=Object.entries,bg=Object.setPrototypeOf,MF=Object.isFrozen,IF=Object.getPrototypeOf,FF=Object.getOwnPropertyDescriptor;let ir=Object.freeze,Lr=Object.seal,ts=Object.create,w1=typeof Reflect<"u"&&Reflect,Uu=w1.apply,Gu=w1.construct;ir||(ir=function(e){return e});Lr||(Lr=function(e){return e});Uu||(Uu=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)});Gu||(Gu=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 Ri=Le(Array.prototype.forEach),PF=Le(Array.prototype.lastIndexOf),Cg=Le(Array.prototype.pop),$i=Le(Array.prototype.push),DF=Le(Array.prototype.splice),Qe=Array.isArray,No=Le(String.prototype.toLowerCase),Gh=Le(String.prototype.toString),kg=Le(String.prototype.match),zi=Le(String.prototype.replace),vg=Le(String.prototype.indexOf),OF=Le(String.prototype.trim),RF=Le(Number.prototype.toString),$F=Le(Boolean.prototype.toString),wg=typeof BigInt>"u"?null:Le(BigInt.prototype.toString),Sg=typeof Symbol>"u"?null:Le(Symbol.prototype.toString),Se=Le(Object.prototype.hasOwnProperty),po=Le(Object.prototype.toString),Re=Le(RegExp.prototype.test),Ha=zF(TypeError);function Le(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return Uu(t,e,n)}}function zF(t){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Gu(t,r)}}function Ht(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:No;if(bg&&bg(t,null),!Qe(e))return t;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const s=r(i);s!==i&&(MF(e)||(e[n]=s),i=s)}t[i]=!0}return t}function WF(t){for(let e=0;e<t.length;e++)Se(t,e)||(t[e]=null);return t}function ur(t){const e=ts(null);for(const n of v1(t)){var r=BF(n,2);const i=r[0],s=r[1];Se(t,i)&&(Qe(s)?e[i]=WF(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=ur(s):e[i]=s)}return e}function qF(t){switch(typeof t){case"string":return t;case"number":return RF(t);case"boolean":return $F(t);case"bigint":return wg?wg(t):"0";case"symbol":return Sg?Sg(t):"Symbol()";case"undefined":return po(t);case"function":case"object":{if(t===null)return po(t);const e=t,r=ci(e,"toString");if(typeof r=="function"){const n=r(e);return typeof n=="string"?n:po(n)}return po(t)}default:return po(t)}}function ci(t,e){for(;t!==null;){const n=FF(t,e);if(n){if(n.get)return Le(n.get);if(typeof n.value=="function")return Le(n.value)}t=IF(t)}function r(){return null}return r}function HF(t){try{return Re(t,""),!0}catch{return!1}}const Tg=ir(["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"]),Vh=ir(["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"]),Yh=ir(["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"]),UF=ir(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Xh=ir(["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"]),GF=ir(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_g=ir(["#text"]),Eg=ir(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Kh=ir(["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"]),Ng=ir(["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"]),Ua=ir(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),VF=Lr(/{{[\w\W]*|^[\w\W]*}}/g),YF=Lr(/<%[\w\W]*|^[\w\W]*%>/g),XF=Lr(/\${[\w\W]*/g),KF=Lr(/^data-[\-\w.\u00B7-\uFFFF]+$/),ZF=Lr(/^aria-[\-\w]+$/),jg=Lr(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),QF=Lr(/^(?:\w+script|data):/i),JF=Lr(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),t4=Lr(/^html$/i),e4=Lr(/^[a-z][.\w]*(-[.\w]+)+$/i),Wi={element:1,text:3,progressingInstruction:7,comment:8,document:9},r4=function(){return typeof window>"u"?null:window},n4=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}},Lg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function S1(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r4();const e=_t=>S1(_t);if(e.version="3.4.5",e.removed=[],!t||!t.document||t.document.nodeType!==Wi.document||!t.Element)return e.isSupported=!1,e;let r=t.document;const n=r,i=n.currentScript,s=t.DocumentFragment,o=t.HTMLTemplateElement,a=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,d=u===void 0?t.NamedNodeMap||t.MozNamedAttrMap:u,p=t.HTMLFormElement,f=t.DOMParser,m=t.trustedTypes,x=l.prototype,g=ci(x,"cloneNode"),y=ci(x,"remove"),b=ci(x,"nextSibling"),k=ci(x,"childNodes"),T=ci(x,"parentNode"),_=a&&a.prototype?ci(a.prototype,"nodeType"):null;if(typeof o=="function"){const _t=r.createElement("template");_t.content&&_t.content.ownerDocument&&(r=_t.content.ownerDocument)}let w,E="";const B=r,F=B.implementation,N=B.createNodeIterator,M=B.createDocumentFragment,$=B.getElementsByTagName,U=n.importNode;let O=Lg();e.isSupported=typeof v1=="function"&&typeof T=="function"&&F&&F.createHTMLDocument!==void 0;const I=VF,A=YF,D=XF,R=KF,j=ZF,S=QF,W=JF,K=e4;let P=jg,st=null;const ct=Ht({},[...Tg,...Vh,...Yh,...Xh,..._g]);let Q=null;const kt=Ht({},[...Eg,...Kh,...Ng,...Ua]);let wt=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}})),lt=null,Z=null;const at=Object.seal(ts(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let vt=!0,Mt=!0,Dt=!1,ce=!0,oe=!1,Pe=!0,Zt=!1,Be=!1,V=!1,nt=!1,dt=!1,jt=!1,et=!0,bt=!1;const G="user-content-";let it=!0,St=!1,Ot={},$t=null;const Te=Ht({},["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 or=null;const ue=Ht({},["audio","video","img","source","image","track"]);let _r=null;const Oe=Ht({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xe="http://www.w3.org/1998/Math/MathML",ar="http://www.w3.org/2000/svg",ye="http://www.w3.org/1999/xhtml";let Nn=ye,Ys=!1,Xs=null;const Na=Ht({},[xe,ar,ye],Gh);let Ks=Ht({},["mi","mo","mn","ms","mtext"]),Zs=Ht({},["annotation-xml"]);const ri=Ht({},["title","style","font","a","script"]);let ni=null;const Qs=["application/xhtml+xml","text/html"],ph="text/html";let be=null,jn=null;const ja=r.createElement("form"),Js=function(z){return z instanceof RegExp||z instanceof Function},Ii=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jn&&jn===z)return;(!z||typeof z!="object")&&(z={}),z=ur(z),ni=Qs.indexOf(z.PARSER_MEDIA_TYPE)===-1?ph:z.PARSER_MEDIA_TYPE,be=ni==="application/xhtml+xml"?Gh:No,st=Se(z,"ALLOWED_TAGS")&&Qe(z.ALLOWED_TAGS)?Ht({},z.ALLOWED_TAGS,be):ct,Q=Se(z,"ALLOWED_ATTR")&&Qe(z.ALLOWED_ATTR)?Ht({},z.ALLOWED_ATTR,be):kt,Xs=Se(z,"ALLOWED_NAMESPACES")&&Qe(z.ALLOWED_NAMESPACES)?Ht({},z.ALLOWED_NAMESPACES,Gh):Na,_r=Se(z,"ADD_URI_SAFE_ATTR")&&Qe(z.ADD_URI_SAFE_ATTR)?Ht(ur(Oe),z.ADD_URI_SAFE_ATTR,be):Oe,or=Se(z,"ADD_DATA_URI_TAGS")&&Qe(z.ADD_DATA_URI_TAGS)?Ht(ur(ue),z.ADD_DATA_URI_TAGS,be):ue,$t=Se(z,"FORBID_CONTENTS")&&Qe(z.FORBID_CONTENTS)?Ht({},z.FORBID_CONTENTS,be):Te,lt=Se(z,"FORBID_TAGS")&&Qe(z.FORBID_TAGS)?Ht({},z.FORBID_TAGS,be):ur({}),Z=Se(z,"FORBID_ATTR")&&Qe(z.FORBID_ATTR)?Ht({},z.FORBID_ATTR,be):ur({}),Ot=Se(z,"USE_PROFILES")?z.USE_PROFILES&&typeof z.USE_PROFILES=="object"?ur(z.USE_PROFILES):z.USE_PROFILES:!1,vt=z.ALLOW_ARIA_ATTR!==!1,Mt=z.ALLOW_DATA_ATTR!==!1,Dt=z.ALLOW_UNKNOWN_PROTOCOLS||!1,ce=z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=z.SAFE_FOR_TEMPLATES||!1,Pe=z.SAFE_FOR_XML!==!1,Zt=z.WHOLE_DOCUMENT||!1,nt=z.RETURN_DOM||!1,dt=z.RETURN_DOM_FRAGMENT||!1,jt=z.RETURN_TRUSTED_TYPE||!1,V=z.FORCE_BODY||!1,et=z.SANITIZE_DOM!==!1,bt=z.SANITIZE_NAMED_PROPS||!1,it=z.KEEP_CONTENT!==!1,St=z.IN_PLACE||!1,P=HF(z.ALLOWED_URI_REGEXP)?z.ALLOWED_URI_REGEXP:jg,Nn=typeof z.NAMESPACE=="string"?z.NAMESPACE:ye,Ks=Se(z,"MATHML_TEXT_INTEGRATION_POINTS")&&z.MATHML_TEXT_INTEGRATION_POINTS&&typeof z.MATHML_TEXT_INTEGRATION_POINTS=="object"?ur(z.MATHML_TEXT_INTEGRATION_POINTS):Ht({},["mi","mo","mn","ms","mtext"]),Zs=Se(z,"HTML_INTEGRATION_POINTS")&&z.HTML_INTEGRATION_POINTS&&typeof z.HTML_INTEGRATION_POINTS=="object"?ur(z.HTML_INTEGRATION_POINTS):Ht({},["annotation-xml"]);const tt=Se(z,"CUSTOM_ELEMENT_HANDLING")&&z.CUSTOM_ELEMENT_HANDLING&&typeof z.CUSTOM_ELEMENT_HANDLING=="object"?ur(z.CUSTOM_ELEMENT_HANDLING):ts(null);if(wt=ts(null),Se(tt,"tagNameCheck")&&Js(tt.tagNameCheck)&&(wt.tagNameCheck=tt.tagNameCheck),Se(tt,"attributeNameCheck")&&Js(tt.attributeNameCheck)&&(wt.attributeNameCheck=tt.attributeNameCheck),Se(tt,"allowCustomizedBuiltInElements")&&typeof tt.allowCustomizedBuiltInElements=="boolean"&&(wt.allowCustomizedBuiltInElements=tt.allowCustomizedBuiltInElements),oe&&(Mt=!1),dt&&(nt=!0),Ot&&(st=Ht({},_g),Q=ts(null),Ot.html===!0&&(Ht(st,Tg),Ht(Q,Eg)),Ot.svg===!0&&(Ht(st,Vh),Ht(Q,Kh),Ht(Q,Ua)),Ot.svgFilters===!0&&(Ht(st,Yh),Ht(Q,Kh),Ht(Q,Ua)),Ot.mathMl===!0&&(Ht(st,Xh),Ht(Q,Ng),Ht(Q,Ua))),at.tagCheck=null,at.attributeCheck=null,Se(z,"ADD_TAGS")&&(typeof z.ADD_TAGS=="function"?at.tagCheck=z.ADD_TAGS:Qe(z.ADD_TAGS)&&(st===ct&&(st=ur(st)),Ht(st,z.ADD_TAGS,be))),Se(z,"ADD_ATTR")&&(typeof z.ADD_ATTR=="function"?at.attributeCheck=z.ADD_ATTR:Qe(z.ADD_ATTR)&&(Q===kt&&(Q=ur(Q)),Ht(Q,z.ADD_ATTR,be))),Se(z,"ADD_URI_SAFE_ATTR")&&Qe(z.ADD_URI_SAFE_ATTR)&&Ht(_r,z.ADD_URI_SAFE_ATTR,be),Se(z,"FORBID_CONTENTS")&&Qe(z.FORBID_CONTENTS)&&($t===Te&&($t=ur($t)),Ht($t,z.FORBID_CONTENTS,be)),Se(z,"ADD_FORBID_CONTENTS")&&Qe(z.ADD_FORBID_CONTENTS)&&($t===Te&&($t=ur($t)),Ht($t,z.ADD_FORBID_CONTENTS,be)),it&&(st["#text"]=!0),Zt&&Ht(st,["html","head","body"]),st.table&&(Ht(st,["tbody"]),delete lt.tbody),z.TRUSTED_TYPES_POLICY){if(typeof z.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ha('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ha('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=z.TRUSTED_TYPES_POLICY,E=w.createHTML("")}else w===void 0&&(w=n4(m,i)),w!==null&&typeof E=="string"&&(E=w.createHTML(""));ir&&ir(z),jn=z},La=Ht({},[...Vh,...Yh,...UF]),to=Ht({},[...Xh,...GF]),mh=function(z){let tt=T(z);(!tt||!tt.tagName)&&(tt={namespaceURI:Nn,tagName:"template"});const ut=No(z.tagName),Vt=No(tt.tagName);return Xs[z.namespaceURI]?z.namespaceURI===ar?tt.namespaceURI===ye?ut==="svg":tt.namespaceURI===xe?ut==="svg"&&(Vt==="annotation-xml"||Ks[Vt]):!!La[ut]:z.namespaceURI===xe?tt.namespaceURI===ye?ut==="math":tt.namespaceURI===ar?ut==="math"&&Zs[Vt]:!!to[ut]:z.namespaceURI===ye?tt.namespaceURI===ar&&!Zs[Vt]||tt.namespaceURI===xe&&!Ks[Vt]?!1:!to[ut]&&(ri[ut]||!La[ut]):!!(ni==="application/xhtml+xml"&&Xs[z.namespaceURI]):!1},de=function(z){$i(e.removed,{element:z});try{T(z).removeChild(z)}catch{y(z)}},Xr=function(z,tt){try{$i(e.removed,{attribute:tt.getAttributeNode(z),from:tt})}catch{$i(e.removed,{attribute:null,from:tt})}if(tt.removeAttribute(z),z==="is")if(nt||dt)try{de(tt)}catch{}else try{tt.setAttribute(z,"")}catch{}},Ln=function(z){let tt=null,ut=null;if(V)z="<remove></remove>"+z;else{const ke=kg(z,/^[\r\n\t ]+/);ut=ke&&ke[0]}ni==="application/xhtml+xml"&&Nn===ye&&(z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+z+"</body></html>");const Vt=w?w.createHTML(z):z;if(Nn===ye)try{tt=new f().parseFromString(Vt,ni)}catch{}if(!tt||!tt.documentElement){tt=F.createDocument(Nn,"template",null);try{tt.documentElement.innerHTML=Ys?E:Vt}catch{}}const Ce=tt.body||tt.documentElement;return z&&ut&&Ce.insertBefore(r.createTextNode(ut),Ce.childNodes[0]||null),Nn===ye?$.call(tt,Zt?"html":"body")[0]:Zt?tt.documentElement:Ce},Fi=function(z){return N.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){z.normalize();const tt=N.call(z.ownerDocument||z,z,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let ut=tt.nextNode();for(;ut;){let Vt=ut.data;Ri([I,A,D],Ce=>{Vt=zi(Vt,Ce," ")}),ut.data=Vt,ut=tt.nextNode()}},ro=function(z){return z instanceof p&&(typeof z.nodeName!="string"||typeof z.textContent!="string"||typeof z.removeChild!="function"||!(z.attributes instanceof d)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function")},Pi=function(z){if(!_||typeof z!="object"||z===null)return!1;try{return typeof _(z)=="number"}catch{return!1}};function Mr(_t,z,tt){Ri(_t,ut=>{ut.call(e,z,tt,jn)})}const Ba=function(z){let tt=null;if(Mr(O.beforeSanitizeElements,z,null),ro(z))return de(z),!0;const ut=be(z.nodeName);if(Mr(O.uponSanitizeElement,z,{tagName:ut,allowedTags:st}),Pe&&z.hasChildNodes()&&!Pi(z.firstElementChild)&&Re(/<[/\w!]/g,z.innerHTML)&&Re(/<[/\w!]/g,z.textContent)||Pe&&z.namespaceURI===ye&&ut==="style"&&Pi(z.firstElementChild)||z.nodeType===Wi.progressingInstruction||Pe&&z.nodeType===Wi.comment&&Re(/<[/\w]/g,z.data))return de(z),!0;if(lt[ut]||!(at.tagCheck instanceof Function&&at.tagCheck(ut))&&!st[ut]){if(!lt[ut]&&Aa(ut)&&(wt.tagNameCheck instanceof RegExp&&Re(wt.tagNameCheck,ut)||wt.tagNameCheck instanceof Function&&wt.tagNameCheck(ut)))return!1;if(it&&!$t[ut]){const Vt=T(z)||z.parentNode,Ce=k(z)||z.childNodes;if(Ce&&Vt){const ke=Ce.length;for(let qe=ke-1;qe>=0;--qe){const Ir=g(Ce[qe],!0);Vt.insertBefore(Ir,b(z))}}}return de(z),!0}return z instanceof l&&!mh(z)||(ut==="noscript"||ut==="noembed"||ut==="noframes")&&Re(/<\/no(script|embed|frames)/i,z.innerHTML)?(de(z),!0):(oe&&z.nodeType===Wi.text&&(tt=z.textContent,Ri([I,A,D],Vt=>{tt=zi(tt,Vt," ")}),z.textContent!==tt&&($i(e.removed,{element:z.cloneNode()}),z.textContent=tt)),Mr(O.afterSanitizeElements,z,null),!1)},We=function(z,tt,ut){if(Z[tt]||et&&(tt==="id"||tt==="name")&&(ut in r||ut in ja))return!1;const Vt=Q[tt]||at.attributeCheck instanceof Function&&at.attributeCheck(tt,z);if(!(Mt&&!Z[tt]&&Re(R,tt))){if(!(vt&&Re(j,tt))){if(!Vt||Z[tt]){if(!(Aa(z)&&(wt.tagNameCheck instanceof RegExp&&Re(wt.tagNameCheck,z)||wt.tagNameCheck instanceof Function&&wt.tagNameCheck(z))&&(wt.attributeNameCheck instanceof RegExp&&Re(wt.attributeNameCheck,tt)||wt.attributeNameCheck instanceof Function&&wt.attributeNameCheck(tt,z))||tt==="is"&&wt.allowCustomizedBuiltInElements&&(wt.tagNameCheck instanceof RegExp&&Re(wt.tagNameCheck,ut)||wt.tagNameCheck instanceof Function&&wt.tagNameCheck(ut))))return!1}else if(!_r[tt]){if(!Re(P,zi(ut,W,""))){if(!((tt==="src"||tt==="xlink:href"||tt==="href")&&z!=="script"&&vg(ut,"data:")===0&&or[z])){if(!(Dt&&!Re(S,zi(ut,W,"")))){if(ut)return!1}}}}}}return!0},Kr=Ht({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Aa=function(z){return!Kr[No(z)]&&Re(K,z)},no=function(z){Mr(O.beforeSanitizeAttributes,z,null);const tt=z.attributes;if(!tt||ro(z))return;const ut={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q,forceKeepAttr:void 0};let Vt=tt.length;for(;Vt--;){const Ce=tt[Vt],ke=Ce.name,qe=Ce.namespaceURI,Ir=Ce.value,Fr=be(ke),io=Ir;let ve=ke==="value"?io:OF(io);if(ut.attrName=Fr,ut.attrValue=ve,ut.keepAttr=!0,ut.forceKeepAttr=void 0,Mr(O.uponSanitizeAttribute,z,ut),ve=ut.attrValue,bt&&(Fr==="id"||Fr==="name")&&vg(ve,G)!==0&&(Xr(ke,z),ve=G+ve),Pe&&Re(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ve)){Xr(ke,z);continue}if(Fr==="attributename"&&kg(ve,"href")){Xr(ke,z);continue}if(ut.forceKeepAttr)continue;if(!ut.keepAttr){Xr(ke,z);continue}if(!ce&&Re(/\/>/i,ve)){Xr(ke,z);continue}oe&&Ri([I,A,D],Ia=>{ve=zi(ve,Ia," ")});const Ma=be(z.nodeName);if(!We(Ma,Fr,ve)){Xr(ke,z);continue}if(w&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!qe)switch(m.getAttributeType(Ma,Fr)){case"TrustedHTML":{ve=w.createHTML(ve);break}case"TrustedScriptURL":{ve=w.createScriptURL(ve);break}}if(ve!==io)try{qe?z.setAttributeNS(qe,ke,ve):z.setAttribute(ke,ve),ro(z)?de(z):Cg(e.removed)}catch{Xr(ke,z)}}Mr(O.afterSanitizeAttributes,z,null)},ii=function(z){let tt=null;const ut=Fi(z);for(Mr(O.beforeSanitizeShadowDOM,z,null);tt=ut.nextNode();)Mr(O.uponSanitizeShadowNode,tt,null),Ba(tt),no(tt),tt.content instanceof s&&ii(tt.content);Mr(O.afterSanitizeShadowDOM,z,null)},fn=function(z){if(z.nodeType===Wi.element&&z.shadowRoot instanceof s){const Vt=z.shadowRoot;fn(Vt),ii(Vt)}const tt=z.childNodes;if(!tt)return;const ut=[];Ri(tt,Vt=>{$i(ut,Vt)});for(const Vt of ut)fn(Vt)};return e.sanitize=function(_t){let z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},tt=null,ut=null,Vt=null,Ce=null;if(Ys=!_t,Ys&&(_t="<!-->"),typeof _t!="string"&&!Pi(_t)&&(_t=qF(_t),typeof _t!="string"))throw Ha("dirty is not a string, aborting");if(!e.isSupported)return _t;if(Be||Ii(z),e.removed=[],typeof _t=="string"&&(St=!1),St){const Ir=_t.nodeName;if(typeof Ir=="string"){const Fr=be(Ir);if(!st[Fr]||lt[Fr])throw Ha("root node is forbidden and cannot be sanitized in-place")}fn(_t)}else if(Pi(_t))tt=Ln("<!---->"),ut=tt.ownerDocument.importNode(_t,!0),ut.nodeType===Wi.element&&ut.nodeName==="BODY"||ut.nodeName==="HTML"?tt=ut:tt.appendChild(ut),fn(ut);else{if(!nt&&!oe&&!Zt&&_t.indexOf("<")===-1)return w&&jt?w.createHTML(_t):_t;if(tt=Ln(_t),!tt)return nt?null:jt?E:""}tt&&V&&de(tt.firstChild);const ke=Fi(St?_t:tt);for(;Vt=ke.nextNode();)Ba(Vt),no(Vt),Vt.content instanceof s&&ii(Vt.content);if(St)return oe&&eo(_t),_t;if(nt){if(oe&&eo(tt),dt)for(Ce=M.call(tt.ownerDocument);tt.firstChild;)Ce.appendChild(tt.firstChild);else Ce=tt;return(Q.shadowroot||Q.shadowrootmode)&&(Ce=U.call(n,Ce,!0)),Ce}let qe=Zt?tt.outerHTML:tt.innerHTML;return Zt&&st["!doctype"]&&tt.ownerDocument&&tt.ownerDocument.doctype&&tt.ownerDocument.doctype.name&&Re(t4,tt.ownerDocument.doctype.name)&&(qe="<!DOCTYPE "+tt.ownerDocument.doctype.name+`>
343
- `+qe),oe&&Ri([I,A,D],Ir=>{qe=zi(qe,Ir," ")}),w&&jt?w.createHTML(qe):qe},e.setConfig=function(){let _t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ii(_t),Be=!0},e.clearConfig=function(){jn=null,Be=!1},e.isValidAttribute=function(_t,z,tt){jn||Ii({});const ut=be(_t),Vt=be(z);return We(ut,Vt,tt)},e.addHook=function(_t,z){typeof z=="function"&&$i(O[_t],z)},e.removeHook=function(_t,z){if(z!==void 0){const tt=PF(O[_t],z);return tt===-1?void 0:DF(O[_t],tt,1)[0]}return Cg(O[_t])},e.removeHooks=function(_t){O[_t]=[]},e.removeAllHooks=function(){O=Lg()},e}var Ms=S1(),T1=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,Wo=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,i4=/\s*%%.*\n/gm,ps,_1=(ps=class extends Error{constructor(e){super(e),this.name="UnknownDiagramError"}},v(ps,"UnknownDiagramError"),ps),ki={},$f=v(function(t,e){t=t.replace(T1,"").replace(Wo,"").replace(i4,`
344
- `);for(const[r,{detector:n}]of Object.entries(ki))if(n(t,e))return r;throw new _1(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),Vu=v((...t)=>{for(const{id:e,detector:r,loader:n}of t)E1(e,r,n)},"registerLazyLoadedDiagrams"),E1=v((t,e,r)=>{ki[t]&&J.warn(`Detector with key ${t} already exists. Overwriting.`),ki[t]={detector:e,loader:r},J.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),s4=v(t=>ki[t].loader,"getDiagramLoader"),Yu=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=>Yu(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]=Yu(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=Yu,hn="#ffffff",un="#f2f2f2",Pt=v((t,e)=>e?L(t,{s:-40,l:10}):L(t,{s:-40,l:-10}),"mkBorder"),ms,o4=(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,T,_,w,E,B,F,N,M,$,U,O,I,A,D,R,j;if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(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?X(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||X(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||Y(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||X(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||X(this.mainBkg,10)):(this.rowOdd=this.rowOdd||Y(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Y(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||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.darkMode)for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=X(this["cScale"+S],75);else for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScale"+S]=X(this["cScale"+S],25);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleInv"+S]=this["cScaleInv"+S]||H(this["cScale"+S]);for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this.darkMode?this["cScalePeer"+S]=this["cScalePeer"+S]||Y(this["cScale"+S],10):this["cScalePeer"+S]=this["cScalePeer"+S]||X(this["cScale"+S],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let S=0;S<this.THEME_COLOR_LIMIT;S++)this["cScaleLabel"+S]=this["cScaleLabel"+S]||this.scaleLabelColor;const e=this.darkMode?-4:-1;for(let S=0;S<5;S++)this["surface"+S]=this["surface"+S]||L(this.mainBkg,{h:180,s:-15,l:e*(5+S*3)}),this["surfacePeer"+S]=this["surfacePeer"+S]||L(this.mainBkg,{h:180,s:-15,l:e*(8+S*3)});this.classText=this.classText||this.textColor,this.fillType0=this.fillType0||this.primaryColor,this.fillType1=this.fillType1||this.secondaryColor,this.fillType2=this.fillType2||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(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||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(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??L(this.primaryColor,{l:-30}),this.venn2=this.venn2??L(this.secondaryColor,{l:-30}),this.venn3=this.venn3??L(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??L(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??L(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??L(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??L(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??L(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.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((p=this.wardley)==null?void 0:p.backgroundColor)||this.background,axisColor:((f=this.wardley)==null?void 0:f.axisColor)||this.lineColor,axisTextColor:((m=this.wardley)==null?void 0:m.axisTextColor)||this.primaryTextColor,gridColor:((x=this.wardley)==null?void 0:x.gridColor)||this.gridColor,componentFill:((g=this.wardley)==null?void 0:g.componentFill)||this.background,componentStroke:((y=this.wardley)==null?void 0:y.componentStroke)||this.lineColor,componentLabelColor:((b=this.wardley)==null?void 0:b.componentLabelColor)||this.primaryTextColor,linkStroke:((k=this.wardley)==null?void 0:k.linkStroke)||this.lineColor,evolutionStroke:((T=this.wardley)==null?void 0:T.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((_=this.wardley)==null?void 0:_.annotationStroke)||this.lineColor,annotationTextColor:((w=this.wardley)==null?void 0:w.annotationTextColor)||this.primaryTextColor,annotationFill:((E=this.wardley)==null?void 0:E.annotationFill)||this.background},this.archEdgeColor=this.archEdgeColor||"#777",this.archEdgeArrowColor=this.archEdgeArrowColor||"#777",this.archEdgeWidth=this.archEdgeWidth||"3",this.archGroupBorderColor=this.archGroupBorderColor||"#000",this.archGroupBorderWidth=this.archGroupBorderWidth||"2px",this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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:((B=this.xyChart)==null?void 0:B.backgroundColor)||this.background,titleColor:((F=this.xyChart)==null?void 0:F.titleColor)||this.primaryTextColor,dataLabelColor:((N=this.xyChart)==null?void 0:N.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((M=this.xyChart)==null?void 0:M.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:(($=this.xyChart)==null?void 0:$.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:((U=this.xyChart)==null?void 0:U.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((O=this.xyChart)==null?void 0:O.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((I=this.xyChart)==null?void 0:I.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((A=this.xyChart)==null?void 0:A.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((D=this.xyChart)==null?void 0:D.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((R=this.xyChart)==null?void 0:R.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((j=this.xyChart)==null?void 0:j.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?X(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||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||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),a4=v(t=>{const e=new o4;return e.calculate(t),e},"getThemeVariables"),gs,l4=(gs=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=L(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=Y(H("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=zn(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=X("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=X(this.sectionBkgColor,10),this.taskBorderColor=zn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=zn(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||Y(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||X(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,T,_,w,E,B,F,N,M,$,U,O,I,A,D,R;this.secondBkg=Y(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=Y(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=Y(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=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(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||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330});for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||H(this["cScale"+j]);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScalePeer"+j]=this["cScalePeer"+j]||Y(this["cScale"+j],10);for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{h:30,s:-30,l:-(-10+j*4)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{h:30,s:-30,l:-(-7+j*4)});this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["pie"+j]=this["cScale"+j];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 j=0;j<8;j++)this["venn"+(j+1)]=this["venn"+(j+1)]??Y(this["cScale"+j],30);this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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:((T=this.radar)==null?void 0:T.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#ff6b6b",this.wardley={backgroundColor:((E=this.wardley)==null?void 0:E.backgroundColor)||this.background,axisColor:((B=this.wardley)==null?void 0:B.axisColor)||this.lineColor,axisTextColor:((F=this.wardley)==null?void 0:F.axisTextColor)||this.primaryTextColor,gridColor:((N=this.wardley)==null?void 0:N.gridColor)||this.gridColor,componentFill:((M=this.wardley)==null?void 0:M.componentFill)||this.mainBkg,componentStroke:(($=this.wardley)==null?void 0:$.componentStroke)||this.lineColor,componentLabelColor:((U=this.wardley)==null?void 0:U.componentLabelColor)||this.primaryTextColor,linkStroke:((O=this.wardley)==null?void 0:O.linkStroke)||this.lineColor,evolutionStroke:((I=this.wardley)==null?void 0:I.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((A=this.wardley)==null?void 0:A.annotationStroke)||this.lineColor,annotationTextColor:((D=this.wardley)==null?void 0:D.annotationTextColor)||this.primaryTextColor,annotationFill:((R=this.wardley)==null?void 0:R.annotationFill)||this.mainBkg},this.classText=this.primaryTextColor,this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||(this.darkMode?X(this.secondaryColor,30):this.secondaryColor),this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=Y(this.secondaryColor,20),this.git1=Y(this.pie2||this.secondaryColor,20),this.git2=Y(this.pie3||this.tertiaryColor,20),this.git3=Y(this.pie4||L(this.primaryColor,{h:-30}),20),this.git4=Y(this.pie5||L(this.primaryColor,{h:-60}),20),this.git5=Y(this.pie6||L(this.primaryColor,{h:-90}),10),this.git6=Y(this.pie7||L(this.primaryColor,{h:60}),10),this.git7=Y(this.pie8||L(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.emUiFill=this.emUiFill||"#2d2d2d",this.emUiStroke=this.emUiStroke||"#555",this.emProcessorFill=this.emProcessorFill||Y("#5a3d5c",10),this.emProcessorStroke=this.emProcessorStroke||"#8a6d8c",this.emReadModelFill=this.emReadModelFill||Y("#3d5a2d",10),this.emReadModelStroke=this.emReadModelStroke||"#6d8c5c",this.emCommandFill=this.emCommandFill||Y("#2d3d5a",10),this.emCommandStroke=this.emCommandStroke||"#5c6d8c",this.emEventFill=this.emEventFill||Y("#5a452d",10),this.emEventStroke=this.emEventStroke||"#8c755c",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||Y(this.background,5),this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||Y(this.background,12),this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||Y(this.background,12),this.attributeBackgroundColorEven=this.attributeBackgroundColorEven||Y(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),c4=v(t=>{const e=new l4;return e.calculate(t),e},"getThemeVariables"),xs,h4=(xs=class{constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=L(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=L(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=zn(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,T,_,w,E,B,F,N,M,$,U,O,I,A,D,R;this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||X(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||X(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=X(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||L(this["cScale"+j],{h:180});for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{h:30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{h:30,l:-(7+j*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 j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||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||Y(this.primaryColor,75)||"#ffffff",this.rowEven=this.rowEven||Y(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=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(this.secondaryColor,{h:128}),this.pie1=this.pie1||this.primaryColor,this.pie2=this.pie2||this.secondaryColor,this.pie3=this.pie3||L(this.tertiaryColor,{l:-40}),this.pie4=this.pie4||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-30}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-20}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-20}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-40}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:-40}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-40}),this.pie11=this.pie11||L(this.primaryColor,{h:-90,l:-40}),this.pie12=this.pie12||L(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??L(this.primaryColor,{l:-30}),this.venn2=this.venn2??L(this.secondaryColor,{l:-30}),this.venn3=this.venn3??L(this.tertiaryColor,{l:-40}),this.venn4=this.venn4??L(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??L(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??L(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??L(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??L(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||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.axisColor)||this.lineColor,axisTextColor:((f=this.wardley)==null?void 0:f.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((k=this.wardley)==null?void 0:k.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((T=this.wardley)==null?void 0:T.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((w=this.wardley)==null?void 0:w.annotationFill)||this.background},this.xyChart={backgroundColor:((E=this.xyChart)==null?void 0:E.backgroundColor)||this.background,titleColor:((B=this.xyChart)==null?void 0:B.titleColor)||this.primaryTextColor,dataLabelColor:((F=this.xyChart)==null?void 0:F.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((N=this.xyChart)==null?void 0:N.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((M=this.xyChart)==null?void 0:M.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:(($=this.xyChart)==null?void 0:$.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((U=this.xyChart)==null?void 0:U.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((O=this.xyChart)==null?void 0:O.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((I=this.xyChart)==null?void 0:I.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((A=this.xyChart)==null?void 0:A.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((D=this.xyChart)==null?void 0:D.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((R=this.xyChart)==null?void 0:R.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||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(this.git7,25)),this.gitInv0=this.gitInv0||X(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||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),u4=v(t=>{const e=new h4;return e.calculate(t),e},"getThemeVariables"),ys,d4=(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=Y("#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,T,_,w,E,B,F,N,M,$,U,O,I,A,D,R;this.actorBorder=X(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||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||X(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||X(this.tertiaryColor,40);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScale"+j]=X(this["cScale"+j],10),this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],25);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||L(this["cScale"+j],{h:180});this.scaleLabelColor=this.scaleLabelColor!=="calculated"&&this.scaleLabelColor?this.scaleLabelColor:this.labelTextColor;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{h:30,s:-30,l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{h:30,s:-30,l:-(8+j*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||Y(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||Y(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=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(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||L(this.primaryColor,{l:-30}),this.pie5=this.pie5||L(this.secondaryColor,{l:-30}),this.pie6=this.pie6||L(this.tertiaryColor,{h:40,l:-40}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-50}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-50}),this.pie12=this.pie12||L(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??L(this.primaryColor,{l:-30}),this.venn2=this.venn2??L(this.secondaryColor,{l:-30}),this.venn3=this.venn3??L(this.tertiaryColor,{l:-30}),this.venn4=this.venn4??L(this.primaryColor,{h:60,l:-30}),this.venn5=this.venn5??L(this.primaryColor,{h:-60,l:-30}),this.venn6=this.venn6??L(this.secondaryColor,{h:60,l:-30}),this.venn7=this.venn7??L(this.primaryColor,{h:120,l:-30}),this.venn8=this.venn8??L(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||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((d=this.wardley)==null?void 0:d.backgroundColor)||this.background,axisColor:((p=this.wardley)==null?void 0:p.axisColor)||this.lineColor,axisTextColor:((f=this.wardley)==null?void 0:f.axisTextColor)||this.primaryTextColor,gridColor:((m=this.wardley)==null?void 0:m.gridColor)||this.gridColor,componentFill:((x=this.wardley)==null?void 0:x.componentFill)||this.background,componentStroke:((g=this.wardley)==null?void 0:g.componentStroke)||this.lineColor,componentLabelColor:((y=this.wardley)==null?void 0:y.componentLabelColor)||this.primaryTextColor,linkStroke:((b=this.wardley)==null?void 0:b.linkStroke)||this.lineColor,evolutionStroke:((k=this.wardley)==null?void 0:k.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((T=this.wardley)==null?void 0:T.annotationStroke)||this.lineColor,annotationTextColor:((_=this.wardley)==null?void 0:_.annotationTextColor)||this.primaryTextColor,annotationFill:((w=this.wardley)==null?void 0:w.annotationFill)||this.background},this.xyChart={backgroundColor:((E=this.xyChart)==null?void 0:E.backgroundColor)||this.background,titleColor:((B=this.xyChart)==null?void 0:B.titleColor)||this.primaryTextColor,dataLabelColor:((F=this.xyChart)==null?void 0:F.dataLabelColor)||this.primaryTextColor,xAxisTitleColor:((N=this.xyChart)==null?void 0:N.xAxisTitleColor)||this.primaryTextColor,xAxisLabelColor:((M=this.xyChart)==null?void 0:M.xAxisLabelColor)||this.primaryTextColor,xAxisTickColor:(($=this.xyChart)==null?void 0:$.xAxisTickColor)||this.primaryTextColor,xAxisLineColor:((U=this.xyChart)==null?void 0:U.xAxisLineColor)||this.primaryTextColor,yAxisTitleColor:((O=this.xyChart)==null?void 0:O.yAxisTitleColor)||this.primaryTextColor,yAxisLabelColor:((I=this.xyChart)==null?void 0:I.yAxisLabelColor)||this.primaryTextColor,yAxisTickColor:((A=this.xyChart)==null?void 0:A.yAxisTickColor)||this.primaryTextColor,yAxisLineColor:((D=this.xyChart)==null?void 0:D.yAxisLineColor)||this.primaryTextColor,plotColorPalette:((R=this.xyChart)==null?void 0:R.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||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||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),f4=v(t=>{const e=new d4;return e.calculate(t),e},"getThemeVariables"),bs,p4=(bs=class{constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=Y(this.contrast,55),this.background="#ffffff",this.tertiaryColor=L(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||Y(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,T,_,w,E,B,F,N,M,$,U,O,I,A,D,R;this.secondBkg=Y(this.contrast,55),this.border2=this.contrast,this.actorBorder=Y(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 j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleInv"+j]=this["cScaleInv"+j]||H(this["cScale"+j]);for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this.darkMode?this["cScalePeer"+j]=this["cScalePeer"+j]||Y(this["cScale"+j],10):this["cScalePeer"+j]=this["cScalePeer"+j]||X(this["cScale"+j],10);this.scaleLabelColor=this.scaleLabelColor||(this.darkMode?"black":this.labelTextColor),this.cScaleLabel0=this.cScaleLabel0||this.cScale1,this.cScaleLabel2=this.cScaleLabel2||this.cScale1;for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["cScaleLabel"+j]=this["cScaleLabel"+j]||this.scaleLabelColor;for(let j=0;j<5;j++)this["surface"+j]=this["surface"+j]||L(this.mainBkg,{l:-(5+j*5)}),this["surfacePeer"+j]=this["surfacePeer"+j]||L(this.mainBkg,{l:-(8+j*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=Y(this.contrast,30),this.sectionBkgColor2=Y(this.contrast,30),this.taskBorderColor=X(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=Y(this.border1,30),this.doneTaskBkgColor=this.done,this.doneTaskBorderColor=this.lineColor,this.critBkgColor=this.critical,this.critBorderColor=X(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=L(this.primaryColor,{h:64}),this.fillType3=L(this.secondaryColor,{h:64}),this.fillType4=L(this.primaryColor,{h:-64}),this.fillType5=L(this.secondaryColor,{h:-64}),this.fillType6=L(this.primaryColor,{h:128}),this.fillType7=L(this.secondaryColor,{h:128});for(let j=0;j<this.THEME_COLOR_LIMIT;j++)this["pie"+j]=this["cScale"+j];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 j=0;j<8;j++)this["venn"+(j+1)]=this["venn"+(j+1)]??this["cScale"+j];this.vennTitleTextColor=this.vennTitleTextColor??this.titleColor,this.vennSetTextColor=this.vennSetTextColor??this.textColor,this.quadrant1Fill=this.quadrant1Fill||this.primaryColor,this.quadrant2Fill=this.quadrant2Fill||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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:((T=this.radar)==null?void 0:T.graticuleOpacity)||.3,legendBoxSize:((_=this.radar)==null?void 0:_.legendBoxSize)||12,legendFontSize:((w=this.radar)==null?void 0:w.legendFontSize)||12},this.wardleyEvolutionColor=this.wardleyEvolutionColor||"#dc3545",this.wardley={backgroundColor:((E=this.wardley)==null?void 0:E.backgroundColor)||this.background,axisColor:((B=this.wardley)==null?void 0:B.axisColor)||this.lineColor,axisTextColor:((F=this.wardley)==null?void 0:F.axisTextColor)||this.primaryTextColor,gridColor:((N=this.wardley)==null?void 0:N.gridColor)||this.gridColor,componentFill:((M=this.wardley)==null?void 0:M.componentFill)||this.background,componentStroke:(($=this.wardley)==null?void 0:$.componentStroke)||this.lineColor,componentLabelColor:((U=this.wardley)==null?void 0:U.componentLabelColor)||this.primaryTextColor,linkStroke:((O=this.wardley)==null?void 0:O.linkStroke)||this.lineColor,evolutionStroke:((I=this.wardley)==null?void 0:I.evolutionStroke)||this.wardleyEvolutionColor,annotationStroke:((A=this.wardley)==null?void 0:A.annotationStroke)||this.lineColor,annotationTextColor:((D=this.wardley)==null?void 0:D.annotationTextColor)||this.primaryTextColor,annotationFill:((R=this.wardley)==null?void 0:R.annotationFill)||this.background},this.requirementBackground=this.requirementBackground||this.primaryColor,this.requirementBorderColor=this.requirementBorderColor||this.primaryBorderColor,this.requirementBorderSize=this.requirementBorderSize||"1",this.requirementTextColor=this.requirementTextColor||this.primaryTextColor,this.relationColor=this.relationColor||this.lineColor,this.relationLabelBackground=this.relationLabelBackground||this.edgeLabelBackground,this.relationLabelColor=this.relationLabelColor||this.actorTextColor,this.git0=X(this.pie1,25)||this.primaryColor,this.git1=this.pie2||this.secondaryColor,this.git2=this.pie3||this.tertiaryColor,this.git3=this.pie4||L(this.primaryColor,{h:-30}),this.git4=this.pie5||L(this.primaryColor,{h:-60}),this.git5=this.pie6||L(this.primaryColor,{h:-90}),this.git6=this.pie7||L(this.primaryColor,{h:60}),this.git7=this.pie8||L(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.emUiFill=this.emUiFill||"white",this.emUiStroke=this.emUiStroke||"#dbdada",this.emProcessorFill=this.emProcessorFill||"#edb3f6",this.emProcessorStroke=this.emProcessorStroke||"#b88cbf",this.emReadModelFill=this.emReadModelFill||"#d3f1a2",this.emReadModelStroke=this.emReadModelStroke||"#a3b732",this.emCommandFill=this.emCommandFill||"#bcd6fe",this.emCommandStroke=this.emCommandStroke||"#679ac3",this.emEventFill=this.emEventFill||"#ffb778",this.emEventStroke=this.emEventStroke||"#c19a0f",this.emSwimlaneBackgroundOdd=this.emSwimlaneBackgroundOdd||"rgb(250,250,250)",this.emSwimlaneBackgroundStroke=this.emSwimlaneBackgroundStroke||"rgb(240,240,240)",this.emArrowhead=this.emArrowhead||this.lineColor,this.emRelationStroke=this.emRelationStroke||this.lineColor,this.attributeBackgroundColorOdd=this.attributeBackgroundColorOdd||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),m4=v(t=>{const e=new p4;return e.calculate(t),e},"getThemeVariables"),Cs,g4=(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||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(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?X(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||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=L(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||Y(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||L(e,{h:30}),this.cScale4=this.cScale4||L(e,{h:60}),this.cScale5=this.cScale5||L(e,{h:90}),this.cScale6=this.cScale6||L(e,{h:120}),this.cScale7=this.cScale7||L(e,{h:150}),this.cScale8=this.cScale8||L(e,{h:210,l:150}),this.cScale9=this.cScale9||L(e,{h:270}),this.cScale10=this.cScale10||L(e,{h:300}),this.cScale11=this.cScale11||L(e,{h:330}),this.darkMode)for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=X(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=X(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]||Y(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||X(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]||L(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||L(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||L(e,{h:64}),this.fillType3=this.fillType3||L(r,{h:64}),this.fillType4=this.fillType4||L(e,{h:-64}),this.fillType5=this.fillType5||L(r,{h:-64}),this.fillType6=this.fillType6||L(e,{h:128}),this.fillType7=this.fillType7||L(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||L(e,{l:-10}),this.pie5=this.pie5||L(r,{l:-10}),this.pie6=this.pie6||L(n,{l:-10}),this.pie7=this.pie7||L(e,{h:60,l:-10}),this.pie8=this.pie8||L(e,{h:-60,l:-10}),this.pie9=this.pie9||L(e,{h:120,l:0}),this.pie10=this.pie10||L(e,{h:60,l:-20}),this.pie11=this.pie11||L(e,{h:-60,l:-20}),this.pie12=this.pie12||L(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||L(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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?X(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||L(e,{h:-30}),this.git4=this.git4||L(e,{h:-60}),this.git5=this.git5||L(e,{h:-90}),this.git6=this.git6||L(e,{h:60}),this.git7=this.git7||L(e,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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),x4=v(t=>{const e=new g4;return e.calculate(t),e},"getThemeVariables"),ks,y4=(ks=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=L(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=Y(H("#323D47"),10),this.border1="#ccc",this.border2=zn(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||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(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?X(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||X(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||Y(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||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(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]||Y(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||X(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]||L(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||L(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||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(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||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(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||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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?X(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=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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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),b4=v(t=>{const e=new y4;return e.calculate(t),e},"getThemeVariables"),vs,C4=(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||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(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?X(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||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=L(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||Y(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]=X(this["cScale"+g],75);else for(let g=0;g<this.THEME_COLOR_LIMIT;g++)this["cScale"+g]=X(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]||Y(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||X(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]||L(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||L(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||L(e,{h:64}),this.fillType3=this.fillType3||L(r,{h:64}),this.fillType4=this.fillType4||L(e,{h:-64}),this.fillType5=this.fillType5||L(r,{h:-64}),this.fillType6=this.fillType6||L(e,{h:128}),this.fillType7=this.fillType7||L(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||L(e,{l:-10}),this.pie5=this.pie5||L(r,{l:-10}),this.pie6=this.pie6||L(n,{l:-10}),this.pie7=this.pie7||L(e,{h:60,l:-10}),this.pie8=this.pie8||L(e,{h:-60,l:-10}),this.pie9=this.pie9||L(e,{h:120,l:0}),this.pie10=this.pie10||L(e,{h:60,l:-20}),this.pie11=this.pie11||L(e,{h:-60,l:-20}),this.pie12=this.pie12||L(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||L(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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?X(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||L(e,{h:-30}),this.git4=this.git4||L(e,{h:-60}),this.git5=this.git5||L(e,{h:-90}),this.git6=this.git6||L(e,{h:60}),this.git7=this.git7||L(e,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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),k4=v(t=>{const e=new C4;return e.calculate(t),e},"getThemeVariables"),ws,v4=(ws=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=L(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=Y(H("#323D47"),10),this.border1="#ccc",this.border2=zn(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||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(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?X(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||X(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||Y(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||L(this.primaryColor,{h:30}),this.cScale4=this.cScale4||L(this.primaryColor,{h:60}),this.cScale5=this.cScale5||L(this.primaryColor,{h:90}),this.cScale6=this.cScale6||L(this.primaryColor,{h:120}),this.cScale7=this.cScale7||L(this.primaryColor,{h:150}),this.cScale8=this.cScale8||L(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||L(this.primaryColor,{h:270}),this.cScale10=this.cScale10||L(this.primaryColor,{h:300}),this.cScale11=this.cScale11||L(this.primaryColor,{h:330}),this.darkMode)for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(this["cScale"+f],75);else for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScale"+f]=X(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]||Y(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||X(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]||L(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||L(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||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(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||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(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||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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?X(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||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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),w4=v(t=>{const e=new v4;return e.calculate(t),e},"getThemeVariables"),Ss,S4=(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||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(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?X(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||X(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||H(this.lineColor);const e="#ECECFE",r="#E9E9F1",n=L(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||Y(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]||Y(this["cScale"+g],10):this["cScalePeer"+g]=this["cScalePeer"+g]||X(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]||L(this.mainBkg,{h:180,s:-15,l:i*(5+g*3)}),this["surfacePeer"+g]=this["surfacePeer"+g]||L(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||L(e,{h:64}),this.fillType3=this.fillType3||L(r,{h:64}),this.fillType4=this.fillType4||L(e,{h:-64}),this.fillType5=this.fillType5||L(r,{h:-64}),this.fillType6=this.fillType6||L(e,{h:128}),this.fillType7=this.fillType7||L(r,{h:128}),this.pie1=this.pie1||e,this.pie2=this.pie2||r,this.pie3=this.pie3||n,this.pie4=this.pie4||L(e,{l:-10}),this.pie5=this.pie5||L(r,{l:-10}),this.pie6=this.pie6||L(n,{l:-10}),this.pie7=this.pie7||L(e,{h:60,l:-10}),this.pie8=this.pie8||L(e,{h:-60,l:-10}),this.pie9=this.pie9||L(e,{h:120,l:0}),this.pie10=this.pie10||L(e,{h:60,l:-20}),this.pie11=this.pie11||L(e,{h:-60,l:-20}),this.pie12=this.pie12||L(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||L(e,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(e,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(e,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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?X(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||L(e,{h:-30}),this.git4=this.git4||L(e,{h:-60}),this.git5=this.git5||L(e,{h:-90}),this.git6=this.git6||L(e,{h:60}),this.git7=this.git7||L(e,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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),T4=v(t=>{const e=new S4;return e.calculate(t),e},"getThemeVariables"),Ts,_4=(Ts=class{constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=Y(this.primaryColor,16),this.tertiaryColor=L(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=Y(H("#323D47"),10),this.border1="#ccc",this.border2=zn(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||L(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||L(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?X(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||X(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||Y(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]||Y(this["cScale"+f],10):this["cScalePeer"+f]=this["cScalePeer"+f]||X(this["cScale"+f],10);this.scaleLabelColor=this.scaleLabelColor||this.labelTextColor;for(let f=0;f<this.THEME_COLOR_LIMIT;f++)this["cScaleLabel"+f]=X(this["cScale"+f],75);const e=this.darkMode?-4:-1;for(let f=0;f<5;f++)this["surface"+f]=this["surface"+f]||L(this.mainBkg,{h:180,s:-15,l:e*(5+f*3)}),this["surfacePeer"+f]=this["surfacePeer"+f]||L(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||L(this.primaryColor,{h:64}),this.fillType3=this.fillType3||L(this.secondaryColor,{h:64}),this.fillType4=this.fillType4||L(this.primaryColor,{h:-64}),this.fillType5=this.fillType5||L(this.secondaryColor,{h:-64}),this.fillType6=this.fillType6||L(this.primaryColor,{h:128}),this.fillType7=this.fillType7||L(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||L(this.primaryColor,{l:-10}),this.pie5=this.pie5||L(this.secondaryColor,{l:-10}),this.pie6=this.pie6||L(this.tertiaryColor,{l:-10}),this.pie7=this.pie7||L(this.primaryColor,{h:60,l:-10}),this.pie8=this.pie8||L(this.primaryColor,{h:-60,l:-10}),this.pie9=this.pie9||L(this.primaryColor,{h:120,l:0}),this.pie10=this.pie10||L(this.primaryColor,{h:60,l:-20}),this.pie11=this.pie11||L(this.primaryColor,{h:-60,l:-20}),this.pie12=this.pie12||L(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||L(this.primaryColor,{r:5,g:5,b:5}),this.quadrant3Fill=this.quadrant3Fill||L(this.primaryColor,{r:10,g:10,b:10}),this.quadrant4Fill=this.quadrant4Fill||L(this.primaryColor,{r:15,g:15,b:15}),this.quadrant1TextFill=this.quadrant1TextFill||this.primaryTextColor,this.quadrant2TextFill=this.quadrant2TextFill||L(this.primaryTextColor,{r:-5,g:-5,b:-5}),this.quadrant3TextFill=this.quadrant3TextFill||L(this.primaryTextColor,{r:-10,g:-10,b:-10}),this.quadrant4TextFill=this.quadrant4TextFill||L(this.primaryTextColor,{r:-15,g:-15,b:-15}),this.quadrantPointFill=this.quadrantPointFill||Gr(this.quadrant1Fill)?Y(this.quadrant1Fill):X(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?X(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||L(this.primaryColor,{h:-30}),this.git4=this.git4||L(this.primaryColor,{h:-60}),this.git5=this.git5||L(this.primaryColor,{h:-90}),this.git6=this.git6||L(this.primaryColor,{h:60}),this.git7=this.git7||L(this.primaryColor,{h:120}),this.darkMode?(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.git0=X(this.git0,25),this.git1=X(this.git1,25),this.git2=X(this.git2,25),this.git3=X(this.git3,25),this.git4=X(this.git4,25),this.git5=X(this.git5,25),this.git6=X(this.git6,25),this.git7=X(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),E4=v(t=>{const e=new _4;return e.calculate(t),e},"getThemeVariables"),bn={base:{getThemeVariables:a4},dark:{getThemeVariables:c4},default:{getThemeVariables:u4},forest:{getThemeVariables:f4},neutral:{getThemeVariables:m4},neo:{getThemeVariables:x4},"neo-dark":{getThemeVariables:b4},redux:{getThemeVariables:k4},"redux-dark":{getThemeVariables:w4},"redux-color":{getThemeVariables:T4},"redux-dark-color":{getThemeVariables:E4}},Ze={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},N1={...Ze,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:bn.default.getThemeVariables(),sequence:{...Ze.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Ze.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Ze.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Ze.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:{...Ze.pie,useWidth:984},xyChart:{...Ze.xyChart,useWidth:void 0},requirement:{...Ze.requirement,useWidth:void 0},packet:{...Ze.packet},eventmodeling:{...Ze.eventmodeling},treeView:{...Ze.treeView,useWidth:void 0},radar:{...Ze.radar},ishikawa:{...Ze.ishikawa},sankey:{...Ze.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Ze.venn}},j1=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...j1(t[n],"")]:[...r,e+n],[]),"keyify"),N4=new Set(j1(N1,"")),L1=N1,Yl=v(t=>{if(J.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>Yl(e));return}for(const e of Object.keys(t)){if(J.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!N4.has(e)||t[e]==null){J.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){if(e==="nodeColors"){const n=/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i;for(const i of Object.keys(t[e]))(typeof t[e][i]!="string"||!n.test(t[e][i]))&&(J.debug("sanitize deleting invalid color:",i,t[e][i]),delete t[e][i])}else J.debug("sanitizing object",e),Yl(t[e]);continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const n of r)e.includes(n)&&(J.debug("sanitizing css option",e),t[e]=B1(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]="")}J.debug("After sanitization",t)}},"sanitizeDirective"),B1=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(L1),Tn=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),dr=Ie({},Is),Xl,vi=[],qo=Ie({},Is),Hc=v((t,e)=>{let r=Ie({},t),n={};for(const i of e)I1(i),n=Ie(n,i);if(r=Ie(r,n),n.theme&&n.theme in bn){const i=Ie({},Xl),s=Ie(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in bn&&(r.themeVariables=bn[r.theme].getThemeVariables(s))}return qo=r,P1(qo),qo},"updateCurrentConfig"),j4=v(t=>(dr=Ie({},Is),dr=Ie(dr,t),t.theme&&bn[t.theme]&&(dr.themeVariables=bn[t.theme].getThemeVariables(t.themeVariables)),Hc(dr,vi),dr),"setSiteConfig"),L4=v(t=>{Xl=Ie({},t)},"saveConfigFromInitialize"),B4=v(t=>(dr=Ie(dr,t),Hc(dr,vi),dr),"updateSiteConfig"),A1=v(()=>Ie({},dr),"getSiteConfig"),M1=v(t=>(P1(t),Ie(qo,t),ge()),"setConfig"),ge=v(()=>Ie({},qo),"getConfig"),I1=v(t=>{t&&(["secure",...dr.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(J.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"&&I1(t[e])}))},"sanitize"),A4=v(t=>{var e;Yl(t),t.fontFamily&&!((e=t.themeVariables)!=null&&e.fontFamily)&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),vi.push(t),Hc(dr,vi)},"addDirective"),Kl=v((t=dr)=>{vi=[],Hc(t,vi)},"reset"),M4={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."},Bg={},F1=v(t=>{Bg[t]||(J.warn(M4[t]),Bg[t]=!0)},"issueWarning"),P1=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&F1("LAZY_LOAD_DEPRECATED")},"checkConfig"),lZ=v(()=>{let t={};Xl&&(t=Ie(t,Xl));for(const e of vi)t=Ie(t,e);return t},"getUserDefinedConfig"),sr=v(t=>{var e,r;return((e=t.flowchart)==null?void 0:e.htmlLabels)!=null&&F1("FLOWCHART_HTML_LABELS_DEPRECATED"),Tn(t.htmlLabels??((r=t.flowchart)==null?void 0:r.htmlLabels)??!0)},"getEffectiveHtmlLabels"),ya=/<br\s*\/?>/gi,I4=v(t=>t?R1(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),F4=(()=>{let t=!1;return()=>{t||(D1(),t=!0)}})();function D1(){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(D1,"setupDompurifyHooks");var O1=v(t=>(F4(),Ms.sanitize(t)),"removeScript"),Ag=v((t,e)=>{if(sr(e)){const r=e.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?t=O1(t):r!=="loose"&&(t=R1(t),t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=t.replace(/=/g,"&equals;"),t=R4(t))}return t},"sanitizeMore"),Ur=v((t,e)=>t&&(e.dompurifyConfig?t=Ms.sanitize(Ag(t,e),e.dompurifyConfig).toString():t=Ms.sanitize(Ag(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),P4=v((t,e)=>typeof t=="string"?Ur(t,e):t.flat().map(r=>Ur(r,e)),"sanitizeTextOrArray"),D4=v(t=>ya.test(t),"hasBreaks"),O4=v(t=>t.split(ya),"splitBreaks"),R4=v(t=>t.replace(/#br#/g,"<br/>"),"placeholderToBreak"),R1=v(t=>t.replace(ya,"#br#"),"breakToPlaceholder"),$4=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"),z4=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),W4=v(function(...t){const e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),Mg=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];q4(s,o)&&(i=s+","+o,n++,r.pop())}r.push(H4(i))}return r.join("")},"parseGenericTypes"),Xu=v((t,e)=>Math.max(0,t.split(e).length-1),"countOccurrence"),q4=v((t,e)=>{const r=Xu(t,"~"),n=Xu(e,"~");return r===1&&n===1},"shouldCombineSets"),H4=v(t=>{const e=Xu(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"),Ig=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),Ku=/\$\$(.*)\$\$/g,Qo=v(t=>{var e;return(((e=t.match(Ku))==null?void 0:e.length)??0)>0},"hasKatex"),cZ=v(async(t,e)=>{const r=document.createElement("div");r.innerHTML=await $1(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"),U4=v(async(t,e)=>{if(!Qo(t))return t;if(!(Ig()||e.legacyMathML||e.forceLegacyMathML))return t.replace(Ku,"MathML is unsupported in this environment.");{const{default:r}=await Jt(async()=>{const{default:i}=await import("./katex-C5jXJg4s.js");return{default:i}},[]),n=e.forceLegacyMathML||!Ig()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(ya).map(i=>Qo(i)?`<div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">${i}</div>`:`<div>${i}</div>`).join("").replace(Ku,(i,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(/<annotation.*<\/annotation>/g,""))}},"renderKatexUnsanitized"),$1=v(async(t,e)=>Ur(await U4(t,e),e),"renderKatexSanitized"),ba={getRows:I4,sanitizeText:Ur,sanitizeTextOrArray:P4,hasBreaks:D4,splitBreaks:O4,lineBreakRegex:ya,removeScript:O1,getUrl:$4,evaluate:Tn,getMax:z4,getMin:W4},G4=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),V4=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"),z1=v(function(t,e,r,n){const i=V4(e,r,n);G4(t,i)},"configureSvgSize"),Y4=v(function(t,e,r,n){const i=e.node().getBBox(),s=i.width,o=i.height;J.info(`SVG bounds: ${s}x${o}`,i);let a=0,l=0;J.info(`Graph bounds: ${a}x${l}`,t),a=s+r*2,l=o+r*2,J.info(`Calculated bounds: ${a}x${l}`),z1(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"),bl={};function Zu(t){return[...t.cssRules].map(e=>e.cssText).join(`
345
- `)}v(Zu,"cssStyleSheetToString");var X4=v((t,e,r,n)=>{let i="";return t in bl&&bl[t]?i=bl[t]({...r,svgId:n}):J.warn(`No theme found for ${t}`),` & {
346
- font-family: ${r.fontFamily};
347
- font-size: ${r.fontSize};
348
- fill: ${r.textColor}
349
- }
350
- @keyframes edge-animation-frame {
351
- from {
352
- stroke-dashoffset: 0;
353
- }
354
- }
355
- @keyframes dash {
356
- to {
357
- stroke-dashoffset: 0;
358
- }
359
- }
360
- & .edge-animation-slow {
361
- stroke-dasharray: 9,5 !important;
362
- stroke-dashoffset: 900;
363
- animation: dash 50s linear infinite;
364
- stroke-linecap: round;
365
- }
366
- & .edge-animation-fast {
367
- stroke-dasharray: 9,5 !important;
368
- stroke-dashoffset: 900;
369
- animation: dash 20s linear infinite;
370
- stroke-linecap: round;
371
- }
372
- /* Classes common for multiple diagrams */
373
-
374
- & .error-icon {
375
- fill: ${r.errorBkgColor};
376
- }
377
- & .error-text {
378
- fill: ${r.errorTextColor};
379
- stroke: ${r.errorTextColor};
380
- }
381
-
382
- & .edge-thickness-normal {
383
- stroke-width: ${r.strokeWidth??1}px;
384
- }
385
- & .edge-thickness-thick {
386
- stroke-width: 3.5px
387
- }
388
- & .edge-pattern-solid {
389
- stroke-dasharray: 0;
390
- }
391
- & .edge-thickness-invisible {
392
- stroke-width: 0;
393
- fill: none;
394
- }
395
- & .edge-pattern-dashed{
396
- stroke-dasharray: 3;
397
- }
398
- .edge-pattern-dotted {
399
- stroke-dasharray: 2;
400
- }
401
-
402
- & .marker {
403
- fill: ${r.lineColor};
404
- stroke: ${r.lineColor};
405
- }
406
- & .marker.cross {
407
- stroke: ${r.lineColor};
408
- }
409
-
410
- & svg {
411
- font-family: ${r.fontFamily};
412
- font-size: ${r.fontSize};
413
- }
414
- & p {
415
- margin: 0
416
- }
417
-
418
- ${i}
419
- .node .neo-node {
420
- stroke: ${r.nodeBorder};
421
- }
422
-
423
- [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon {
424
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
425
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
426
- }
427
-
428
-
429
- [data-look="neo"].node path {
430
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
431
- stroke-width: ${r.strokeWidth??1}px;
432
- }
433
-
434
- [data-look="neo"].node .outer-path {
435
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
436
- }
437
-
438
- [data-look="neo"].node .neo-line path {
439
- stroke: ${r.nodeBorder};
440
- filter: none;
441
- }
442
-
443
- [data-look="neo"].node circle{
444
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
445
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
446
- }
447
-
448
- [data-look="neo"].node circle .state-start{
449
- fill: #000000;
450
- }
451
-
452
- [data-look="neo"].icon-shape .icon {
453
- fill: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
454
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
455
- }
456
-
457
- [data-look="neo"].icon-shape .icon-neo path {
458
- stroke: ${r.useGradient?"url("+n+"-gradient)":r.nodeBorder};
459
- filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${n}-drop-shadow)`):"none"};
460
- }
461
-
462
- ${e}
463
- `},"getStyles"),K4=v((t,e)=>{e!==void 0&&(bl[t]=e)},"addStylesForDiagram"),Z4=X4,W1={};CF(W1,{clear:()=>Q4,getAccDescription:()=>rP,getAccTitle:()=>tP,getDiagramTitle:()=>iP,setAccDescription:()=>eP,setAccTitle:()=>J4,setDiagramTitle:()=>nP});var zf="",Wf="",qf="",Hf=v(t=>Ur(t,ge()),"sanitizeText"),Q4=v(()=>{zf="",qf="",Wf=""},"clear"),J4=v(t=>{zf=Hf(t).replace(/^\s+/g,"")},"setAccTitle"),tP=v(()=>zf,"getAccTitle"),eP=v(t=>{qf=Hf(t).replace(/\n\s+/g,`
464
- `)},"setAccDescription"),rP=v(()=>qf,"getAccDescription"),nP=v(t=>{Wf=Hf(t)},"setDiagramTitle"),iP=v(()=>Wf,"getDiagramTitle"),Fg=J,sP=Rf,ee=ge,hZ=M1,uZ=Is,Uf=v(t=>Ur(t,ee()),"sanitizeText"),oP=Y4,aP=v(()=>W1,"getCommonDb"),Zl={},Ql=v((t,e,r)=>{var n;Zl[t]&&Fg.warn(`Diagram with id ${t} already registered. Overwriting.`),Zl[t]=e,r&&E1(t,r),K4(t,e.styles),(n=e.injectUtils)==null||n.call(e,Fg,sP,ee,Uf,oP,aP(),()=>{})},"registerDiagram"),Qu=v(t=>{if(t in Zl)return Zl[t];throw new lP(t)},"getDiagram"),_s,lP=(_s=class extends Error{constructor(e){super(`Diagram ${e} not found.`)}},v(_s,"DiagramNotFoundError"),_s),cP={value:()=>{}};function q1(){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 Cl(r)}function Cl(t){this._=t}function hP(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}})}Cl.prototype=q1.prototype={constructor:Cl,on:function(t,e){var r=this._,n=hP(t+"",r),i,s=-1,o=n.length;if(arguments.length<2){for(;++s<o;)if((i=(t=n[s]).type)&&(i=uP(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]=Pg(r[i],t.name,e);else if(e==null)for(i in r)r[i]=Pg(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 Cl(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 uP(t,e){for(var r=0,n=t.length,i;r<n;++r)if((i=t[r]).name===e)return i.value}function Pg(t,e,r){for(var n=0,i=t.length;n<i;++n)if(t[n].name===e){t[n]=cP,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var Ju="http://www.w3.org/1999/xhtml";const Dg={svg:"http://www.w3.org/2000/svg",xhtml:Ju,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Uc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),Dg.hasOwnProperty(e)?{space:Dg[e],local:t}:t}function dP(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===Ju&&e.documentElement.namespaceURI===Ju?e.createElement(t):e.createElementNS(r,t)}}function fP(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function H1(t){var e=Uc(t);return(e.local?fP:dP)(e)}function pP(){}function Gf(t){return t==null?pP:function(){return this.querySelector(t)}}function mP(t){typeof t!="function"&&(t=Gf(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 Sr(n,this._parents)}function gP(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function xP(){return[]}function U1(t){return t==null?xP:function(){return this.querySelectorAll(t)}}function yP(t){return function(){return gP(t.apply(this,arguments))}}function bP(t){typeof t=="function"?t=yP(t):t=U1(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 Sr(n,i)}function G1(t){return function(){return this.matches(t)}}function V1(t){return function(e){return e.matches(t)}}var CP=Array.prototype.find;function kP(t){return function(){return CP.call(this.children,t)}}function vP(){return this.firstElementChild}function wP(t){return this.select(t==null?vP:kP(typeof t=="function"?t:V1(t)))}var SP=Array.prototype.filter;function TP(){return Array.from(this.children)}function _P(t){return function(){return SP.call(this.children,t)}}function EP(t){return this.selectAll(t==null?TP:_P(typeof t=="function"?t:V1(t)))}function NP(t){typeof t!="function"&&(t=G1(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 Sr(n,this._parents)}function Y1(t){return new Array(t.length)}function jP(){return new Sr(this._enter||this._groups.map(Y1),this._parents)}function Jl(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Jl.prototype={constructor:Jl,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function LP(t){return function(){return t}}function BP(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 Jl(t,s[o]);for(;o<l;++o)(a=e[o])&&(i[o]=a)}function AP(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 Jl(t,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(i[a]=l)}function MP(t){return t.__data__}function IP(t,e){if(!arguments.length)return Array.from(this,MP);var r=e?AP:BP,n=this._parents,i=this._groups;typeof t!="function"&&(t=LP(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=FP(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,T,_;b<m;++b)if(T=x[b]){for(b>=k&&(k=b+1);!(_=g[k])&&++k<m;);T._next=_||null}}return o=new Sr(o,n),o._enter=a,o._exit=l,o}function FP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function PP(){return new Sr(this._exit||this._groups.map(Y1),this._parents)}function DP(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 OP(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 Sr(a,this._parents)}function RP(){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 $P(t){t||(t=zP);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 Sr(i,this._parents).order()}function zP(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function WP(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function qP(){return Array.from(this)}function HP(){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 UP(){let t=0;for(const e of this)++t;return t}function GP(){return!this.node()}function VP(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 YP(t){return function(){this.removeAttribute(t)}}function XP(t){return function(){this.removeAttributeNS(t.space,t.local)}}function KP(t,e){return function(){this.setAttribute(t,e)}}function ZP(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function QP(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function JP(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 tD(t,e){var r=Uc(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?XP:YP:typeof e=="function"?r.local?JP:QP:r.local?ZP:KP)(r,e))}function X1(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function eD(t){return function(){this.style.removeProperty(t)}}function rD(t,e,r){return function(){this.style.setProperty(t,e,r)}}function nD(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function iD(t,e,r){return arguments.length>1?this.each((e==null?eD:typeof e=="function"?nD:rD)(t,e,r??"")):Fs(this.node(),t)}function Fs(t,e){return t.style.getPropertyValue(e)||X1(t).getComputedStyle(t,null).getPropertyValue(e)}function sD(t){return function(){delete this[t]}}function oD(t,e){return function(){this[t]=e}}function aD(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function lD(t,e){return arguments.length>1?this.each((e==null?sD:typeof e=="function"?aD:oD)(t,e)):this.node()[t]}function K1(t){return t.trim().split(/^|\s+/)}function Vf(t){return t.classList||new Z1(t)}function Z1(t){this._node=t,this._names=K1(t.getAttribute("class")||"")}Z1.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 Q1(t,e){for(var r=Vf(t),n=-1,i=e.length;++n<i;)r.add(e[n])}function J1(t,e){for(var r=Vf(t),n=-1,i=e.length;++n<i;)r.remove(e[n])}function cD(t){return function(){Q1(this,t)}}function hD(t){return function(){J1(this,t)}}function uD(t,e){return function(){(e.apply(this,arguments)?Q1:J1)(this,t)}}function dD(t,e){var r=K1(t+"");if(arguments.length<2){for(var n=Vf(this.node()),i=-1,s=r.length;++i<s;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof e=="function"?uD:e?cD:hD)(r,e))}function fD(){this.textContent=""}function pD(t){return function(){this.textContent=t}}function mD(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function gD(t){return arguments.length?this.each(t==null?fD:(typeof t=="function"?mD:pD)(t)):this.node().textContent}function xD(){this.innerHTML=""}function yD(t){return function(){this.innerHTML=t}}function bD(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function CD(t){return arguments.length?this.each(t==null?xD:(typeof t=="function"?bD:yD)(t)):this.node().innerHTML}function kD(){this.nextSibling&&this.parentNode.appendChild(this)}function vD(){return this.each(kD)}function wD(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function SD(){return this.each(wD)}function TD(t){var e=typeof t=="function"?t:H1(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function _D(){return null}function ED(t,e){var r=typeof t=="function"?t:H1(t),n=e==null?_D:typeof e=="function"?e:Gf(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function ND(){var t=this.parentNode;t&&t.removeChild(this)}function jD(){return this.each(ND)}function LD(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function BD(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function AD(t){return this.select(t?BD:LD)}function MD(t){return arguments.length?this.property("__data__",t):this.node().__data__}function ID(t){return function(e){t.call(this,e,this.__data__)}}function FD(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 PD(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 DD(t,e,r){return function(){var n=this.__on,i,s=ID(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 OD(t,e,r){var n=FD(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?DD:PD,i=0;i<s;++i)this.each(a(n[i],e,r));return this}function tC(t,e,r){var n=X1(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 RD(t,e){return function(){return tC(this,t,e)}}function $D(t,e){return function(){return tC(this,t,e.apply(this,arguments))}}function zD(t,e){return this.each((typeof e=="function"?$D:RD)(t,e))}function*WD(){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 eC=[null];function Sr(t,e){this._groups=t,this._parents=e}function Ca(){return new Sr([[document.documentElement]],eC)}function qD(){return this}Sr.prototype=Ca.prototype={constructor:Sr,select:mP,selectAll:bP,selectChild:wP,selectChildren:EP,filter:NP,data:IP,enter:jP,exit:PP,join:DP,merge:OP,selection:qD,order:RP,sort:$P,call:WP,nodes:qP,node:HP,size:UP,empty:GP,each:VP,attr:tD,style:iD,property:lD,classed:dD,text:gD,html:CD,raise:vD,lower:SD,append:TD,insert:ED,remove:jD,clone:AD,datum:MD,on:OD,dispatch:zD,[Symbol.iterator]:WD};function Gt(t){return typeof t=="string"?new Sr([[document.querySelector(t)]],[document.documentElement]):new Sr([[t]],eC)}function Yf(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function rC(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function ka(){}var Jo=.7,tc=1/Jo,hs="\\s*([+-]?\\d+)\\s*",ta="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",nn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",HD=/^#([0-9a-f]{3,8})$/,UD=new RegExp(`^rgb\\(${hs},${hs},${hs}\\)$`),GD=new RegExp(`^rgb\\(${nn},${nn},${nn}\\)$`),VD=new RegExp(`^rgba\\(${hs},${hs},${hs},${ta}\\)$`),YD=new RegExp(`^rgba\\(${nn},${nn},${nn},${ta}\\)$`),XD=new RegExp(`^hsl\\(${ta},${nn},${nn}\\)$`),KD=new RegExp(`^hsla\\(${ta},${nn},${nn},${ta}\\)$`),Og={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};Yf(ka,ea,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Rg,formatHex:Rg,formatHex8:ZD,formatHsl:QD,formatRgb:$g,toString:$g});function Rg(){return this.rgb().formatHex()}function ZD(){return this.rgb().formatHex8()}function QD(){return nC(this).formatHsl()}function $g(){return this.rgb().formatRgb()}function ea(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=HD.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?zg(e):r===3?new pr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Ga(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Ga(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=UD.exec(t))?new pr(e[1],e[2],e[3],1):(e=GD.exec(t))?new pr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=VD.exec(t))?Ga(e[1],e[2],e[3],e[4]):(e=YD.exec(t))?Ga(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=XD.exec(t))?Hg(e[1],e[2]/100,e[3]/100,1):(e=KD.exec(t))?Hg(e[1],e[2]/100,e[3]/100,e[4]):Og.hasOwnProperty(t)?zg(Og[t]):t==="transparent"?new pr(NaN,NaN,NaN,0):null}function zg(t){return new pr(t>>16&255,t>>8&255,t&255,1)}function Ga(t,e,r,n){return n<=0&&(t=e=r=NaN),new pr(t,e,r,n)}function JD(t){return t instanceof ka||(t=ea(t)),t?(t=t.rgb(),new pr(t.r,t.g,t.b,t.opacity)):new pr}function td(t,e,r,n){return arguments.length===1?JD(t):new pr(t,e,r,n??1)}function pr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Yf(pr,td,rC(ka,{brighter(t){return t=t==null?tc:Math.pow(tc,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Jo:Math.pow(Jo,t),new pr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new pr(xi(this.r),xi(this.g),xi(this.b),ec(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:Wg,formatHex:Wg,formatHex8:tO,formatRgb:qg,toString:qg}));function Wg(){return`#${pi(this.r)}${pi(this.g)}${pi(this.b)}`}function tO(){return`#${pi(this.r)}${pi(this.g)}${pi(this.b)}${pi((isNaN(this.opacity)?1:this.opacity)*255)}`}function qg(){const t=ec(this.opacity);return`${t===1?"rgb(":"rgba("}${xi(this.r)}, ${xi(this.g)}, ${xi(this.b)}${t===1?")":`, ${t})`}`}function ec(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 Hg(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new $r(t,e,r,n)}function nC(t){if(t instanceof $r)return new $r(t.h,t.s,t.l,t.opacity);if(t instanceof ka||(t=ea(t)),!t)return new $r;if(t instanceof $r)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 $r(o,a,l,t.opacity)}function eO(t,e,r,n){return arguments.length===1?nC(t):new $r(t,e,r,n??1)}function $r(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Yf($r,eO,rC(ka,{brighter(t){return t=t==null?tc:Math.pow(tc,t),new $r(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Jo:Math.pow(Jo,t),new $r(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new pr(Zh(t>=240?t-240:t+120,i,n),Zh(t,i,n),Zh(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new $r(Ug(this.h),Va(this.s),Va(this.l),ec(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=ec(this.opacity);return`${t===1?"hsl(":"hsla("}${Ug(this.h)}, ${Va(this.s)*100}%, ${Va(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Ug(t){return t=(t||0)%360,t<0?t+360:t}function Va(t){return Math.max(0,Math.min(1,t||0))}function Zh(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 Xf=t=>()=>t;function iC(t,e){return function(r){return t+r*e}}function rO(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 dZ(t,e){var r=e-t;return r?iC(t,r>180||r<-180?r-360*Math.round(r/360):r):Xf(isNaN(t)?e:t)}function nO(t){return(t=+t)==1?sC:function(e,r){return r-e?rO(e,r,t):Xf(isNaN(e)?r:e)}}function sC(t,e){var r=e-t;return r?iC(t,r):Xf(isNaN(t)?e:t)}const Gg=(function t(e){var r=nO(e);function n(i,s){var o=r((i=td(i)).r,(s=td(s)).r),a=r(i.g,s.g),l=r(i.b,s.b),c=sC(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 On(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var ed=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qh=new RegExp(ed.source,"g");function iO(t){return function(){return t}}function sO(t){return function(e){return t(e)+""}}function oO(t,e){var r=ed.lastIndex=Qh.lastIndex=0,n,i,s,o=-1,a=[],l=[];for(t=t+"",e=e+"";(n=ed.exec(t))&&(i=Qh.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:On(n,i)})),r=Qh.lastIndex;return r<e.length&&(s=e.slice(r),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?sO(l[0].x):iO(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 Vg=180/Math.PI,rd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oC(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)*Vg,skewX:Math.atan(l)*Vg,scaleX:o,scaleY:a}}var Ya;function aO(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?rd:oC(e.a,e.b,e.c,e.d,e.e,e.f)}function lO(t){return t==null||(Ya||(Ya=document.createElementNS("http://www.w3.org/2000/svg","g")),Ya.setAttribute("transform",t),!(t=Ya.transform.baseVal.consolidate()))?rd:(t=t.matrix,oC(t.a,t.b,t.c,t.d,t.e,t.f))}function aC(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:On(c,d)},{i:x-2,x:On(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:On(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:On(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:On(c,d)},{i:x-2,x:On(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 cO=aC(aO,"px, ","px)","deg)"),hO=aC(lO,", ",")",")"),Ps=0,jo=0,mo=0,lC=1e3,rc,Lo,nc=0,wi=0,Gc=0,ra=typeof performance=="object"&&performance.now?performance:Date,cC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Kf(){return wi||(cC(uO),wi=ra.now()+Gc)}function uO(){wi=0}function ic(){this._call=this._time=this._next=null}ic.prototype=hC.prototype={constructor:ic,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?Kf():+r)+(e==null?0:+e),!this._next&&Lo!==this&&(Lo?Lo._next=this:rc=this,Lo=this),this._call=t,this._time=r,nd()},stop:function(){this._call&&(this._call=null,this._time=1/0,nd())}};function hC(t,e,r){var n=new ic;return n.restart(t,e,r),n}function dO(){Kf(),++Ps;for(var t=rc,e;t;)(e=wi-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ps}function Yg(){wi=(nc=ra.now())+Gc,Ps=jo=0;try{dO()}finally{Ps=0,pO(),wi=0}}function fO(){var t=ra.now(),e=t-nc;e>lC&&(Gc-=e,nc=t)}function pO(){for(var t,e=rc,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:rc=r);Lo=t,nd(n)}function nd(t){if(!Ps){jo&&(jo=clearTimeout(jo));var e=t-wi;e>24?(t<1/0&&(jo=setTimeout(Yg,t-ra.now()-Gc)),mo&&(mo=clearInterval(mo))):(mo||(nc=ra.now(),mo=setInterval(fO,lC)),Ps=1,cC(Yg))}}function Xg(t,e,r){var n=new ic;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var mO=q1("start","end","cancel","interrupt"),gO=[],uC=0,Kg=1,id=2,kl=3,Zg=4,sd=5,vl=6;function Vc(t,e,r,n,i,s){var o=t.__transition;if(!o)t.__transition={};else if(r in o)return;xO(t,r,{name:e,index:n,group:i,on:mO,tween:gO,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:uC})}function Zf(t,e){var r=Vr(t,e);if(r.state>uC)throw new Error("too late; already scheduled");return r}function dn(t,e){var r=Vr(t,e);if(r.state>kl)throw new Error("too late; already running");return r}function Vr(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function xO(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=hC(s,0,r.time);function s(c){r.state=Kg,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!==Kg)return l();for(u in n)if(f=n[u],f.name===r.name){if(f.state===kl)return Xg(o);f.state===Zg?(f.state=vl,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete n[u]):+u<e&&(f.state=vl,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete n[u])}if(Xg(function(){r.state===kl&&(r.state=Zg,r.timer.restart(a,r.delay,r.time),a(c))}),r.state=id,r.on.call("start",t,t.__data__,r.index,r.group),r.state===id){for(r.state=kl,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=sd,1),d=-1,p=i.length;++d<p;)i[d].call(t,u);r.state===sd&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){r.state=vl,r.timer.stop(),delete n[e];for(var c in n)return;delete t.__transition}}function yO(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>id&&n.state<sd,n.state=vl,n.timer.stop(),n.on.call(i?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[o]}s&&delete t.__transition}}function bO(t){return this.each(function(){yO(this,t)})}function CO(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 kO(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 vO(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=Vr(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?CO:kO)(r,t,e))}function Qf(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 Vr(i,n).value[e]}}function dC(t,e){var r;return(typeof e=="number"?On:e instanceof ea?Gg:(r=ea(e))?(e=r,Gg):oO)(t,e)}function wO(t){return function(){this.removeAttribute(t)}}function SO(t){return function(){this.removeAttributeNS(t.space,t.local)}}function TO(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 _O(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 EO(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 NO(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 jO(t,e){var r=Uc(t),n=r==="transform"?hO:dC;return this.attrTween(t,typeof e=="function"?(r.local?NO:EO)(r,n,Qf(this,"attr."+t,e)):e==null?(r.local?SO:wO)(r):(r.local?_O:TO)(r,n,e))}function LO(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function BO(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function AO(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&BO(t,s)),r}return i._value=e,i}function MO(t,e){var r,n;function i(){var s=e.apply(this,arguments);return s!==n&&(r=(n=s)&&LO(t,s)),r}return i._value=e,i}function IO(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=Uc(t);return this.tween(r,(n.local?AO:MO)(n,e))}function FO(t,e){return function(){Zf(this,t).delay=+e.apply(this,arguments)}}function PO(t,e){return e=+e,function(){Zf(this,t).delay=e}}function DO(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?FO:PO)(e,t)):Vr(this.node(),e).delay}function OO(t,e){return function(){dn(this,t).duration=+e.apply(this,arguments)}}function RO(t,e){return e=+e,function(){dn(this,t).duration=e}}function $O(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?OO:RO)(e,t)):Vr(this.node(),e).duration}function zO(t,e){if(typeof e!="function")throw new Error;return function(){dn(this,t).ease=e}}function WO(t){var e=this._id;return arguments.length?this.each(zO(e,t)):Vr(this.node(),e).ease}function qO(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;dn(this,t).ease=r}}function HO(t){if(typeof t!="function")throw new Error;return this.each(qO(this._id,t))}function UO(t){typeof t!="function"&&(t=G1(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 GO(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 VO(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 YO(t,e,r){var n,i,s=VO(e)?Zf:dn;return function(){var o=s(this,t),a=o.on;a!==n&&(i=(n=a).copy()).on(e,r),o.on=i}}function XO(t,e){var r=this._id;return arguments.length<2?Vr(this.node(),r).on.on(t):this.each(YO(r,t,e))}function KO(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function ZO(){return this.on("end.remove",KO(this._id))}function QO(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Gf(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,Vc(c[p],e,r,p,c,Vr(u,r)));return new vn(s,this._parents,e,r)}function JO(t){var e=this._name,r=this._id;typeof t!="function"&&(t=U1(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=Vr(u,r),x=0,g=p.length;x<g;++x)(f=p[x])&&Vc(f,e,r,x,p,m);s.push(p),o.push(u)}return new vn(s,o,e,r)}var tR=Ca.prototype.constructor;function eR(){return new tR(this._groups,this._parents)}function rR(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 fC(t){return function(){this.style.removeProperty(t)}}function nR(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 iR(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 sR(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=fC(e)):void 0;(c!==r||i!==u)&&(n=(r=c).copy()).on(o,i=u),l.on=n}}function oR(t,e,r){var n=(t+="")=="transform"?cO:dC;return e==null?this.styleTween(t,rR(t,n)).on("end.style."+t,fC(t)):typeof e=="function"?this.styleTween(t,iR(t,n,Qf(this,"style."+t,e))).each(sR(this._id,t)):this.styleTween(t,nR(t,n,e),r).on("end.style."+t,null)}function aR(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function lR(t,e,r){var n,i;function s(){var o=e.apply(this,arguments);return o!==i&&(n=(i=o)&&aR(t,o,r)),n}return s._value=e,s}function cR(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,lR(t,e,r??""))}function hR(t){return function(){this.textContent=t}}function uR(t){return function(){var e=t(this);this.textContent=e??""}}function dR(t){return this.tween("text",typeof t=="function"?uR(Qf(this,"text",t)):hR(t==null?"":t+""))}function fR(t){return function(e){this.textContent=t.call(this,e)}}function pR(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&fR(i)),e}return n._value=t,n}function mR(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,pR(t))}function gR(){for(var t=this._name,e=this._id,r=pC(),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=Vr(l,e);Vc(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 xR(){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 yR=0;function vn(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function pC(){return++yR}var gn=Ca.prototype;vn.prototype={constructor:vn,select:QO,selectAll:JO,selectChild:gn.selectChild,selectChildren:gn.selectChildren,filter:UO,merge:GO,selection:eR,transition:gR,call:gn.call,nodes:gn.nodes,node:gn.node,size:gn.size,empty:gn.empty,each:gn.each,on:XO,attr:jO,attrTween:IO,style:oR,styleTween:cR,text:dR,textTween:mR,remove:ZO,tween:vO,delay:DO,duration:$O,ease:WO,easeVarying:HO,end:xR,[Symbol.iterator]:gn[Symbol.iterator]};function bR(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var CR={time:null,delay:0,duration:250,ease:bR};function kR(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 vR(t){var e,r;t instanceof vn?(e=t._id,t=t._name):(e=pC(),(r=CR).time=Kf(),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])&&Vc(l,t,e,c,o,r||kR(l,e));return new vn(n,this._parents,t,e)}Ca.prototype.interrupt=bO;Ca.prototype.transition=vR;const od=Math.PI,ad=2*od,hi=1e-6,wR=ad-hi;function mC(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function SR(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return mC;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 TR{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?mC:SR(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>hi)if(!(Math.abs(d*l-c*u)>hi)||!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((od-Math.acos((x+p-g)/(2*y*b)))/2),T=k/b,_=k/y;Math.abs(T-1)>hi&&this._append`L${e+T*u},${r+T*d}`,this._append`A${s},${s},0,0,${+(d*f>u*m)},${this._x1=e+_*l},${this._y1=r+_*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)>hi||Math.abs(this._y1-u)>hi)&&this._append`L${c},${u}`,n&&(p<0&&(p=p%ad+ad),p>wR?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>hi&&this._append`A${n},${n},0,${+(p>=od)},${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 fZ=Math.abs,pZ=Math.atan2,mZ=Math.cos,gZ=Math.max,xZ=Math.min,yZ=Math.sin,bZ=Math.sqrt,Qg=1e-12,Jf=Math.PI,Jg=Jf/2,CZ=2*Jf;function kZ(t){return t>1?0:t<-1?Jf:Math.acos(t)}function vZ(t){return t>=1?Jg:t<=-1?-Jg:Math.asin(t)}function _R(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 TR(e)}function ER(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function gC(t){this._context=t}gC.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 Ho(t){return new gC(t)}function NR(t){return t[0]}function jR(t){return t[1]}function LR(t,e){var r=qi(!0),n=null,i=Ho,s=null,o=_R(a);t=typeof t=="function"?t:t===void 0?NR:qi(t),e=typeof e=="function"?e:e===void 0?jR:qi(e);function a(l){var c,u=(l=ER(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 xC{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 yC(t){return new xC(t,!0)}function bC(t){return new xC(t,!1)}function Gn(){}function sc(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 Yc(t){this._context=t}Yc.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:sc(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:sc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function ld(t){return new Yc(t)}function CC(t){this._context=t}CC.prototype={areaStart:Gn,areaEnd:Gn,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:sc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function BR(t){return new CC(t)}function kC(t){this._context=t}kC.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:sc(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function AR(t){return new kC(t)}function vC(t,e){this._basis=new Yc(t),this._beta=e}vC.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 MR=(function t(e){function r(n){return e===1?new Yc(n):new vC(n,e)}return r.beta=function(n){return t(+n)},r})(.85);function oc(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function tp(t,e){this._context=t,this._k=(1-e)/6}tp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:oc(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:oc(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 wC=(function t(e){function r(n){return new tp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function ep(t,e){this._context=t,this._k=(1-e)/6}ep.prototype={areaStart:Gn,areaEnd:Gn,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:oc(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 IR=(function t(e){function r(n){return new ep(n,e)}return r.tension=function(n){return t(+n)},r})(0);function rp(t,e){this._context=t,this._k=(1-e)/6}rp.prototype={areaStart: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:oc(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 FR=(function t(e){function r(n){return new rp(n,e)}return r.tension=function(n){return t(+n)},r})(0);function np(t,e,r){var n=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>Qg){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>Qg){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 SC(t,e){this._context=t,this._alpha=e}SC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:np(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const TC=(function t(e){function r(n){return e?new SC(n,e):new tp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function _C(t,e){this._context=t,this._alpha=e}_C.prototype={areaStart:Gn,areaEnd:Gn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:np(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const PR=(function t(e){function r(n){return e?new _C(n,e):new ep(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function EC(t,e){this._context=t,this._alpha=e}EC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:np(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const DR=(function t(e){function r(n){return e?new EC(n,e):new rp(n,0)}return r.alpha=function(n){return t(+n)},r})(.5);function NC(t){this._context=t}NC.prototype={areaStart:Gn,areaEnd:Gn,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 OR(t){return new NC(t)}function tx(t){return t<0?-1:1}function ex(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(tx(s)+tx(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function rx(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Jh(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 ac(t){this._context=t}ac.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:Jh(this,this._t0,rx(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,Jh(this,rx(this,r=ex(this,t,e)),r);break;default:Jh(this,this._t0,r=ex(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function jC(t){this._context=new LC(t)}(jC.prototype=Object.create(ac.prototype)).point=function(t,e){ac.prototype.point.call(this,e,t)};function LC(t){this._context=t}LC.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 BC(t){return new ac(t)}function AC(t){return new jC(t)}function MC(t){this._context=t}MC.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=nx(t),i=nx(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 nx(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 IC(t){return new MC(t)}function Xc(t,e){this._context=t,this._t=e}Xc.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 FC(t){return new Xc(t,.5)}function PC(t){return new Xc(t,0)}function DC(t){return new Xc(t,1)}function Bo(t,e,r){this.k=t,this.x=e,this.y=r}Bo.prototype={constructor:Bo,scale:function(t){return t===1?this:new Bo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Bo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Bo.prototype;var RR=v(t=>{var i;const{securityLevel:e}=ee();let r=Gt("body");if(e==="sandbox"){const o=((i=Gt(`#i${t}`).node())==null?void 0:i.contentDocument)??document;r=Gt(o.body)}return r.select(`#${t}`)},"selectSvgElement");function ip(t){return typeof t>"u"||t===null}v(ip,"isNothing");function OC(t){return typeof t=="object"&&t!==null}v(OC,"isObject");function RC(t){return Array.isArray(t)?t:ip(t)?[]:[t]}v(RC,"toArray");function $C(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($C,"extend");function zC(t,e){var r="",n;for(n=0;n<e;n+=1)r+=t;return r}v(zC,"repeat");function WC(t){return t===0&&Number.NEGATIVE_INFINITY===1/t}v(WC,"isNegativeZero");var $R=ip,zR=OC,WR=RC,qR=zC,HR=WC,UR=$C,Fe={isNothing:$R,isObject:zR,toArray:WR,repeat:qR,isNegativeZero:HR,extend:UR};function sp(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+=`
465
-
466
- `+t.mark.snippet),n+" "+r):n}v(sp,"formatError");function Ds(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=sp(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+": "+sp(this,e)},"toString");var fr=Ds;function wl(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(wl,"getLine");function Sl(t,e){return Fe.repeat(" ",e-t.length)+t}v(Sl,"padStart");function qC(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=wl(t.buffer,n[o-l],i[o-l],t.position-(n[o]-n[o-l]),d),a=Fe.repeat(" ",e.indent)+Sl((t.line-l+1).toString(),u)+" | "+c.str+`
467
- `+a;for(c=wl(t.buffer,n[o],i[o],t.position,d),a+=Fe.repeat(" ",e.indent)+Sl((t.line+1).toString(),u)+" | "+c.str+`
468
- `,a+=Fe.repeat("-",e.indent+u+3+c.pos)+`^
469
- `,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=wl(t.buffer,n[o+l],i[o+l],t.position-(n[o]-n[o+l]),d),a+=Fe.repeat(" ",e.indent)+Sl((t.line+l+1).toString(),u)+" | "+c.str+`
470
- `;return a.replace(/\n$/,"")}v(qC,"makeSnippet");var GR=qC,VR=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],YR=["scalar","sequence","mapping"];function HC(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}v(HC,"compileStyleAliases");function UC(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(VR.indexOf(r)===-1)throw new fr('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=HC(e.styleAliases||null),YR.indexOf(this.kind)===-1)throw new fr('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}v(UC,"Type$1");var Ye=UC;function cd(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(cd,"compileList");function GC(){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(GC,"compileMap");function lc(t){return this.extend(t)}v(lc,"Schema$1");lc.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Ye)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new fr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(s){if(!(s instanceof Ye))throw new fr("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new fr("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 fr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof Ye))throw new fr("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(lc.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=cd(i,"implicit"),i.compiledExplicit=cd(i,"explicit"),i.compiledTypeMap=GC(i.compiledImplicit,i.compiledExplicit),i},"extend");var XR=lc,KR=new Ye("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),ZR=new Ye("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),QR=new Ye("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),JR=new XR({explicit:[KR,ZR,QR]});function VC(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}v(VC,"resolveYamlNull");function YC(){return null}v(YC,"constructYamlNull");function XC(t){return t===null}v(XC,"isNull");var t$=new Ye("tag:yaml.org,2002:null",{kind:"scalar",resolve:VC,construct:YC,predicate:XC,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 KC(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(KC,"resolveYamlBoolean");function ZC(t){return t==="true"||t==="True"||t==="TRUE"}v(ZC,"constructYamlBoolean");function QC(t){return Object.prototype.toString.call(t)==="[object Boolean]"}v(QC,"isBoolean");var e$=new Ye("tag:yaml.org,2002:bool",{kind:"scalar",resolve:KC,construct:ZC,predicate:QC,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 JC(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}v(JC,"isHexCode");function tk(t){return 48<=t&&t<=55}v(tk,"isOctCode");function ek(t){return 48<=t&&t<=57}v(ek,"isDecCode");function rk(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(!JC(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(r++;r<e;r++)if(i=t[r],i!=="_"){if(!tk(t.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;r<e;r++)if(i=t[r],i!=="_"){if(!ek(t.charCodeAt(r)))return!1;n=!0}return!(!n||i==="_")}v(rk,"resolveYamlInteger");function nk(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(nk,"constructYamlInteger");function ik(t){return Object.prototype.toString.call(t)==="[object Number]"&&t%1===0&&!Fe.isNegativeZero(t)}v(ik,"isInteger");var r$=new Ye("tag:yaml.org,2002:int",{kind:"scalar",resolve:rk,construct:nk,predicate:ik,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"]}}),n$=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function sk(t){return!(t===null||!n$.test(t)||t[t.length-1]==="_")}v(sk,"resolveYamlFloat");function ok(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(ok,"constructYamlFloat");var i$=/^[-+]?[0-9]+e/;function ak(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),i$.test(r)?r.replace("e",".e"):r}v(ak,"representYamlFloat");function lk(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Fe.isNegativeZero(t))}v(lk,"isFloat");var s$=new Ye("tag:yaml.org,2002:float",{kind:"scalar",resolve:sk,construct:ok,predicate:lk,represent:ak,defaultStyle:"lowercase"}),ck=JR.extend({implicit:[t$,e$,r$,s$]}),o$=ck,hk=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),uk=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 dk(t){return t===null?!1:hk.exec(t)!==null||uk.exec(t)!==null}v(dk,"resolveYamlTimestamp");function fk(t){var e,r,n,i,s,o,a,l=0,c=null,u,d,p;if(e=hk.exec(t),e===null&&(e=uk.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(fk,"constructYamlTimestamp");function pk(t){return t.toISOString()}v(pk,"representYamlTimestamp");var a$=new Ye("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:dk,construct:fk,instanceOf:Date,represent:pk});function mk(t){return t==="<<"||t===null}v(mk,"resolveYamlMerge");var l$=new Ye("tag:yaml.org,2002:merge",{kind:"scalar",resolve:mk}),op=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
471
- \r`;function gk(t){if(t===null)return!1;var e,r,n=0,i=t.length,s=op;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(gk,"resolveYamlBinary");function xk(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,s=op,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(xk,"constructYamlBinary");function yk(t){var e="",r=0,n,i,s=t.length,o=op;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(yk,"representYamlBinary");function bk(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}v(bk,"isBinary");var c$=new Ye("tag:yaml.org,2002:binary",{kind:"scalar",resolve:gk,construct:xk,predicate:bk,represent:yk}),h$=Object.prototype.hasOwnProperty,u$=Object.prototype.toString;function Ck(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,u$.call(i)!=="[object Object]")return!1;for(s in i)if(h$.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(Ck,"resolveYamlOmap");function kk(t){return t!==null?t:[]}v(kk,"constructYamlOmap");var d$=new Ye("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Ck,construct:kk}),f$=Object.prototype.toString;function vk(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],f$.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}v(vk,"resolveYamlPairs");function wk(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(wk,"constructYamlPairs");var p$=new Ye("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:vk,construct:wk}),m$=Object.prototype.hasOwnProperty;function Sk(t){if(t===null)return!0;var e,r=t;for(e in r)if(m$.call(r,e)&&r[e]!==null)return!1;return!0}v(Sk,"resolveYamlSet");function Tk(t){return t!==null?t:{}}v(Tk,"constructYamlSet");var g$=new Ye("tag:yaml.org,2002:set",{kind:"mapping",resolve:Sk,construct:Tk}),_k=o$.extend({implicit:[a$,l$],explicit:[c$,d$,p$,g$]}),Vn=Object.prototype.hasOwnProperty,cc=1,Ek=2,Nk=3,hc=4,tu=1,x$=2,ix=3,y$=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,b$=/[\x85\u2028\u2029]/,C$=/[,\[\]\{\}]/,jk=/^(?:!|!!|![a-z\-]+!)$/i,Lk=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function hd(t){return Object.prototype.toString.call(t)}v(hd,"_class");function qr(t){return t===10||t===13}v(qr,"is_EOL");function Wn(t){return t===9||t===32}v(Wn,"is_WHITE_SPACE");function tr(t){return t===9||t===32||t===10||t===13}v(tr,"is_WS_OR_EOL");function mi(t){return t===44||t===91||t===93||t===123||t===125}v(mi,"is_FLOW_INDICATOR");function Bk(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}v(Bk,"fromHexCode");function Ak(t){return t===120?2:t===117?4:t===85?8:0}v(Ak,"escapedHexLen");function Mk(t){return 48<=t&&t<=57?t-48:-1}v(Mk,"fromDecimalCode");function ud(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?`
472
- `: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(ud,"simpleEscapeSequence");function Ik(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}v(Ik,"charFromCodepoint");function ap(t,e,r){e==="__proto__"?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r}v(ap,"setProperty");var Fk=new Array(256),Pk=new Array(256);for(ai=0;ai<256;ai++)Fk[ai]=ud(ai)?1:0,Pk[ai]=ud(ai);var ai;function Dk(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||_k,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(Dk,"State$1");function lp(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=GR(r),new fr(e,r)}v(lp,"generateError");function Nt(t,e){throw lp(t,e)}v(Nt,"throwError");function na(t,e){t.onWarning&&t.onWarning.call(null,lp(t,e))}v(na,"throwWarning");var sx={YAML:v(function(e,r,n){var i,s,o;e.version!==null&&Nt(e,"duplication of %YAML directive"),n.length!==1&&Nt(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Nt(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Nt(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&na(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,s;n.length!==2&&Nt(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],jk.test(i)||Nt(e,"ill-formed tag handle (first argument) of the TAG directive"),Vn.call(e.tagMap,i)&&Nt(e,'there is a previously declared suffix for "'+i+'" tag handle'),Lk.test(s)||Nt(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Nt(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||Nt(t,"expected valid JSON character");else y$.test(a)&&Nt(t,"the stream contains non-printable characters");t.result+=a}}v(Cn,"captureSegment");function dd(t,e,r,n){var i,s,o,a;for(Fe.isObject(r)||Nt(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],Vn.call(e,s)||(ap(e,s,r[s]),n[s]=!0)}v(dd,"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])&&Nt(t,"nested arrays are not supported inside keys"),typeof i=="object"&&hd(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&hd(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)dd(t,e,s[c],r);else dd(t,e,s,r);else!t.json&&!Vn.call(r,i)&&Vn.call(e,i)&&(t.line=o||t.line,t.lineStart=a||t.lineStart,t.position=l||t.position,Nt(t,"duplicated mapping key")),ap(e,i,s),delete r[i];return e}v(gi,"storeMappingPair");function Kc(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++):Nt(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}v(Kc,"readLineBreak");function Ee(t,e,r){for(var n=0,i=t.input.charCodeAt(t.position);i!==0;){for(;Wn(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(qr(i))for(Kc(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&&na(t,"deficient indentation"),n}v(Ee,"skipSeparationSpace");function va(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||tr(r)))}v(va,"testDocumentSeparator");function Zc(t,e){e===1?t.result+=" ":e>1&&(t.result+=Fe.repeat(`
473
- `,e-1))}v(Zc,"writeFoldedLines");function Ok(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),tr(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),tr(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),tr(i)||r&&mi(i))break}else if(f===35){if(n=t.input.charCodeAt(t.position-1),tr(n))break}else{if(t.position===t.lineStart&&va(t)||r&&mi(f))break;if(qr(f))if(l=t.line,c=t.lineStart,u=t.lineIndent,Ee(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),Zc(t,t.line-l),s=o=t.position,a=!1),Wn(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(Ok,"readPlainScalar");function Rk(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 qr(r)?(Cn(t,n,i,!0),Zc(t,Ee(t,!1,e)),n=i=t.position):t.position===t.lineStart&&va(t)?Nt(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);Nt(t,"unexpected end of the stream within a single quoted scalar")}v(Rk,"readSingleQuotedScalar");function $k(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),qr(a))Ee(t,!1,e);else if(a<256&&Fk[a])t.result+=Pk[a],t.position++;else if((o=Ak(a))>0){for(i=o,s=0;i>0;i--)a=t.input.charCodeAt(++t.position),(o=Bk(a))>=0?s=(s<<4)+o:Nt(t,"expected hexadecimal character");t.result+=Ik(s),t.position++}else Nt(t,"unknown escape sequence");r=n=t.position}else qr(a)?(Cn(t,r,n,!0),Zc(t,Ee(t,!1,e)),r=n=t.position):t.position===t.lineStart&&va(t)?Nt(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}Nt(t,"unexpected end of the stream within a double quoted scalar")}v($k,"readDoubleQuotedScalar");function zk(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(Ee(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&&Nt(t,"expected the node content, but found ','"):Nt(t,"missed comma between flow collection entries"),g=x=y=null,d=p=!1,b===63&&(c=t.input.charCodeAt(t.position+1),tr(c)&&(d=p=!0,t.position++,Ee(t,!0,e))),n=t.line,i=t.lineStart,s=t.position,Si(t,e,cc,!1,!0),g=t.tag,x=t.result,Ee(t,!0,e),b=t.input.charCodeAt(t.position),(p||t.line===n)&&b===58&&(d=!0,b=t.input.charCodeAt(++t.position),Ee(t,!0,e),Si(t,e,cc,!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),Ee(t,!0,e),b=t.input.charCodeAt(t.position),b===44?(r=!0,b=t.input.charCodeAt(++t.position)):r=!1}Nt(t,"unexpected end of the stream within a flow collection")}v(zk,"readFlowCollection");function Wk(t,e){var r,n,i=tu,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)tu===i?i=d===43?ix:x$:Nt(t,"repeat of a chomping mode identifier");else if((u=Mk(d))>=0)u===0?Nt(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Nt(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(Wn(d)){do d=t.input.charCodeAt(++t.position);while(Wn(d));if(d===35)do d=t.input.charCodeAt(++t.position);while(!qr(d)&&d!==0)}for(;d!==0;){for(Kc(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),qr(d)){l++;continue}if(t.lineIndent<a){i===ix?t.result+=Fe.repeat(`
474
- `,s?1+l:l):i===tu&&s&&(t.result+=`
475
- `);break}for(n?Wn(d)?(c=!0,t.result+=Fe.repeat(`
476
- `,s?1+l:l)):c?(c=!1,t.result+=Fe.repeat(`
477
- `,l+1)):l===0?s&&(t.result+=" "):t.result+=Fe.repeat(`
478
- `,l):t.result+=Fe.repeat(`
479
- `,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!qr(d)&&d!==0;)d=t.input.charCodeAt(++t.position);Cn(t,r,t.position,!1)}return!0}v(Wk,"readBlockScalar");function fd(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,Nt(t,"tab characters must not be used in indentation")),!(l!==45||(o=t.input.charCodeAt(t.position+1),!tr(o))));){if(a=!0,t.position++,Ee(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,Si(t,e,Nk,!1,!0),s.push(t.result),Ee(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)Nt(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(fd,"readBlockSequence");function qk(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,Nt(t,"tab characters must not be used in indentation")),n=t.input.charCodeAt(t.position+1),s=t.line,(b===63||b===58)&&tr(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):Nt(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,Ek,!1,!0))break;if(t.line===s){for(b=t.input.charCodeAt(t.position);Wn(b);)b=t.input.charCodeAt(++t.position);if(b===58)b=t.input.charCodeAt(++t.position),tr(b)||Nt(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)Nt(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=c,t.anchor=u,!0}else if(y)Nt(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,hc,!0,i)&&(g?m=t.result:x=t.result),g||(gi(t,d,p,f,m,x,o,a,l),f=m=x=null),Ee(t,!0,-1),b=t.input.charCodeAt(t.position)),(t.line===s||t.lineIndent>e)&&b!==0)Nt(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(qk,"readBlockMapping");function Hk(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&&Nt(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)):Nt(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!tr(o);)o===33&&(n?Nt(t,"tag suffix cannot contain exclamation marks"):(i=t.input.slice(e-1,t.position+1),jk.test(i)||Nt(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),C$.test(s)&&Nt(t,"tag suffix cannot contain flow indicator characters")}s&&!Lk.test(s)&&Nt(t,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Nt(t,"tag name is malformed: "+s)}return r?t.tag=s:Vn.call(t.tagMap,i)?t.tag=t.tagMap[i]+s:i==="!"?t.tag="!"+s:i==="!!"?t.tag="tag:yaml.org,2002:"+s:Nt(t,'undeclared tag handle "'+i+'"'),!0}v(Hk,"readTagProperty");function Uk(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&Nt(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!tr(r)&&!mi(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&Nt(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}v(Uk,"readAnchorProperty");function Gk(t){var e,r,n;if(n=t.input.charCodeAt(t.position),n!==42)return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;n!==0&&!tr(n)&&!mi(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&Nt(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),Vn.call(t.anchorMap,r)||Nt(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],Ee(t,!0,-1),!0}v(Gk,"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=hc===r||Nk===r,n&&Ee(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;Hk(t)||Uk(t);)Ee(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||hc===r)&&(cc===r||Ek===r?x=e:x=e+1,g=t.position-t.lineStart,l===1?a&&(fd(t,g)||qk(t,g,x))||zk(t,x)?u=!0:(o&&Wk(t,x)||Rk(t,x)||$k(t,x)?u=!0:Gk(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&Nt(t,"alias node should not have any properties")):Ok(t,x,cc===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&fd(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"&&Nt(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(Vn.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||Nt(t,"unknown tag !<"+t.tag+">"),t.result!==null&&m.kind!==t.kind&&Nt(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)):Nt(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 Vk(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&&(Ee(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||o!==37));){for(s=!0,o=t.input.charCodeAt(++t.position),r=t.position;o!==0&&!tr(o);)o=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&Nt(t,"directive name must not be less than one character in length");o!==0;){for(;Wn(o);)o=t.input.charCodeAt(++t.position);if(o===35){do o=t.input.charCodeAt(++t.position);while(o!==0&&!qr(o));break}if(qr(o))break;for(r=t.position;o!==0&&!tr(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}o!==0&&Kc(t),Vn.call(sx,n)?sx[n](t,n,i):na(t,'unknown document directive "'+n+'"')}if(Ee(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,Ee(t,!0,-1)):s&&Nt(t,"directives end mark is expected"),Si(t,t.lineIndent-1,hc,!1,!0),Ee(t,!0,-1),t.checkLineBreaks&&b$.test(t.input.slice(e,t.position))&&na(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&va(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,Ee(t,!0,-1));return}if(t.position<t.length-1)Nt(t,"end of the stream or a document separator is expected");else return}v(Vk,"readDocument");function cp(t,e){t=String(t),e=e||{},t.length!==0&&(t.charCodeAt(t.length-1)!==10&&t.charCodeAt(t.length-1)!==13&&(t+=`
480
- `),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new Dk(t,e),n=t.indexOf("\0");for(n!==-1&&(r.position=n,Nt(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;)Vk(r);return r.documents}v(cp,"loadDocuments");function k$(t,e,r){e!==null&&typeof e=="object"&&typeof r>"u"&&(r=e,e=null);var n=cp(t,r);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}v(k$,"loadAll$1");function Yk(t,e){var r=cp(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new fr("expected a single document in the stream, but found more")}}v(Yk,"load$1");var v$=Yk,w$={load:v$},Xk=Object.prototype.toString,Kk=Object.prototype.hasOwnProperty,hp=65279,S$=9,ia=10,T$=13,_$=32,E$=33,N$=34,pd=35,j$=37,L$=38,B$=39,A$=42,Zk=44,M$=45,uc=58,I$=61,F$=62,P$=63,D$=64,Qk=91,Jk=93,O$=96,tv=123,R$=124,ev=125,Ke={};Ke[0]="\\0";Ke[7]="\\a";Ke[8]="\\b";Ke[9]="\\t";Ke[10]="\\n";Ke[11]="\\v";Ke[12]="\\f";Ke[13]="\\r";Ke[27]="\\e";Ke[34]='\\"';Ke[92]="\\\\";Ke[133]="\\N";Ke[160]="\\_";Ke[8232]="\\L";Ke[8233]="\\P";var $$=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],z$=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function rv(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&&Kk.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}v(rv,"compileStyleMap");function nv(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 fr("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Fe.repeat("0",n-e.length)+e}v(nv,"encodeHex");var W$=1,sa=2;function iv(t){this.schema=t.schema||_k,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=rv(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==='"'?sa:W$,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(iv,"State");function md(t,e){for(var r=Fe.repeat(" ",e),n=0,i=-1,s="",o,a=t.length;n<a;)i=t.indexOf(`
481
- `,n),i===-1?(o=t.slice(n),n=a):(o=t.slice(n,i+1),n=i+1),o.length&&o!==`
482
- `&&(s+=r),s+=o;return s}v(md,"indentString");function dc(t,e){return`
483
- `+Fe.repeat(" ",t.indent*e)}v(dc,"generateNextLine");function sv(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(sv,"testImplicitResolving");function oa(t){return t===_$||t===S$}v(oa,"isWhitespace");function Os(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==hp||65536<=t&&t<=1114111}v(Os,"isPrintable");function gd(t){return Os(t)&&t!==hp&&t!==T$&&t!==ia}v(gd,"isNsCharOrWhitespace");function xd(t,e,r){var n=gd(t),i=n&&!oa(t);return(r?n:n&&t!==Zk&&t!==Qk&&t!==Jk&&t!==tv&&t!==ev)&&t!==pd&&!(e===uc&&!i)||gd(e)&&!oa(e)&&t===pd||e===uc&&i}v(xd,"isPlainSafe");function ov(t){return Os(t)&&t!==hp&&!oa(t)&&t!==M$&&t!==P$&&t!==uc&&t!==Zk&&t!==Qk&&t!==Jk&&t!==tv&&t!==ev&&t!==pd&&t!==L$&&t!==A$&&t!==E$&&t!==R$&&t!==I$&&t!==F$&&t!==B$&&t!==N$&&t!==j$&&t!==D$&&t!==O$}v(ov,"isPlainSafeFirst");function av(t){return!oa(t)&&t!==uc}v(av,"isPlainSafeLast");function is(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(is,"codePointAt");function up(t){var e=/^\n* /;return e.test(t)}v(up,"needIndentIndicator");var lv=1,yd=2,cv=3,hv=4,es=5;function uv(t,e,r,n,i,s,o,a){var l,c=0,u=null,d=!1,p=!1,f=n!==-1,m=-1,x=ov(is(t,0))&&av(is(t,t.length-1));if(e||o)for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=is(t,l),!Os(c))return es;x=x&&xd(c,u,a),u=c}else{for(l=0;l<t.length;c>=65536?l+=2:l++){if(c=is(t,l),c===ia)d=!0,f&&(p=p||l-m-1>n&&t[m+1]!==" ",m=l);else if(!Os(c))return es;x=x&&xd(c,u,a),u=c}p=p||f&&l-m-1>n&&t[m+1]!==" "}return!d&&!p?x&&!o&&!i(t)?lv:s===sa?es:yd:r>9&&up(t)?es:o?s===sa?es:yd:p?hv:cv}v(uv,"chooseScalarStyle");function dv(t,e,r,n,i){t.dump=(function(){if(e.length===0)return t.quotingType===sa?'""':"''";if(!t.noCompatMode&&($$.indexOf(e)!==-1||z$.test(e)))return t.quotingType===sa?'"'+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 sv(t,c)}switch(v(l,"testAmbiguity"),uv(e,a,t.indent,o,l,t.quotingType,t.forceQuotes&&!n,i)){case lv:return e;case yd:return"'"+e.replace(/'/g,"''")+"'";case cv:return"|"+bd(e,t.indent)+Cd(md(e,s));case hv:return">"+bd(e,t.indent)+Cd(md(fv(e,o),s));case es:return'"'+pv(e)+'"';default:throw new fr("impossible error: invalid scalar style")}})()}v(dv,"writeScalar");function bd(t,e){var r=up(t)?String(e):"",n=t[t.length-1]===`
484
- `,i=n&&(t[t.length-2]===`
485
- `||t===`
486
- `),s=i?"+":n?"":"-";return r+s+`
487
- `}v(bd,"blockHeader");function Cd(t){return t[t.length-1]===`
488
- `?t.slice(0,-1):t}v(Cd,"dropEndingNewline");function fv(t,e){for(var r=/(\n+)([^\n]*)/g,n=(function(){var c=t.indexOf(`
489
- `);return c=c!==-1?c:t.length,r.lastIndex=c,kd(t.slice(0,c),e)})(),i=t[0]===`
490
- `||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
491
- `:"")+kd(l,e),i=s}return n}v(fv,"foldString");function kd(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+=`
492
- `+t.slice(i,s),i=s+1),o=a;return l+=`
493
- `,t.length-i>e&&o>i?l+=t.slice(i,o)+`
494
- `+t.slice(o+1):l+=t.slice(i),l.slice(1)}v(kd,"foldLine");function pv(t){for(var e="",r=0,n,i=0;i<t.length;r>=65536?i+=2:i++)r=is(t,i),n=Ke[r],!n&&Os(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||nv(r);return e}v(pv,"escapeString");function mv(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(mv,"writeFlowSequence");function vd(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+=dc(t,e)),t.dump&&ia===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=s,t.dump=i||"[]"}v(vd,"writeBlockSequence");function gv(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(gv,"writeFlowMapping");function xv(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 fr("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)p="",(!n||i!=="")&&(p+=dc(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&&ia===t.dump.charCodeAt(0)?p+="?":p+="? "),p+=t.dump,d&&(p+=dc(t,e)),on(t,e+1,u,!0,d)&&(t.dump&&ia===t.dump.charCodeAt(0)?p+=":":p+=": ",p+=t.dump,i+=p));t.tag=s,t.dump=i||"{}"}v(xv,"writeBlockMapping");function wd(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,Xk.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(Kk.call(a.represent,l))n=a.represent[l](e,l);else throw new fr("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}v(wd,"detectType");function on(t,e,r,n,i,s,o){t.tag=null,t.dump=r,wd(t,r,!1)||wd(t,r,!0);var a=Xk.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?(xv(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(gv(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?vd(t,e-1,t.dump,i):vd(t,e,t.dump,i),p&&(t.dump="&ref_"+d+t.dump)):(mv(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&dv(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new fr("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 yv(t,e){var r=[],n=[],i,s;for(fc(t,r,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(r[n[i]]);e.usedDuplicates=new Array(s)}v(yv,"getDuplicateReferences");function fc(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)fc(t[i],e,r);else for(n=Object.keys(t),i=0,s=n.length;i<s;i+=1)fc(t[n[i]],e,r)}v(fc,"inspectNode");function q$(t,e){e=e||{};var r=new iv(e);r.noRefs||yv(t,r);var n=t;return r.replacer&&(n=r.replacer.call({"":n},"",n)),on(r,0,n,!0,!0)?r.dump+`
495
- `:""}v(q$,"dump$1");function H$(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(H$,"renamed");var U$=ck,G$=w$.load;/*! Bundled license information:
496
-
497
- js-yaml/dist/js-yaml.mjs:
498
- (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
499
- */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"),Ue={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},ox={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};function Ao(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=pe(t),e=pe(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(Ao,"calculateDeltaAndAngle");var pe=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),V$=v(t=>({x:v(function(e,r,n){let i=0;const s=pe(n[0]).x<pe(n[n.length-1]).x?"left":"right";if(r===0&&Object.hasOwn(Ue,t.arrowTypeStart)){const{angle:f,deltaX:m}=Ao(n[0],n[1]);i=Ue[t.arrowTypeStart]*Math.cos(f)*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ue,t.arrowTypeEnd)){const{angle:f,deltaX:m}=Ao(n[n.length-1],n[n.length-2]);i=Ue[t.arrowTypeEnd]*Math.cos(f)*(m>=0?1:-1)}const o=Math.abs(pe(e).x-pe(n[n.length-1]).x),a=Math.abs(pe(e).y-pe(n[n.length-1]).y),l=Math.abs(pe(e).x-pe(n[0]).x),c=Math.abs(pe(e).y-pe(n[0]).y),u=Ue[t.arrowTypeStart],d=Ue[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 pe(e).x+i},"x"),y:v(function(e,r,n){let i=0;const s=pe(n[0]).y<pe(n[n.length-1]).y?"down":"up";if(r===0&&Object.hasOwn(Ue,t.arrowTypeStart)){const{angle:f,deltaY:m}=Ao(n[0],n[1]);i=Ue[t.arrowTypeStart]*Math.abs(Math.sin(f))*(m>=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(Ue,t.arrowTypeEnd)){const{angle:f,deltaY:m}=Ao(n[n.length-1],n[n.length-2]);i=Ue[t.arrowTypeEnd]*Math.abs(Math.sin(f))*(m>=0?1:-1)}const o=Math.abs(pe(e).y-pe(n[n.length-1]).y),a=Math.abs(pe(e).x-pe(n[n.length-1]).x),l=Math.abs(pe(e).y-pe(n[0]).y),c=Math.abs(pe(e).x-pe(n[0]).x),u=Ue[t.arrowTypeStart],d=Ue[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 pe(e).y+i},"y")}),"getLineFunctionsWithOffset"),Xa={},Me={},ax;function Y$(){return ax||(ax=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 lx;function X$(){if(lx)return Xa;lx=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.sanitizeUrl=s;var t=Y$();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 Xa}var K$=X$();function Z$(t){return Number.isSafeInteger(t)&&t>=0}function bv(t){return t!=null&&typeof t!="function"&&Z$(t.length)}function Q$(t){return t==="__proto__"}function dp(t){return t==null||typeof t!="object"&&typeof t!="function"}function Cv(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function fp(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const J$="[object RegExp]",kv="[object String]",vv="[object Number]",wv="[object Boolean]",Sv="[object Arguments]",t6="[object Symbol]",e6="[object Date]",r6="[object Map]",n6="[object Set]",i6="[object Array]",s6="[object ArrayBuffer]",Tv="[object Object]",o6="[object DataView]",a6="[object Uint8Array]",l6="[object Uint8ClampedArray]",c6="[object Uint16Array]",h6="[object Uint32Array]",u6="[object Int8Array]",d6="[object Int16Array]",f6="[object Int32Array]",p6="[object Float32Array]",m6="[object Float64Array]",cx=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();function pp(t){return typeof cx.Buffer<"u"&&cx.Buffer.isBuffer(t)}function mp(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function g6(t,e){return ss(t,void 0,t,new Map,e)}function ss(t,e,r,n=new Map,i=void 0){const s=i==null?void 0:i(t,e,r,n);if(s!==void 0)return s;if(dp(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){const o=new Array(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=ss(t[a],a,r,n,i);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;n.set(t,o);for(const[a,l]of t)o.set(a,ss(l,a,r,n,i));return o}if(t instanceof Set){const o=new Set;n.set(t,o);for(const a of t)o.add(ss(a,void 0,r,n,i));return o}if(pp(t))return t.subarray();if(mp(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,o);for(let a=0;a<t.length;a++)o[a]=ss(t[a],a,r,n,i);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return n.set(t,o),Dr(o,t,r,n,i),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return n.set(t,o),Dr(o,t,r,n,i),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return n.set(t,o),Dr(o,t,r,n,i),o}if(t instanceof Error){const o=structuredClone(t);return n.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,o.constructor=t.constructor,Dr(o,t,r,n,i),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return n.set(t,o),Dr(o,t,r,n,i),o}if(t instanceof Number){const o=new Number(t.valueOf());return n.set(t,o),Dr(o,t,r,n,i),o}if(t instanceof String){const o=new String(t.valueOf());return n.set(t,o),Dr(o,t,r,n,i),o}if(typeof t=="object"&&x6(t)){const o=Object.create(Object.getPrototypeOf(t));return n.set(t,o),Dr(o,t,r,n,i),o}return t}function Dr(t,e,r=t,n,i){const s=[...Object.keys(e),...Cv(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(t,a);(l==null||l.writable)&&(t[a]=ss(e[a],a,r,n,i))}}function x6(t){switch(fp(t)){case Sv:case i6:case s6:case o6:case wv:case e6:case p6:case m6:case u6:case d6:case f6:case r6:case vv:case Tv:case J$:case n6:case kv:case t6:case a6:case l6:case c6:case h6:return!0;default:return!1}}function y6(t,e){return g6(t,(r,n,i,s)=>{if(typeof t=="object"){if(fp(t)===Tv&&typeof t.constructor!="function"){const o={};return s.set(t,o),Dr(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case vv:case kv:case wv:{const o=new t.constructor(t==null?void 0:t.valueOf());return Dr(o,t),o}case Sv:{const o={};return Dr(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function hx(t){return y6(t)}function Sd(t){return t!==null&&typeof t=="object"&&fp(t)==="[object Arguments]"}function Td(t){return typeof t=="object"&&t!==null}function b6(t){return Td(t)&&bv(t)}function wa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");const r=function(...i){const s=e?e.apply(this,i):i[0],o=r.cache;if(o.has(s))return o.get(s);const a=t.apply(this,i);return r.cache=o.set(s,a)||o,a},n=wa.Cache||Map;return r.cache=new n,r}wa.Cache=Map;function C6(){}function k6(t){const e=t==null?void 0:t.constructor,r=typeof e=="function"?e.prototype:Object.prototype;return t===r}function Tl(t){return mp(t)}function eu(t){var r;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const n=t[Symbol.toStringTag];return n==null||!((r=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&r.writable)?!1:t.toString()===`[object ${n}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function v6(t){if(dp(t))return t;if(Array.isArray(t)||mp(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t);if(e==null)return Object.assign(Object.create(e),t);const r=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new r(t);if(t instanceof RegExp){const n=new r(t);return n.lastIndex=t.lastIndex,n}if(t instanceof DataView)return new r(t.buffer.slice(0));if(t instanceof Error){let n;return t instanceof AggregateError?n=new r(t.errors,t.message,{cause:t.cause}):n=new r(t.message,{cause:t.cause}),n.stack=t.stack,Object.assign(n,t),n}if(typeof File<"u"&&t instanceof File)return new r([t],t.name,{type:t.type,lastModified:t.lastModified});if(typeof t=="object"){const n=Object.create(e);return Object.assign(n,t)}return t}function w6(t,...e){const r=e.slice(0,-1),n=e[e.length-1];let i=t;for(let s=0;s<r.length;s++){const o=r[s];i=_l(i,o,n,new Map)}return i}function _l(t,e,r,n){if(dp(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(n.has(e))return v6(n.get(e));if(n.set(e,t),Array.isArray(e)){e=e.slice();for(let s=0;s<e.length;s++)e[s]=e[s]??void 0}const i=[...Object.keys(e),...Cv(e)];for(let s=0;s<i.length;s++){const o=i[s];if(Q$(o))continue;let a=e[o],l=t[o];if(Sd(a)&&(a={...a}),Sd(l)&&(l={...l}),pp(a)&&(a=hx(a)),Array.isArray(a))if(Array.isArray(l)){const u=[],d=Reflect.ownKeys(l);for(let p=0;p<d.length;p++){const f=d[p];u[f]=l[f]}l=u}else if(b6(l)){const u=[];for(let d=0;d<l.length;d++)u[d]=l[d];l=u}else l=[];const c=r(l,a,o,t,e,n);c!==void 0?t[o]=c:Array.isArray(a)||Td(l)&&Td(a)&&(eu(l)||eu(a)||Tl(l)||Tl(a))?t[o]=_l(l,a,r,n):l==null&&eu(a)?t[o]=_l({},a,r,n):l==null&&Tl(a)?t[o]=hx(a):(l===void 0||a!==void 0)&&(t[o]=a)}return t}function S6(t,...e){return w6(t,...e,C6)}function ux(t){if(t==null)return!0;if(bv(t))return typeof t.splice!="function"&&typeof t!="string"&&!pp(t)&&!Tl(t)&&!Sd(t)?!1:t.length===0;if(typeof t=="object"){if(t instanceof Map||t instanceof Set)return t.size===0;const e=Object.keys(t);return k6(t)?e.filter(r=>r!=="constructor").length===0:e.length===0}return!0}var T6="​",_6={curveBasis:ld,curveBasisClosed:BR,curveBasisOpen:AR,curveBumpX:yC,curveBumpY:bC,curveBundle:MR,curveCardinalClosed:IR,curveCardinalOpen:FR,curveCardinal:wC,curveCatmullRomClosed:PR,curveCatmullRomOpen:DR,curveCatmullRom:TC,curveLinear:Ho,curveLinearClosed:OR,curveMonotoneX:BC,curveMonotoneY:AC,curveNatural:IC,curveStep:FC,curveStepAfter:DC,curveStepBefore:PC},E6=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,N6=v(function(t,e){const r=_v(t,/(?:init\b)|(?:initialize\b)/);let n={};if(Array.isArray(r)){const o=r.map(a=>a.args);Yl(o),n=Ie(n,[...o])}else n=r.args;if(!n)return;let i=$f(t,e);const s="config";return n[s]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[s],delete n[s]),n},"detectInit"),_v=v(function(t,e=null){var r,n;try{const i=new RegExp(`[%]{2}(?![{]${E6.source})(?=[}][%]{2}).*
500
- `,"ig");t=t.trim().replace(i,"").replace(/'/gm,'"'),J.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let s;const o=[];for(;(s=Wo.exec(t))!==null;)if(s.index===Wo.lastIndex&&Wo.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 J.error(`ERROR: ${i.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),j6=v(function(t){return t.replace(Wo,"")},"removeDirectives"),L6=v(function(t,e){for(const[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");function gp(t,e){if(!t)return e;const r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return _6[r]??e}v(gp,"interpolateToCurve");function Ev(t,e){const r=t.trim();if(r)return e.securityLevel!=="loose"?K$.sanitizeUrl(r):r}v(Ev,"formatUrl");var B6=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){J.error(`Function name: ${t} not found in window`);return}s[i](...e)},"runFunc");function xp(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}v(xp,"distance");function Nv(t){let e,r=0;t.forEach(i=>{r+=xp(i,e),e=i});const n=r/2;return yp(t,n)}v(Nv,"traverseEdge");function jv(t){return t.length===1?t[0]:Nv(t)}v(jv,"calcLabelPosition");var dx=v((t,e=2)=>{const r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),yp=v((t,e)=>{let r,n=e;for(const i of t){if(r){const s=xp(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:dx((1-o)*r.x+o*i.x,5),y:dx((1-o)*r.y+o*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),A6=v((t,e,r)=>{J.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());const i=yp(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 Lv(t,e,r){const n=structuredClone(r);J.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();const i=25+t,s=yp(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(Lv,"calcTerminalLabelPosition");function Bv(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(Bv,"getStylesFromArray");var fx=0,M6=v(()=>(fx++,"id-"+Math.random().toString(36).substr(2,12)+"-"+fx),"generateId");function Av(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(Av,"makeRandomHex");var I6=v(t=>Av(t.length),"random"),F6=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"),P6=v(function(t,e){const r=e.text.replace(ba.lineBreakRegex," "),[,n]=Qc(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"),D6=wa((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"<br/>"},r),ba.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}=O6(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}`),O6=wa((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 Mv(t,e){return bp(t,e).height}v(Mv,"calculateTextHeight");function wn(t,e){return bp(t,e).width}v(wn,"calculateTextWidth");var bp=wa((t,e)=>{const{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};const[,s]=Qc(r),o=["sans-serif",n],a=t.split(ba.lineBreakRegex),l=[],c=Gt("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=F6();g.text=x||T6;const y=P6(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,R6=(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),Ka,$6=v(function(t){return Ka=Ka||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),Ka.innerHTML=t,unescape(Ka.textContent)},"entityDecode");function Cp(t){return"str"in t}v(Cp,"isDetailedError");var z6=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"),Qc=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 kp(t,e){return S6({},t,e)}v(kp,"cleanAndMerge");var zr={assignWithDepth:Ie,wrapLabel:D6,calculateTextHeight:Mv,calculateTextWidth:wn,calculateTextDimensions:bp,cleanAndMerge:kp,detectInit:N6,detectDirective:_v,isSubstringInArray:L6,interpolateToCurve:gp,calcLabelPosition:jv,calcCardinalityPosition:A6,calcTerminalLabelPosition:Lv,formatUrl:Ev,getStylesFromArray:Bv,generateId:M6,random:I6,runFunc:B6,entityDecode:$6,insertTitle:z6,isLabelCoordinateInPath:Iv,parseFontSize:Qc,InitIDGenerator:R6},W6=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"),Ti=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),wZ=v((t,e,{counter:r=0,prefix:n,suffix:i},s)=>s||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");function De(t){return t??null}v(De,"handleUndefinedAttr");function Iv(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(Iv,"isLabelCoordinateInPath");var vp=v(({flowchart:t})=>{var i,s;const e=((i=t==null?void 0:t.subGraphTitleMargin)==null?void 0:i.top)??0,r=((s=t==null?void 0:t.subGraphTitleMargin)==null?void 0:s.bottom)??0,n=e+r;return{subGraphTitleTopMargin:e,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins");async function Fv(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=ee().fontSize?ee().fontSize:window.getComputedStyle(document.body).fontSize,l=5,[c=L1.fontSize]=Qc(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(Fv,"configureLabelImages");var q6=v(t=>{const{handDrawnSeed:e}=ee();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),Hs=v(t=>{const e=H6([...t.cssCompiledStyles||[],...t.cssStyles||[],...t.labelStyle||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),H6=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"),Pv=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"),yt=v(t=>{const{stylesArray:e}=Hs(t),r=[],n=[],i=[],s=[];return e.forEach(o=>{const a=o[0];Pv(a)?r.push(o.join(":")+" !important"):(n.push(o.join(":")+" !important"),a.includes("stroke")&&i.push(o.join(":")+" !important"),a==="fill"&&s.push(o.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:e,borderStyles:i,backgroundStyles:s}},"styles2String"),xt=v((t,e)=>{var l;const{themeVariables:r,handDrawnSeed:n}=ee(),{nodeBorder:i,mainBkg:s}=r,{stylesMap:o}=Hs(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:U6(o.get("stroke-dasharray"))},e)},"userNodeOverrides"),U6=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 G6=Object.freeze({left:0,top:0,width:16,height:16}),pc=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Dv=Object.freeze({...G6,...pc}),V6=Object.freeze({...Dv,body:"",hidden:!1}),Y6=Object.freeze({width:null,height:null}),X6=Object.freeze({...Y6,...pc}),K6=(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 ru(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 ru(a)?a:null}if(r&&n===""){const a={provider:n,prefix:"",name:s};return ru(a,r)?a:null}return null},ru=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1;function Z6(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 px(t,e){const r=Z6(t,e);for(const n in V6)n in pc?n in t&&!(n in r)&&(r[n]=pc[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}function Q6(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 mx(t,e,r){const n=t.icons,i=t.aliases||Object.create(null);let s={};function o(a){s=px(n[a]||i[a],s)}return o(e),r.forEach(o),px(t,s)}function J6(t,e){if(t.icons[e])return mx(t,e,[]);const r=Q6(t,[e])[e];return r?mx(t,e,r):null}const t8=/(-?[0-9.]*[0-9]+[0-9.]*)/g,e8=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function gx(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(t8);if(n===null||!n.length)return t;const i=[];let s=n.shift(),o=e8.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 r8(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 n8(t,e){return t?"<defs>"+t+"</defs>"+e:e}function i8(t,e,r){const n=r8(t);return n8(n.defs,e+n.content+r)}const s8=t=>t==="unset"||t==="undefined"||t==="none";function o8(t,e){const r={...Dv,...t},n={...X6,...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 T;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:T=i.height/2+i.top,g.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:g.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:T=i.width/2+i.left,g.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}k%2===1&&(i.left!==i.top&&(T=i.left,i.left=i.top,i.top=T),i.width!==i.height&&(T=i.width,i.width=i.height,i.height=T)),g.length&&(s=i8(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=gx(d,l/c)):(u=o==="auto"?l:o,d=a===null?gx(u,c/l):a==="auto"?c:a);const p={},f=(x,g)=>{s8(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 a8=/\sid="(\S+)"/g,xx=new Map;function l8(t){t=t.replace(/[0-9]+$/,"")||"a";const e=xx.get(t)||0;return xx.set(t,e+1),e?`${t}${e}`:t}function c8(t){const e=[];let r;for(;r=a8.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=l8(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 h8(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 wp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ai=wp();function Ov(t){Ai=t}var Uo={exec:()=>null};function re(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(er.caret,"$1"),r=r.replace(i,o),n},getRegex:()=>new RegExp(r,e)};return n}var u8=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),er={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},d8=/^(?:[ \t]*(?:\n|$))+/,f8=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,p8=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Sa=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,m8=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Sp=/(?:[*+-]|\d{1,9}[.)])/,Rv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$v=re(Rv).replace(/bull/g,Sp).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(),g8=re(Rv).replace(/bull/g,Sp).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(),Tp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,x8=/^[^\n]+/,_p=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,y8=re(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_p).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),b8=re(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Sp).getRegex(),Jc="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",Ep=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,C8=re("^ {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",Ep).replace("tag",Jc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),zv=re(Tp).replace("hr",Sa).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",Jc).getRegex(),k8=re(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",zv).getRegex(),Np={blockquote:k8,code:f8,def:y8,fences:p8,heading:m8,hr:Sa,html:C8,lheading:$v,list:b8,newline:d8,paragraph:zv,table:Uo,text:x8},yx=re("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Sa).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",Jc).getRegex(),v8={...Np,lheading:g8,table:yx,paragraph:re(Tp).replace("hr",Sa).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",yx).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",Jc).getRegex()},w8={...Np,html:re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ep).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:Uo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:re(Tp).replace("hr",Sa).replace("heading",` *#{1,6} *[^
501
- ]`).replace("lheading",$v).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},S8=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,T8=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Wv=/^( {2,}|\\)\n(?!\s*$)/,_8=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,th=/[\p{P}\p{S}]/u,jp=/[\s\p{P}\p{S}]/u,qv=/[^\s\p{P}\p{S}]/u,E8=re(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,jp).getRegex(),Hv=/(?!~)[\p{P}\p{S}]/u,N8=/(?!~)[\s\p{P}\p{S}]/u,j8=/(?:[^\s\p{P}\p{S}]|~)/u,L8=re(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",u8?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Uv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,B8=re(Uv,"u").replace(/punct/g,th).getRegex(),A8=re(Uv,"u").replace(/punct/g,Hv).getRegex(),Gv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",M8=re(Gv,"gu").replace(/notPunctSpace/g,qv).replace(/punctSpace/g,jp).replace(/punct/g,th).getRegex(),I8=re(Gv,"gu").replace(/notPunctSpace/g,j8).replace(/punctSpace/g,N8).replace(/punct/g,Hv).getRegex(),F8=re("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qv).replace(/punctSpace/g,jp).replace(/punct/g,th).getRegex(),P8=re(/\\(punct)/,"gu").replace(/punct/g,th).getRegex(),D8=re(/^<(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(),O8=re(Ep).replace("(?:-->|$)","-->").getRegex(),R8=re("^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",O8).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,$8=re(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",mc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Vv=re(/^!?\[(label)\]\[(ref)\]/).replace("label",mc).replace("ref",_p).getRegex(),Yv=re(/^!?\[(ref)\](?:\[\])?/).replace("ref",_p).getRegex(),z8=re("reflink|nolink(?!\\()","g").replace("reflink",Vv).replace("nolink",Yv).getRegex(),bx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Lp={_backpedal:Uo,anyPunctuation:P8,autolink:D8,blockSkip:L8,br:Wv,code:T8,del:Uo,emStrongLDelim:B8,emStrongRDelimAst:M8,emStrongRDelimUnd:F8,escape:S8,link:$8,nolink:Yv,punctuation:E8,reflink:Vv,reflinkSearch:z8,tag:R8,text:_8,url:Uo},W8={...Lp,link:re(/^!?\[(label)\]\((.*?)\)/).replace("label",mc).getRegex(),reflink:re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mc).getRegex()},_d={...Lp,emStrongRDelimAst:I8,emStrongLDelim:A8,url:re(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",bx).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:re(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",bx).getRegex()},q8={..._d,br:re(Wv).replace("{2,}","*").getRegex(),text:re(_d.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Za={normal:Np,gfm:v8,pedantic:w8},xo={normal:Lp,gfm:_d,breaks:q8,pedantic:W8},H8={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Cx=t=>H8[t];function Qr(t,e){if(e){if(er.escapeTest.test(t))return t.replace(er.escapeReplace,Cx)}else if(er.escapeTestNoEncode.test(t))return t.replace(er.escapeReplaceNoEncode,Cx);return t}function kx(t){try{t=encodeURI(t).replace(er.percentDecode,"%")}catch{return null}return t}function vx(t,e){var s;let r=t.replace(er.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(er.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!((s=n.at(-1))!=null&&s.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(er.slashPipe,"|");return n}function yo(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 U8(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 wx(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 G8(t,e,r){let n=t.match(r.other.indentCodeCompensation);if(n===null)return e;let i=n[1];return e.split(`
502
- `).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(`
503
- `)}var gc=class{constructor(e){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=e||Ai}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:yo(n,`
504
- `)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=G8(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=yo(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:yo(r[0],`
505
- `)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=yo(r[0],`
506
- `).split(`
507
- `),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(`
508
- `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
509
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
510
- ${u}`:u,s=s?`${s}
511
- ${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+`
512
- `+n.join(`
513
- `),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+`
514
- `+n.join(`
515
- `),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(`
516
- `);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(`
517
- `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),f=e.split(`
518
- `,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+`
519
- `,e=e.substring(f.length+1),c=!0),!c){let b=this.rules.other.nextBulletRegex(x),k=this.rules.other.hrRegex(x),T=this.rules.other.fencesBeginRegex(x),_=this.rules.other.headingBeginRegex(x),w=this.rules.other.htmlBeginRegex(x);for(;e;){let E=e.split(`
520
- `,1)[0],B;if(f=E,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),B=f):B=f.replace(this.rules.other.tabCharGlobal," "),T.test(f)||_.test(f)||w.test(f)||b.test(f)||k.test(f))break;if(B.search(this.rules.other.nonSpaceChar)>=x||!f.trim())d+=`
521
- `+B.slice(x);else{if(m||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(p)||_.test(p)||k.test(p))break;d+=`
522
- `+f}!m&&!f.trim()&&(m=!0),u+=E+`
523
- `,e=e.substring(E.length+1),p=B.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=vx(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(`
524
- `):[],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(vx(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)===`
525
- `?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=yo(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=U8(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)),wx(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 wx(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}}}},Or=class Ed{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||Ai,this.options.tokenizer=this.options.tokenizer||new gc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:er,block:Za.normal,inline:xo.normal};this.options.pedantic?(r.block=Za.pedantic,r.inline=xo.pedantic):this.options.gfm&&(r.block=Za.gfm,this.options.breaks?r.inline=xo.breaks:r.inline=xo.gfm),this.tokenizer.rules=r}static get rules(){return{block:Za,inline:xo}}static lex(e,r){return new Ed(r).lex(e)}static lexInline(e,r){return new Ed(r).inlineTokens(e)}lex(e){e=e.replace(er.carriageReturn,`
526
- `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var i,s,o;for(this.options.pedantic&&(e=e.replace(er.tabCharGlobal," ").replace(er.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(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+=`
527
- `: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(`
528
- `)?"":`
529
- `)+a.raw,c.text+=`
530
- `+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(`
531
- `)?"":`
532
- `)+a.raw,c.text+=`
533
- `+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(`
534
- `)?"":`
535
- `)+a.raw,c.text+=`
536
- `+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(`
537
- `)?"":`
538
- `)+a.raw,c.text+=`
539
- `+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}},xc=class{constructor(e){ne(this,"options");ne(this,"parser");this.options=e||Ai}space(e){return""}code({text:e,lang:r,escaped:n}){var o;let i=(o=(r||"").match(er.notSpaceStart))==null?void 0:o[0],s=e.replace(er.endingNewline,"")+`
540
- `;return i?'<pre><code class="language-'+Qr(i)+'">'+(n?s:Qr(s,!0))+`</code></pre>
541
- `:"<pre><code>"+(n?s:Qr(s,!0))+`</code></pre>
542
- `}blockquote({tokens:e}){return`<blockquote>
543
- ${this.parser.parse(e)}</blockquote>
544
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:r}){return`<h${r}>${this.parser.parseInline(e)}</h${r}>
545
- `}hr(e){return`<hr>
546
- `}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+`>
547
- `+i+"</"+s+`>
548
- `}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>
549
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
550
- `}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>
551
- <thead>
552
- `+r+`</thead>
553
- `+i+`</table>
554
- `}tablerow({text:e}){return`<tr>
555
- ${e}</tr>
556
- `}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+`</${n}>
557
- `}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)}},Bp=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 Nd{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Ai,this.options.renderer=this.options.renderer||new xc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Bp}static parse(e,r){return new Nd(r).parse(e)}static parseInline(e,r){return new Nd(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+=`
558
- `+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}},ml,Mo=(ml=class{constructor(e){ne(this,"options");ne(this,"block");this.options=e||Ai}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Or.lex:Or.lexInline}provideParser(){return this.block?Rr.parse:Rr.parseInline}},ne(ml,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ne(ml,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ml),V8=class{constructor(...e){ne(this,"defaults",wp());ne(this,"options",this.setOptions);ne(this,"parse",this.parseMarkdown(!0));ne(this,"parseInline",this.parseMarkdown(!1));ne(this,"Parser",Rr);ne(this,"Renderer",xc);ne(this,"TextRenderer",Bp);ne(this,"Lexer",Or);ne(this,"Tokenizer",gc);ne(this,"Hooks",Mo);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 xc(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 gc(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 Mo;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];Mo.passThroughHooks.has(o)?s[a]=u=>{if(this.defaults.async&&Mo.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 Or.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?Or.lex:Or.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?Or.lex:Or.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+=`
559
- 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}}},_i=new V8;function ie(t,e){return _i.parse(t,e)}ie.options=ie.setOptions=function(t){return _i.setOptions(t),ie.defaults=_i.defaults,Ov(ie.defaults),ie};ie.getDefaults=wp;ie.defaults=Ai;ie.use=function(...t){return _i.use(...t),ie.defaults=_i.defaults,Ov(ie.defaults),ie};ie.walkTokens=function(t,e){return _i.walkTokens(t,e)};ie.parseInline=_i.parseInline;ie.Parser=Rr;ie.parser=Rr.parse;ie.Renderer=xc;ie.TextRenderer=Bp;ie.Lexer=Or;ie.lexer=Or.lex;ie.Tokenizer=gc;ie.Hooks=Mo;ie.parse=ie;ie.options;ie.setOptions;ie.use;ie.walkTokens;ie.parseInline;Rr.parse;Or.lex;function Xv(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(`
560
- [ ]{`+Math.min.apply(Math,i)+"}","g");n=n.map(function(a){return a.replace(s,`
561
- `)})}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(`
562
- `)&&(d=String(a).split(`
563
- `).map(function(p,f){return f===0?p:""+u+p}).join(`
564
- `)),o+=d+n[l+1]}),o}var Y8={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},jd=new Map,Kv=new Map,X8=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(J.debug("Registering icon pack:",e.name),"loader"in e)Kv.set(e.name,e.loader);else if("icons"in e)jd.set(e.name,e.icons);else throw J.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),Zv=v(async(t,e)=>{const r=K6(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=jd.get(n);if(!i){const o=Kv.get(n);if(!o)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await o(),prefix:n},jd.set(n,i)}catch(a){throw J.error(a),new Error(`Failed to load icon set: ${r.prefix}`)}}const s=J6(i,r.name);if(!s)throw new Error(`Icon not found: ${t}`);return s},"getRegisteredIconData"),K8=v(async t=>{try{return await Zv(t),!0}catch{return!1}},"isIconAvailable"),Ta=v(async(t,e,r)=>{let n;try{n=await Zv(t,e==null?void 0:e.fallbackPrefix)}catch(o){J.error(o),n=Y8}const i=o8(n,e),s=h8(c8(i.body),{...i.attributes,...r});return Ur(s,ge())},"getIconSVG");function Qv(t,{markdownAutoWrap:e}){const n=t.replace(/<br\/>/g,`
565
- `).replace(/\n{2,}/g,`
566
- `);return Xv(n)}v(Qv,"preprocessMarkdown");function Jv(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(Jv,"nonMarkdownToLines");function tw(t,e={}){const r=Qv(t,e),n=ie.lexer(r),i=[[]];let s=0;function o(a,l="normal"){a.type==="text"?a.text.split(`
567
- `).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(tw,"markdownToLines");function ew(t){return t?`<p>${t.replace(/\\n|\n/g,"<br />")}</p>`:""}v(ew,"nonMarkdownToHTML");function rw(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:(J.warn(`Unsupported markdown: ${i.type}`),i.raw)}return v(n,"output"),r.map(n).join("")}v(rw,"markdownToHTML");function nw(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}v(nw,"splitTextToChars");function iw(t,e){const r=nw(e.content);return Ap(t,[],r,e.type)}v(iw,"splitWordToFitWidth");function Ap(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}])?Ap(t,o,s,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}v(Ap,"splitWordToFitWidthRecursion");function sw(t,e){if(t.some(({content:r})=>r.includes(`
568
- `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return yc(t,e)}v(sw,"splitLineToFitWidth");function yc(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 yc(t,e,r,o);if(n.length>0)r.push(n),t.unshift(s);else if(s.content){const[a,l]=iw(e,s);r.push([a]),l.content&&t.unshift(l)}return yc(t,e,r)}v(yc,"splitLineToFitWidthRecursion");function Ld(t,e){e&&t.attr("style",e)}v(Ld,"applyStyle");var Sx=16384;async function ow(t,e,r,n,i=!1,s=ge()){const o=t.append("foreignObject");o.attr("width",`${Math.min(10*r,Sx)}px`),o.attr("height",`${Math.min(10*r,Sx)}px`);const a=o.append("xhtml:div"),l=Qo(e.label)?await $1(e.label.replace(ba.lineBreakRegex,`
569
- `),s):Ur(e.label,s),c=e.isNode?"nodeLabel":"edgeLabel",u=a.append("span");u.html(l),Ld(u,e.labelStyle),u.attr("class",`${c} ${n}`),Ld(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(ow,"addHtmlSpan");function eh(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(eh,"createTspan");function aw(t,e,r){const n=t.append("text"),i=eh(n,1,e);rh(i,r);const s=i.node().getComputedTextLength();return n.remove(),s}v(aw,"computeWidthOfText");function Z8(t,e,r){var o;const n=t.append("text"),i=eh(n,1,e);rh(i,[{content:r,type:"normal"}]);const s=(o=i.node())==null?void 0:o.getBoundingClientRect();return s&&n.remove(),s}v(Z8,"computeDimensionOfText");function lw(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=>aw(o,1.1,f)<=t,"checkWidth"),p=d(u)?[u]:sw(u,d);for(const f of p){const m=eh(l,c,1.1,i);rh(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(lw,"createFormattedText");function Bd(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(Bd,"decodeHTMLEntities");function rh(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(Bd(r.content)):i.text(" "+Bd(r.content))})}v(rh,"updateTextContentAndStyles");async function cw(t,e={}){const r=[];t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(i,s,o)=>(r.push((async()=>{const a=`${s}:${o}`;return await K8(a)?await Ta(a,void 0,{class:"label-icon"}):`<i class='${Ur(i,e).replace(":"," ")}'></i>`})()),i));const n=await Promise.all(r);return t.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>n.shift()??"")}v(cw,"replaceIconSubstring");var _n=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(J.debug("XYZ createText",e,r,n,i,s,a,"addSvgBackground: ",c),s){const d=o?rw(e,u):ew(e),p=await cw(Ti(d),u),f=e.replace(/\\\\/g,"\\"),m={isNode:a,label:Qo(e)?f:p,labelStyle:r.replace("fill:","color:")};return await ow(t,m,l,i,c,u)}else{const d=Ti(e.replace(/<br\s*\/?>/g,"<br/>")),p=o?tw(d.replace("<br>","<br/>"),u):Jv(d),f=lw(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:");Gt(f).attr("style",m)}else{const m=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Gt(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:");Gt(f).select("text").attr("style",x)}return n?Gt(f).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Gt(f).selectAll("tspan.text-outer-tspan").classed("row",!0),f}},"createText");function nu(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 Q8(t,e){return t[0]===e[0]&&t[1]===e[1]}function J8(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)nu(c,a,i);const l=(function(c,u,d){const p=[];for(const b of c){const k=[...b];Q8(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 T=b[k],_=b[k+1];if(T[1]!==_[1]){const w=Math.min(T[1],_[1]);m.push({ymin:w,ymax:Math.max(T[1],_[1]),x:w===T[1]?T[0]:_[0],islope:(_[0]-T[0])/(_[1]-T[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 T=x[b].edge,_=x[k].edge;f.push([[Math.round(T.x),g],[Math.round(_.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)nu(c,a,-i);(function(c,u,d){const p=[];c.forEach((f=>p.push(...f))),nu(p,u,d)})(l,a,-i)}return l}function _a(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),J8(t,i,n,s||1)}class Mp{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){const n=_a(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 nh(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 tz extends Mp{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);const i=_a(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)nh([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 ez extends Mp{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 rz{constructor(e){this.helper=e}fillPolygons(e,r){const n=_a(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=nh(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 nz{constructor(e){this.helper=e}fillPolygons(e,r){const n=_a(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=nh(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 iz{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=_a(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=nh(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 cr={};class sz{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const oz=0,iu=1,Tx=2,Qa={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 su(t,e){return t.type===e}function Ip(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:oz,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:iu,text:`${parseFloat(RegExp.$1)}`},o=o.substr(RegExp.$1.length)}return a[a.length]={type:Tx,text:""},a})(t);let n="BOD",i=0,s=r[i];for(;!su(s,Tx);){let o=0;const a=[];if(n==="BOD"){if(s.text!=="M"&&s.text!=="m")return Ip("M0,0"+t);i++,o=Qa[s.text],n=s.text}else su(s,iu)?o=Qa[n]:(i++,o=Qa[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(!su(c,iu))throw new Error("Param not a number: "+n+","+c.text);a[a.length]=+c.text}if(typeof Qa[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 hw(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 uw(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)&&(dw(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 bo(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function dw(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]=bo(t,e,-u),[r,n]=bo(r,n,-u);const U=(t-r)/2,O=(e-n)/2;let I=U*U/(i*i)+O*O/(s*s);I>1&&(I=Math.sqrt(I),i*=I,s*=I);const A=i*i,D=s*s,R=A*D-A*O*O-D*U*U,j=A*O*O+D*U*U,S=(a===l?-1:1)*Math.sqrt(Math.abs(R/j));x=S*i*O/s+(t+r)/2,g=S*-s*U/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 U=m,O=r,I=n;m=l&&m>f?f+120*Math.PI/180*1:f+120*Math.PI/180*-1,p=dw(r=x+i*Math.cos(m),n=g+s*Math.sin(m),O,I,i,s,o,0,l,[m,U,x,g])}y=m-f;const b=Math.cos(f),k=Math.sin(f),T=Math.cos(m),_=Math.sin(m),w=Math.tan(y/4),E=4/3*i*w,B=4/3*s*w,F=[t,e],N=[t+E*k,e-B*b],M=[r+E*_,n-B*T],$=[r,n];if(N[0]=2*F[0]-N[0],N[1]=2*F[1]-N[1],c)return[N,M,$].concat(p);{p=[N,M,$].concat(p);const U=[];for(let O=0;O<p.length;O+=3){const I=bo(p[O][0],p[O][1],u),A=bo(p[O+1][0],p[O+1][1],u),D=bo(p[O+2][0],p[O+2][1],u);U.push([I[0],I[1],A[0],A[1],D[0],D[1]])}return U}}const az={randOffset:function(t,e){return Ft(t,e)},randOffsetWithRange:function(t,e,r){return bc(t,e,r)},ellipse:function(t,e,r,n,i){const s=pw(r,n,i);return Ad(t,e,i,s).opset},doubleLineOps:function(t,e,r,n,i){return Yn(t,e,r,n,i,!0)}};function fw(t,e,r,n,i){return{type:"path",ops:Yn(t,e,r,n,i)}}function El(t,e,r){const n=(t||[]).length;if(n>2){const i=[];for(let s=0;s<n-1;s++)i.push(...Yn(t[s][0],t[s][1],t[s+1][0],t[s+1][1],r));return e&&i.push(...Yn(t[n-1][0],t[n-1][1],t[0][0],t[0][1],r)),{type:"path",ops:i}}return n===2?fw(t[0][0],t[0][1],t[1][0],t[1][1],r):{type:"path",ops:[]}}function lz(t,e,r,n,i){return(function(s,o){return El(s,!0,o)})([[t,e],[t+r,e],[t+r,e+n],[t,e+n]],i)}function _x(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,n=Ja(r[0],1*(1+.2*e.roughness),e),i=e.disableMultiStroke?[]:Ja(r[0],1.5*(1+.22*e.roughness),jx(e));for(let s=1;s<r.length;s++){const o=r[s];if(o.length){const a=Ja(o,1*(1+.2*e.roughness),e),l=e.disableMultiStroke?[]:Ja(o,1.5*(1+.22*e.roughness),jx(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 pw(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 Ad(t,e,r,n){const[i,s]=Lx(n.increment,t,e,n.rx,n.ry,1,n.increment*bc(.1,bc(.4,1,r),r),r);let o=Cc(i,null,r);if(!r.disableMultiStroke&&r.roughness!==0){const[a]=Lx(n.increment,t,e,n.rx,n.ry,1.5,0,r),l=Cc(a,null,r);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function Ex(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=Bx(g,c,u,d,p,f,m,1,l);if(!l.disableMultiStroke){const b=Bx(g,c,u,d,p,f,m,1.5,l);y.push(...b)}return o&&(a?y.push(...Yn(c,u,c+d*Math.cos(f),u+p*Math.sin(f),l),...Yn(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 Nx(t,e){const r=uw(hw(Ip(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(...Yn(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(...cz(l,c,u,d,p,f,s,e)),s=[p,f];break}case"Z":n.push(...Yn(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]]}return{type:"path",ops:n}}function ou(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(!cr[i])switch(i){case"zigzag":cr[i]||(cr[i]=new tz(n));break;case"cross-hatch":cr[i]||(cr[i]=new ez(n));break;case"dots":cr[i]||(cr[i]=new rz(n));break;case"dashed":cr[i]||(cr[i]=new nz(n));break;case"zigzag-line":cr[i]||(cr[i]=new iz(n));break;default:i="hachure",cr[i]||(cr[i]=new Mp(n))}return cr[i]})(e,az).fillPolygons(t,e)}function jx(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function mw(t){return t.randomizer||(t.randomizer=new sz(t.seed||0)),t.randomizer.next()}function bc(t,e,r,n=1){return r.roughness*n*(mw(r)*(e-t)+t)}function Ft(t,e,r=1){return bc(-t,t,e,r)}function Yn(t,e,r,n,i,s=!1){const o=s?i.disableMultiStrokeFill:i.disableMultiStroke,a=Md(t,e,r,n,i,!0,!1);if(o)return a;const l=Md(t,e,r,n,i,!0,!0);return a.concat(l)}function Md(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*mw(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 Ja(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 Cc(n,null,r)}function Cc(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(...Md(t[0][0],t[0][1],t[1][0],t[1][1],r,!0,!0));return i}function Lx(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 Bx(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)]),Cc(u,null,l)}function cz(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 Co(t){return[...t]}function Ax(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(Co(t[0]),Co(t[1]),Co(t[2]),Co(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(Co(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 Nl(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function hz(t,e,r){const n=Nl(e,r);if(n===0)return Nl(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)),Nl(t,ui(e,r,i))}function ui(t,e,r){return[t[0]+(e[0]-t[0])*r,t[1]+(e[1]-t[1])*r]}function Id(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(Nl(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=ui(l,c,.5),f=ui(c,u,.5),m=ui(u,d,.5),x=ui(p,f,.5),g=ui(f,m,.5),y=ui(x,g,.5);Id([l,p,x,y],0,r,i),Id([y,g,m,d],0,r,i)}var s,o;return i}function uz(t,e){return kc(t,0,t.length,e)}function kc(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=hz(t[u],o,a);d>l&&(l=d,c=u)}return Math.sqrt(l)>n?(kc(t,e,c+1,n,s),kc(t,c,r,n,s)):(s.length||s.push(o),s.push(a)),s}function au(t,e=.15,r){const n=[],i=(t.length-1)/3;for(let s=0;s<i;s++)Id(t,3*s,e,n);return r&&r>0?kc(n,0,n.length,r):n}const br="none";class vc{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",[fw(e,r,n,i,o)],o)}rectangle(e,r,n,i,s){const o=this._o(s),a=[],l=lz(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(ou([c],o)):a.push(Hi([c],o))}return o.stroke!==br&&a.push(l),this._d("rectangle",a,o)}ellipse(e,r,n,i,s){const o=this._o(s),a=[],l=pw(n,i,o),c=Ad(e,r,o,l);if(o.fill)if(o.fillStyle==="solid"){const u=Ad(e,r,o,l).opset;u.type="fillPath",a.push(u)}else a.push(Hi([c.estimatedPoints],o));return o.stroke!==br&&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",[El(e,!1,n)],n)}arc(e,r,n,i,s,o,a=!1,l){const c=this._o(l),u=[],d=Ex(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=Ex(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,T=f;let _=Math.abs(m/2),w=Math.abs(x/2);_+=Ft(.01*_,b),w+=Ft(.01*w,b);let E=g,B=y;for(;E<0;)E+=2*Math.PI,B+=2*Math.PI;B-E>2*Math.PI&&(E=0,B=2*Math.PI);const F=(B-E)/b.curveStepCount,N=[];for(let M=E;M<=B;M+=F)N.push([k+_*Math.cos(M),T+w*Math.sin(M)]);return N.push([k+_*Math.cos(B),T+w*Math.sin(B)]),N.push([k,T]),Hi([N],b)})(e,r,n,i,s,o,c));return c.stroke!==br&&u.push(d),this._d("arc",u,c)}curve(e,r){const n=this._o(r),i=[],s=_x(e,n);if(n.fill&&n.fill!==br)if(n.fillStyle==="solid"){const o=_x(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(...au(Ax([c[0],c[0],c[1],c[2]]),10,(1+n.roughness)/2)):o.push(...au(Ax(c),10,(1+n.roughness)/2))}o.length&&i.push(Hi([o],n))}return n.stroke!==br&&i.push(s),this._d("curve",i,n)}polygon(e,r){const n=this._o(r),i=[],s=El(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(ou([e],n)):i.push(Hi([e],n))),n.stroke!==br&&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!==br,o=n.stroke!==br,a=!!(n.simplification&&n.simplification<1),l=(function(u,d,p){const f=uw(hw(Ip(u))),m=[];let x=[],g=[0,0],y=[];const b=()=>{y.length>=4&&x.push(...au(y,d)),y=[]},k=()=>{b(),x.length&&(m.push(x),x=[])};for(const{key:_,data:w}of f)switch(_){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 E=x.length?x[x.length-1]:g;y.push([E[0],E[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 T=[];for(const _ of m){const w=uz(_,p);w.length&&T.push(w)}return T})(e,1,a?4-4*(n.simplification||1):(1+n.roughness)/2),c=Nx(e,n);if(s)if(n.fillStyle==="solid")if(l.length===1){const u=Nx(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(ou(l,n));else i.push(Hi(l,n));return o&&(a?l.forEach((u=>{i.push(El(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:br};break;case"fillPath":o={d:this.opsToPath(s),stroke:br,strokeWidth:0,fill:n.fill||br};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||br,strokeWidth:n,fill:br}}_mergedShape(e){return e.filter(((r,n)=>n===0||r.op!=="move"))}}class dz{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new vc(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 tl="http://www.w3.org/2000/svg";class fz{constructor(e,r){this.svg=e,this.gen=new vc(r)}draw(e){const r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(tl,"g"),o=e.options.fixedDecimalPlaceDigits;for(const a of r){let l=null;switch(a.type){case"path":l=i.createElementNS(tl,"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(tl,"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(tl,"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 gt={canvas:(t,e)=>new dz(t,e),svg:(t,e)=>new fz(t,e),generator:t=>new vc(t),newSeed:()=>vc.newSeed()},It=v(async(t,e,r)=>{var f,m;let n;const i=e.useHtmlLabels||Tn((f=ee())==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",De(e.labelStyle));let a;e.label===void 0?a="":a=typeof e.label=="string"?e.label:e.label[0];const l=!!e.icon||!!e.img,c=e.labelType==="markdown",u=await _n(o,Ur(Ti(a),ee()),{useHtmlLabels:i,width:e.width||((m=ee().flowchart)==null?void 0:m.wrappingWidth),classes:c?"markdown-node-label":"",style:e.labelStyle,addSvgBackground:l,markdown:c},ee());let d=u.getBBox();const p=((e==null?void 0:e.padding)??0)/2;if(i){const x=u.children[0],g=Gt(u);await Fv(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"),lu=v(async(t,e,r)=>{var l,c;const n=r.useHtmlLabels??sr(ee()),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),s=await _n(i,Ur(Ti(e),ee()),{useHtmlLabels:n,width:r.width||((c=(l=ee())==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(sr(ee())){const u=s.children[0],d=Gt(s);o=u.getBoundingClientRect(),d.attr("width",o.width),d.attr("height",o.height)}return n?i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):i.attr("transform","translate(0, "+-o.height/2+")"),r.centerLabel&&i.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:t,bbox:o,halfPadding:a,label:i}},"insertLabel"),Ct=v((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),At=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function Qt(t){const e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}v(Qt,"createPathFromPoints");function Xn(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(Xn,"generateFullSineWavePoints");function aa(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(aa,"generateCirclePoints");function Fd(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(Fd,"mergePaths");var pz=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"),Us=pz,mz=v(async(t,e,r,n=!1,i=!1)=>{let s=e||"";typeof s=="object"&&(s=s[0]);const o=ee(),a=sr(o);return await _n(t,s,{style:r,isTitle:n,useHtmlLabels:a,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},o)},"createLabel"),Rn=mz,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"),gw=v(async(t,e)=>{J.info("Creating subgraph rect for ",e.id,e);const r=ee(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=yt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=sr(r),f=d.insert("g").attr("class","cluster-label ");let m;e.labelType==="markdown"?m=await _n(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width}):m=await Rn(f,e.label,e.labelStyle||"",!1,!0);let x=m.getBBox();if(sr(r)){const E=m.children[0],B=Gt(m);x=E.getBoundingClientRect(),B.attr("width",x.width),B.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;J.trace("Data ",e,JSON.stringify(e));let T;if(e.look==="handDrawn"){const E=gt.svg(d),B=xt(e,{roughness:.7,fill:s,stroke:o,fillWeight:3,seed:i}),F=E.path(ei(b,k,g,y,0),B);T=d.insert(()=>(J.debug("Rough node insert CXC",F),F),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=d.insert("rect",":first-child"),T.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:_}=vp(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const E=f.select("span");E&&E.attr("style",a)}const w=T.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(E){return Us(e,E)},{cluster:d,labelBBox:x}},"rect"),gz=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 Us(e,a)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),xz=v(async(t,e)=>{const r=ee(),{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 Rn(d,e.label,e.labelStyle,void 0,!0);let m=f.getBBox();if(sr(r)){const F=f.children[0],N=Gt(f);m=F.getBoundingClientRect(),N.attr("width",m.width),N.attr("height",m.height)}const x=0*e.padding,g=x/2,y=(e.width<=m.width+e.padding?m.width+e.padding:e.width)+x;e.width<=m.width+e.padding?e.diff=(y-e.width)/2-e.padding:e.diff=-e.padding;const b=e.height+x,k=e.height+x-m.height-6,T=e.x-y/2,_=e.y-b/2;e.width=y;const w=e.y-e.height/2-g+m.height+2;let E;if(e.look==="handDrawn"){const F=e.cssClasses.includes("statediagram-cluster-alt"),N=gt.svg(c),M=e.rx||e.ry?N.path(ei(T,_,y,b,10),{roughness:.7,fill:a,fillStyle:"solid",stroke:l,seed:i}):N.rectangle(T,_,y,b,{seed:i});E=c.insert(()=>M,":first-child");const $=N.rectangle(T,w,y,k,{fill:F?s:o,fillStyle:F?"hachure":"solid",stroke:l,seed:i});E=c.insert(()=>M,":first-child"),p=c.insert(()=>$)}else E=u.insert("rect",":first-child"),E.attr("class","outer").attr("x",T).attr("y",_).attr("width",y).attr("height",b).attr("data-look",e.look),p.attr("class","inner").attr("x",T).attr("y",w).attr("width",y).attr("height",k);d.attr("transform",`translate(${e.x-m.width/2}, ${_+1-(sr(r)?0:3)})`);const B=E.node().getBBox();return e.height=B.height,e.offsetX=0,e.offsetY=m.height-e.padding/2,e.labelBBox=m,e.intersect=function(F){return Us(e,F)},{cluster:c,labelBBox:m}},"roundedWithTitle"),yz=v(async(t,e)=>{J.info("Creating subgraph rect for ",e.id,e);const r=ee(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:s,clusterBorder:o}=n,{labelStyles:a,nodeStyles:l,borderStyles:c,backgroundStyles:u}=yt(e),d=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.domId).attr("data-look",e.look),p=sr(r),f=d.insert("g").attr("class","cluster-label "),m=await _n(f,e.label,{style:e.labelStyle,useHtmlLabels:p,isNode:!0,width:e.width});let x=m.getBBox();if(sr(r)){const E=m.children[0],B=Gt(m);x=E.getBoundingClientRect(),B.attr("width",x.width),B.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;J.trace("Data ",e,JSON.stringify(e));let T;if(e.look==="handDrawn"){const E=gt.svg(d),B=xt(e,{roughness:.7,fill:s,stroke:o,fillWeight:4,seed:i}),F=E.path(ei(b,k,g,y,e.rx),B);T=d.insert(()=>(J.debug("Rough node insert CXC",F),F),":first-child"),T.select("path:nth-child(2)").attr("style",c.join(";")),T.select("path").attr("style",u.join(";").replace("fill","stroke"))}else T=d.insert("rect",":first-child"),T.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:_}=vp(r);if(f.attr("transform",`translate(${e.x-x.width/2}, ${e.y-e.height/2+_})`),a){const E=f.select("span");E&&E.attr("style",a)}const w=T.node().getBBox();return e.offsetX=0,e.width=w.width,e.height=w.height,e.offsetY=x.height-e.padding/2,e.intersect=function(E){return Us(e,E)},{cluster:d,labelBBox:x}},"kanbanSection"),bz=v((t,e)=>{const r=ee(),{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=gt.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 Us(e,x)},{cluster:o,labelBBox:{}}},"divider"),Cz=gw,kz={rect:gw,squareRect:Cz,roundedWithTitle:xz,noteGroup:gz,divider:bz,kanbanSection:yz},xw=new Map,vz=v(async(t,e)=>{const r=e.shape||"rect",n=await kz[r](t,e);return xw.set(e.id,n),n},"insertCluster"),jZ=v(()=>{xw=new Map},"clear");function yw(t,e){return t.intersect(e)}v(yw,"intersectNode");var wz=yw;function bw(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(bw,"intersectEllipse");var Cw=bw;function kw(t,e,r){return Cw(t,e,e,r)}v(kw,"intersectCircle");var Sz=kw;function vw(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&&Pd(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&&Pd(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(vw,"intersectLine");function Pd(t,e){return t*e>0}v(Pd,"sameSign");var Tz=vw;function ww(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=Tz(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(ww,"intersectPolygon");var _z=ww,ft={node:wz,circle:Sz,ellipse:Cw,polygon:_z,rect:Us};function Sw(t,e){const{labelStyles:r}=yt(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=gt.svg(s),c=xt(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",De(a)),Ct(e,d),e.intersect=function(p){return J.info("Circle intersect",e,o,p),ft.circle(e,o,p)},s}v(Sw,"anchor");function Dd(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 _=Math.atan2((n-b)/s,(r-y)/i)-k;o&&_<0&&(_+=2*Math.PI),!o&&_>0&&(_-=2*Math.PI);const w=[];for(let E=0;E<20;E++){const B=E/19,F=k+B*_,N=y+i*Math.cos(F),M=b+s*Math.sin(F);w.push({x:N,y:M})}return w}v(Dd,"generateArcPoints");function Tw(t,e,r){const[n,i]=[e,r].sort((s,o)=>o-s);return i*(1-Math.sqrt(1-(t/n/2)**2))}v(Tw,"calculateArcSagitta");async function _w(t,e){const{labelStyles:r,nodeStyles:n}=yt(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 N=F/2;return[N/(2.5+F/50),N]},"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=Tw(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},...Dd(-g/2,-y/2,-g/2,y/2,p,f,!1),{x:g/2,y:y/2},...Dd(g/2,y/2,g/2,-y/2,p,f,!0)],T=gt.svg(c),_=xt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=Qt(k),E=T.path(w,_),B=c.insert(()=>E,":first-child");return B.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",n),B.attr("transform",`translate(${p/2}, 0)`),Ct(e,B),e.intersect=function(F){return ft.polygon(e,k,F)},c}v(_w,"bowTieRect");function En(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(En,"insertPolygonShape");var el=12;async function Ew(t,e){const{labelStyles:r,nodeStyles:n}=yt(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+el),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+el,y:f},{x:p,y:f},{x:p,y:m},{x:d,y:m},{x:d,y:f+el},{x:d+el,y:f}];let g;const{cssStyles:y}=e;if(e.look==="handDrawn"){const b=gt.svg(a),k=xt(e,{}),T=Qt(x),_=b.path(T,k);g=a.insert(()=>_,":first-child").attr("transform",`translate(${-c/2}, ${u/2})`),y&&g.attr("style",y)}else g=En(a,c,u,x);return n&&g.attr("style",n),Ct(e,g),e.intersect=function(b){return ft.polygon(e,x,b)},a}v(Ew,"card");function Nw(t,e){const{nodeStyles:r}=yt(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=gt.svg(n),l=xt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=Qt(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 ft.polygon(e,o,p)},n}v(Nw,"choice");async function Fp(t,e,r){const{labelStyles:n,nodeStyles:i}=yt(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=gt.svg(s),m=xt(e,{}),x=f.circle(0,0,u*2,m);d=s.insert(()=>x,":first-child"),d.attr("class","basic label-container").attr("style",De(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 Ct(e,d),e.calcIntersect=function(f,m){const x=f.width/2;return ft.circle(f,x,m)},e.intersect=function(f){return J.info("Circle intersect",e,u,f),ft.circle(e,u,f)},s}v(Fp,"circle");function jw(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}
570
- M ${i.x},${i.y} L ${o.x},${o.y}`}v(jw,"createLine");function Lw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(i),l=xt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");const c=a.circle(0,0,s*2,l),u=jw(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),Ct(e,p),e.intersect=function(f){return J.info("crossedCircle intersect",e,{radius:s,point:f}),ft.circle(e,s,f)},i}v(Lw,"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 Bw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(i),g=xt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Qt(f).replace("Z",""),k=x.path(b,g),T=Qt(m),_=x.path(T,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":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))})`),Ct(e,w),e.intersect=function(E){return ft.polygon(e,m,E)},i}v(Bw,"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 Aw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(i),g=xt(e,{fill:"none"});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const b=Qt(f).replace("Z",""),k=x.path(b,g),T=Qt(m),_=x.path(T,{...g}),w=i.insert("g",":first-child");return w.insert(()=>_,":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))})`),Ct(e,w),e.intersect=function(E){return ft.polygon(e,m,E)},i}v(Aw,"curlyBraceRight");function $e(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($e,"generateCirclePoints");async function Mw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=[...$e(c/2,-u/2,d,30,-90,0),{x:-c/2-d,y:d},...$e(c/2+d*2,-d,d,20,-180,-270),...$e(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:-u/2},...$e(c/2,u/2,d,20,0,90)],m=[...$e(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...$e(-c/2-d/2,-d,d,20,0,90),...$e(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...$e(-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},...$e(c/2,-u/2,d,20,-90,0),{x:-c/2-d,y:-d},...$e(c/2+d*2,-d,d,20,-180,-270),...$e(c/2+d*2,d,d,20,-90,-180),{x:-c/2-d,y:u/2},...$e(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},...$e(-c/2+d+d/2,-u/2,d,20,-90,-180),{x:c/2-d/2,y:d},...$e(-c/2-d/2,-d,d,20,0,90),...$e(-c/2-d/2,d,d,20,-90,0),{x:c/2-d/2,y:-d},...$e(-c/2+d+d/2,u/2,d,30,-180,-270)],g=gt.svg(i),y=xt(e,{fill:"none"});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const k=Qt(f).replace("Z",""),T=g.path(k,y),w=Qt(m).replace("Z",""),E=g.path(w,y),B=Qt(x),F=g.path(B,{...y}),N=i.insert("g",":first-child");return N.insert(()=>F,":first-child").attr("stroke-opacity",0),N.insert(()=>T,":first-child"),N.insert(()=>E,":first-child"),N.attr("class","text"),p&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),N.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))})`),Ct(e,N),e.intersect=function(M){return ft.polygon(e,x,M)},i}v(Mw,"curlyBraces");async function Iw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(c),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=d,b=p,k=y-f,T=b/4,_=[{x:k,y:0},{x:T,y:0},{x:0,y:b/2},{x:T,y:b},{x:k,y:b},...aa(-k,-b/2,f,50,270,90)],w=Qt(_),E=x.path(w,g),B=c.insert(()=>E,":first-child");return B.attr("class","basic label-container outer-path"),m&&e.look!=="handDrawn"&&B.selectChildren("path").attr("style",m),n&&e.look!=="handDrawn"&&B.selectChildren("path").attr("style",n),B.attr("transform",`translate(${-d/2}, ${-p/2})`),Ct(e,B),e.intersect=function(F){return ft.polygon(e,_,F)},c}v(Iw,"curvedTrapezoid");var Ez=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"),Nz=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"),jz=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Mx=8,Ix=8;async function Fw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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<Ix&&(e.width=Ix);const b=g/2/(2.5+g/50);e.height=(e.height??0)-s-b*3,e.height<Mx&&(e.height=Mx)}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=gt.svg(a),y=Nz(0,0,u,f,d,p),b=jz(0,p,u,f,d,p),k=xt(e,{}),T=g.path(y,k),_=g.path(b,xt(e,{fill:"none"}));m=a.insert(()=>_,":first-child"),m=a.insert(()=>T,":first-child"),m.attr("class","basic label-container"),x&&m.attr("style",x)}else{const g=Ez(0,0,u,f,d,p);m=a.insert("path",":first-child").attr("d",g).attr("class","basic label-container outer-path").attr("style",De(x)).attr("style",n)}return m.attr("label-offset-y",p),m.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),Ct(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=ft.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(Fw,"cylinder");async function Gs(t,e,r){const{labelStyles:n,nodeStyles:i}=yt(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=gt.svg(s),g=xt(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",De(m))}else d=s.insert("rect",":first-child"),d.attr("class","basic label-container").attr("style",i).attr("rx",De(p)).attr("ry",De(f)).attr("x",c).attr("y",u).attr("width",a).attr("height",l);return Ct(e,d),e.calcIntersect=function(x,g){return ft.rect(x,g)},e.intersect=function(x){return ft.rect(e,x)},s}v(Gs,"drawRect");async function Pw(t,e){const{cssClasses:r,labelPaddingX:n,labelPaddingY:i,padding:s,width:o,height:a}=e,l={rx:0,ry:0,labelPaddingX:n??(s??0)*2,labelPaddingY:i??s??0},c=await Gs(t,e,l);if(e.look==="handDrawn"){const f=gt.svg(c),m=xt(e,{}),x=c.select(".basic.label-container > path:nth-child(2)"),g=x.node();if(!g)return c;let y=null;if(g instanceof SVGGraphicsElement)y=g.getBBox();else return c;return c.insert(()=>f.line(y.x,y.y,y.x+y.width,y.y,m),".basic.label-container g.label"),c.insert(()=>f.line(y.x,y.y+y.height,y.x+y.width,y.y+y.height,m),".basic.label-container g.label"),x.remove(),c}const u=c.select(".basic.label-container"),d=(Number(u.attr("width"))||o)??0,p=(Number(u.attr("height"))||a)??0;return d>0&&p>0&&u.attr("stroke-dasharray",`${d} ${p}`),c}v(Pw,"datastore");async function Dw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(o),g=xt(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(T=>[T.x,T.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))})`),Ct(e,k),e.intersect=function(T){return ft.rect(e,T)},o}v(Dw,"dividedRectangle");async function Ow(t,e){var f,m;const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),g=xt(e,{roughness:.2,strokeWidth:2.5}),y=xt(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",De(e.cssClasses)).attr("style",De(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 Ct(e,d),e.intersect=function(x){return J.info("DoubleCircle intersect",e,c,x),ft.circle(e,c,x)},a}v(Ow,"doublecircle");function Rw(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=yt(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=gt.svg(s),{nodeBorder:c}=r,u=xt(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),Ct(e,p),e.intersect=function(f){return J.info("filledCircle intersect",e,{radius:o,point:f}),ft.circle(e,o,f)},s}v(Rw,"filledCircle");var Fx=10,Px=10;async function $w(t,e){const{labelStyles:r,nodeStyles:n}=yt(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<Fx&&(e.height=Fx),e.width=((e==null?void 0:e.width)??0)-s-s/2,e.width<Px&&(e.width=Px));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=gt.svg(o),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=Qt(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,Ct(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 J.info("Triangle intersect",e,p,k),ft.polygon(e,p,k)},o}v($w,"flippedTriangle");function zw(t,e,{dir:r,config:{state:n,themeVariables:i}}){const{nodeStyles:s}=yt(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=gt.svg(o),f=xt(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),Ct(e,x);const g=(n==null?void 0:n.padding)??0;return e.width&&e.height&&(e.width+=g/2||0,e.height+=g/2||0),e.intersect=function(y){return ft.rect(e,y)},o}v(zw,"forkJoin");async function Ww(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(l),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-u/2,y:-d/2},{x:u/2-p,y:-d/2},...aa(-u/2+p,0,p,50,90,270),{x:u/2-p,y:d/2},{x:-u/2,y:d/2}],y=Qt(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),Ct(e,k),e.intersect=function(T){return J.info("Pill intersect",e,{radius:p,point:T}),ft.polygon(e,g,T)},l}v(Ww,"halfRoundedRectangle");var Lz=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 qw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(u),k=xt(e,{}),T=Lz(0,0,m,p,f),_=b.path(T,k);g=u.insert(()=>_,":first-child").attr("transform",`translate(${-m/2}, ${p/2})`),y&&g.attr("style",y)}else g=En(u,m,p,x);return n&&g.attr("style",n),e.width=m,e.height=p,Ct(e,g),e.intersect=function(b){return ft.polygon(e,x,b)},u}v(qw,"hexagon");async function Hw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(i),c=xt(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=Qt(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})`),Ct(e,f),e.intersect=function(m){return J.info("Pill intersect",e,{points:u}),ft.polygon(e,u,m)},i}v(Hw,"hourglass");async function Uw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=yt(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}=Hs(e),y=-m/2,b=-f/2,k=e.label?8:0,T=gt.svg(c),_=xt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");const w=T.rectangle(y,b,m,f,_),E=Math.max(m,u.width),B=f+u.height+k,F=T.rectangle(-E/2,-B/2,E,B,{..._,fill:"transparent",stroke:"none"}),N=c.insert(()=>w,":first-child"),M=c.insert(()=>F);if(e.icon){const $=c.append("g");$.html(`<g>${await Ta(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const U=$.node().getBBox(),O=U.width,I=U.height,A=U.x,D=U.y;$.attr("transform",`translate(${-O/2-A},${p?u.height/2+k/2-I/2-D:-u.height/2-k/2-I/2-D})`),$.attr("style",`color: ${g.get("stroke")??x};`)}return d.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${p?-B/2:B/2-u.height})`),N.attr("transform",`translate(0,${p?u.height/2+k/2:-u.height/2-k/2})`),Ct(e,M),e.intersect=function($){if(J.info("iconSquare intersect",e,$),!e.label)return ft.rect(e,$);const U=e.x??0,O=e.y??0,I=e.height??0;let A=[];return p?A=[{x:U-u.width/2,y:O-I/2},{x:U+u.width/2,y:O-I/2},{x:U+u.width/2,y:O-I/2+u.height+k},{x:U+m/2,y:O-I/2+u.height+k},{x:U+m/2,y:O+I/2},{x:U-m/2,y:O+I/2},{x:U-m/2,y:O-I/2+u.height+k},{x:U-u.width/2,y:O-I/2+u.height+k}]:A=[{x:U-m/2,y:O-I/2},{x:U+m/2,y:O-I/2},{x:U+m/2,y:O-I/2+f},{x:U+u.width/2,y:O-I/2+f},{x:U+u.width/2/2,y:O+I/2},{x:U-u.width/2,y:O+I/2},{x:U-u.width/2,y:O-I/2+f},{x:U-m/2,y:O-I/2+f}],ft.polygon(e,A,$)},c}v(Uw,"icon");async function Gw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=yt(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}=Hs(e),b=gt.svg(c),k=xt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const T=y.get("fill");k.stroke=T??g;const _=c.append("g");e.icon&&_.html(`<g>${await Ta(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const w=_.node().getBBox(),E=w.width,B=w.height,F=w.x,N=w.y,M=Math.max(E,B)*Math.SQRT2+p*2,$=b.circle(0,0,M,k),U=Math.max(M,u.width),O=M+u.height+f,I=b.rectangle(-U/2,-O/2,U,O,{...k,fill:"transparent",stroke:"none"}),A=c.insert(()=>$,":first-child"),D=c.insert(()=>I);return _.attr("transform",`translate(${-E/2-F},${m?u.height/2+f/2-B/2-N:-u.height/2-f/2-B/2-N})`),_.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})`),A.attr("transform",`translate(0,${m?u.height/2+f/2:-u.height/2-f/2})`),Ct(e,D),e.intersect=function(R){return J.info("iconSquare intersect",e,R),ft.rect(e,R)},c}v(Gw,"iconCircle");async function Vw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=yt(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}=Hs(e),k=-x/2,T=-m/2,_=e.label?8:0,w=gt.svg(c),E=xt(e,{});e.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");const B=b.get("fill");E.stroke=B??y;const F=w.path(ei(k,T,x,m,5),E),N=Math.max(x,u.width),M=m+u.height+_,$=w.rectangle(-N/2,-M/2,N,M,{...E,fill:"transparent",stroke:"none"}),U=c.insert(()=>F,":first-child").attr("class","icon-shape2"),O=c.insert(()=>$);if(e.icon){const I=c.append("g");I.html(`<g>${await Ta(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const A=I.node().getBBox(),D=A.width,R=A.height,j=A.x,S=A.y;I.attr("transform",`translate(${-D/2-j},${f?u.height/2+_/2-R/2-S:-u.height/2-_/2-R/2-S})`),I.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-M/2:M/2-u.height})`),U.attr("transform",`translate(0,${f?u.height/2+_/2:-u.height/2-_/2})`),Ct(e,O),e.intersect=function(I){if(J.info("iconSquare intersect",e,I),!e.label)return ft.rect(e,I);const A=e.x??0,D=e.y??0,R=e.height??0;let j=[];return f?j=[{x:A-u.width/2,y:D-R/2},{x:A+u.width/2,y:D-R/2},{x:A+u.width/2,y:D-R/2+u.height+_},{x:A+x/2,y:D-R/2+u.height+_},{x:A+x/2,y:D+R/2},{x:A-x/2,y:D+R/2},{x:A-x/2,y:D-R/2+u.height+_},{x:A-u.width/2,y:D-R/2+u.height+_}]:j=[{x:A-x/2,y:D-R/2},{x:A+x/2,y:D-R/2},{x:A+x/2,y:D-R/2+m},{x:A+u.width/2,y:D-R/2+m},{x:A+u.width/2/2,y:D+R/2},{x:A-u.width/2,y:D+R/2},{x:A-u.width/2,y:D-R/2+m},{x:A-x/2,y:D-R/2+m}],ft.polygon(e,j,I)},c}v(Vw,"iconRounded");async function Yw(t,e,{config:{themeVariables:r,flowchart:n}}){const{labelStyles:i}=yt(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}=Hs(e),k=-x/2,T=-m/2,_=e.label?8:0,w=gt.svg(c),E=xt(e,{});e.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");const B=b.get("fill");E.stroke=B??y;const F=w.path(ei(k,T,x,m,.1),E),N=Math.max(x,u.width),M=m+u.height+_,$=w.rectangle(-N/2,-M/2,N,M,{...E,fill:"transparent",stroke:"none"}),U=c.insert(()=>F,":first-child"),O=c.insert(()=>$);if(e.icon){const I=c.append("g");I.html(`<g>${await Ta(e.icon,{height:a,width:a,fallbackPrefix:""})}</g>`);const A=I.node().getBBox(),D=A.width,R=A.height,j=A.x,S=A.y;I.attr("transform",`translate(${-D/2-j},${f?u.height/2+_/2-R/2-S:-u.height/2-_/2-R/2-S})`),I.attr("style",`color: ${b.get("stroke")??g};`)}return p.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${f?-M/2:M/2-u.height})`),U.attr("transform",`translate(0,${f?u.height/2+_/2:-u.height/2-_/2})`),Ct(e,O),e.intersect=function(I){if(J.info("iconSquare intersect",e,I),!e.label)return ft.rect(e,I);const A=e.x??0,D=e.y??0,R=e.height??0;let j=[];return f?j=[{x:A-u.width/2,y:D-R/2},{x:A+u.width/2,y:D-R/2},{x:A+u.width/2,y:D-R/2+u.height+_},{x:A+x/2,y:D-R/2+u.height+_},{x:A+x/2,y:D+R/2},{x:A-x/2,y:D+R/2},{x:A-x/2,y:D-R/2+u.height+_},{x:A-u.width/2,y:D-R/2+u.height+_}]:j=[{x:A-x/2,y:D-R/2},{x:A+x/2,y:D-R/2},{x:A+x/2,y:D-R/2+m},{x:A+u.width/2,y:D-R/2+m},{x:A+u.width/2/2,y:D+R/2},{x:A-u.width/2,y:D+R/2},{x:A-u.width/2,y:D-R/2+m},{x:A-x/2,y:D-R/2+m}],ft.polygon(e,j,I)},c}v(Yw,"iconSquare");async function Xw(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}=yt(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=gt.svg(d),k=xt(e,{});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");const T=b.rectangle(x,g,c,u,k),_=Math.max(c,p.width),w=u+p.height+y,E=b.rectangle(-_/2,-w/2,_,w,{...k,fill:"none",stroke:"none"}),B=d.insert(()=>T,":first-child"),F=d.insert(()=>E);if(e.img){const N=d.append("image");N.attr("href",e.img),N.attr("width",c),N.attr("height",u),N.attr("preserveAspectRatio","none"),N.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})`),B.attr("transform",`translate(0,${m?p.height/2+y/2:-p.height/2-y/2})`),Ct(e,F),e.intersect=function(N){if(J.info("iconSquare intersect",e,N),!e.label)return ft.rect(e,N);const M=e.x??0,$=e.y??0,U=e.height??0;let O=[];return m?O=[{x:M-p.width/2,y:$-U/2},{x:M+p.width/2,y:$-U/2},{x:M+p.width/2,y:$-U/2+p.height+y},{x:M+c/2,y:$-U/2+p.height+y},{x:M+c/2,y:$+U/2},{x:M-c/2,y:$+U/2},{x:M-c/2,y:$-U/2+p.height+y},{x:M-p.width/2,y:$-U/2+p.height+y}]:O=[{x:M-c/2,y:$-U/2},{x:M+c/2,y:$-U/2},{x:M+c/2,y:$-U/2+u},{x:M+p.width/2,y:$-U/2+u},{x:M+p.width/2/2,y:$+U/2},{x:M-p.width/2,y:$+U/2},{x:M-p.width/2,y:$-U/2+u},{x:M-c/2,y:$-U/2+u}],ft.polygon(e,O,N)},d}v(Xw,"imageSquare");async function Kw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),x=xt(e,{}),g=Qt(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=En(a,c,u,d);return n&&p.attr("style",n),e.width=c,e.height=u,Ct(e,p),e.intersect=function(m){return ft.polygon(e,d,m)},a}v(Kw,"inv_trapezoid");async function Zw(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))})`),Ct(e,s),e.intersect=function(l){return ft.rect(e,l)},r}v(Zw,"labelRect");async function Qw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),x=xt(e,{}),g=Qt(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=En(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,Ct(e,p),e.intersect=function(m){return ft.polygon(e,d,m)},a}v(Qw,"lean_left");async function Jw(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),x=xt(e,{}),g=Qt(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=En(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,Ct(e,p),e.intersect=function(m){return ft.polygon(e,d,m)},a}v(Jw,"lean_right");function t2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(i),d=xt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");const p=Qt(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})`),Ct(e,m),e.intersect=function(x){return J.info("lightningBolt intersect",e,x),ft.polygon(e,c,x)},i}v(t2,"lightningBolt");var Bz=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"),Az=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"),Mz=v((t,e,r,n,i,s)=>[`M${t-r/2},${-n/2}`,`a${i},${s} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),Dx=10,Ox=10;async function e2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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<Ox&&(e.width=Ox);const k=y/2/(2.5+y/50);e.height=(e.height??0)-o-k*3,e.height<Dx&&(e.height=Dx)}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=gt.svg(a),b=Az(0,0,u,f,d,p,m),k=Mz(0,p,u,f,d,p),T=xt(e,{}),_=y.path(b,T),w=y.path(k,T);a.insert(()=>w,":first-child").attr("class","line"),x=a.insert(()=>_,":first-child"),x.attr("class","basic label-container"),g&&x.attr("style",g)}else{const y=Bz(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",De(g)).attr("style",n)}return x.attr("label-offset-y",p),x.attr("transform",`translate(${-u/2}, ${-(f/2+p)})`),Ct(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=ft.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 T=p*p*(1-k*k/(d*d));T>0&&(T=Math.sqrt(T)),T=p-T,y.y-(e.y??0)>0&&(T=-T),b.y+=T}return b},a}v(e2,"linedCylinder");async function r2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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 T=e.width;e.width=(T??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=gt.svg(a),g=xt(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},...Xn(-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(T=>[T.x,T.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))})`),Ct(e,k),e.intersect=function(T){return ft.polygon(e,y,T)},a}v(r2,"linedWaveEdgedRect");async function n2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(l),k=xt(e,{}),T=[{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}],_=[{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=Qt(T);let E=b.path(w,k);const B=Qt(_);let F=b.path(B,k);e.look!=="handDrawn"&&(E=Fd(E),F=Fd(F));const N=l.insert("g",":first-child");return N.insert(()=>E),N.insert(()=>F),N.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),u.attr("transform",`translate(${-(c.width/2)-a-(c.x-(c.left??0))}, ${-(c.height/2)+a-(c.y-(c.top??0))})`),Ct(e,N),e.intersect=function(M){return ft.polygon(e,T,M)},l}v(n2,"multiRect");async function i2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=Xn(x-y,g+m+y,x+d-y,g+m+y,f,.8),T=k==null?void 0:k[k.length-1],_=[{x:x-y,y:g+y},{x:x-y,y:g+m+y},...k,{x:x+d-y,y:T.y-y},{x:x+d,y:T.y-y},{x:x+d,y:T.y-2*y},{x:x+d+y,y:T.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:T.y-y},{x:x+d,y:T.y-y},{x:x+d,y:g},{x,y:g}],E=gt.svg(i),B=xt(e,{});e.look!=="handDrawn"&&(B.roughness=0,B.fillStyle="solid");const F=Qt(_),N=E.path(F,B),M=Qt(w),$=E.path(M,B),U=i.insert(()=>N,":first-child");return U.insert(()=>$),U.attr("class","basic label-container outer-path"),b&&e.look!=="handDrawn"&&U.selectAll("path").attr("style",b),n&&e.look!=="handDrawn"&&U.selectAll("path").attr("style",n),U.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))})`),Ct(e,U),e.intersect=function(O){return ft.polygon(e,_,O)},i}v(i2,"multiWaveEdgedRectangle");async function s2(t,e,{config:{themeVariables:r}}){const{labelStyles:n,nodeStyles:i}=yt(e);e.labelStyle=n,e.useHtmlLabels||sr(ge())||(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=gt.svg(o),x=xt(e,{fill:r.noteBkgColor,stroke:r.noteBorderColor});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=m.rectangle(d,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))})`),Ct(e,y),e.intersect=function(b){return ft.rect(e,b)},o}v(s2,"note");var Iz=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 o2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(i),m=xt(e,{}),x=Iz(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=En(i,l,l,u),d.attr("transform",`translate(${-l/2+c}, ${l/2})`);return n&&d.attr("style",n),Ct(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=ft.polygon(f,g,m);return{x:y.x-.5,y:y.y-.5}},e.intersect=function(f){return this.calcIntersect(e,f)},i}v(o2,"question");async function a2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),b=xt(e,{});e.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");const k=Qt(x),T=y.path(k,b),_=a.insert(()=>T,":first-child");return _.attr("class","basic label-container outer-path"),g&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",g),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${-m/2},0)`),c.attr("transform",`translate(${-m/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),Ct(e,_),e.intersect=function(w){return ft.polygon(e,x,w)},a}v(a2,"rect_left_inv_arrow");async function l2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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 Rn(a,c,e.labelStyle,!0,!0);let d={width:0,height:0};if(sr(ee())){const B=u.children[0],F=Gt(u);d=B.getBoundingClientRect(),F.attr("width",d.width),F.attr("height",d.height)}J.info("Text 2",l);const p=l||[],f=u.getBBox(),m=await Rn(a,Array.isArray(p)?p.join("<br/>"):p,e.labelStyle,!0,!0),x=m.children[0],g=Gt(m);d=x.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height);const y=(e.padding||0)/2;Gt(m).attr("transform","translate( "+(d.width>f.width?0:(f.width-d.width)/2)+", "+(f.height+y+5)+")"),Gt(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),T=-d.width/2-y,_=-d.height/2-y;let w,E;if(e.look==="handDrawn"){const B=gt.svg(s),F=xt(e,{}),N=B.path(ei(T,_,b,k,e.rx||0),F),M=B.line(-d.width/2-y,-d.height/2-y+f.height+y,d.width/2+y,-d.height/2-y+f.height+y,F);E=s.insert(()=>(J.debug("Rough node insert CXC",N),M),":first-child"),w=s.insert(()=>(J.debug("Rough node insert CXC",N),N),":first-child")}else w=o.insert("rect",":first-child"),E=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)),E.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 Ct(e,w),e.intersect=function(B){return ft.rect(e,B)},s}v(l2,"rectWithTitle");async function c2(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 Gs(t,e,i)}v(c2,"roundedRect");var li=8;async function h2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(o),y=xt(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(_=>[_.x,_.y]),y),T=o.insert(()=>k,":first-child");return T.attr("class","basic label-container outer-path").attr("style",De(x)),n&&e.look!=="handDrawn"&&T.selectAll("path").attr("style",n),x&&e.look!=="handDrawn"&&T.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))})`),Ct(e,T),e.intersect=function(_){return ft.rect(e,_)},o}v(h2,"shadedProcess");async function u2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),b=xt(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}],T=Qt(k),_=y.path(T,b),w=a.insert(()=>_,":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))})`),Ct(e,w),e.intersect=function(E){return ft.polygon(e,k,E)},a}v(u2,"slopedRect");async function d2(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 Gs(t,e,s)}v(d2,"squareRect");async function f2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),m=xt(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},...aa(-u/2+d,0,d,50,90,270),{x:u/2-d,y:c/2},...aa(u/2-d,0,d,50,270,450)],g=Qt(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),Ct(e,b),e.intersect=function(k){return ft.polygon(e,x,k)},a}v(f2,"stadium");async function p2(t,e){const r={rx:e.look==="neo"?3:5,ry:e.look==="neo"?3:5};return Gs(t,e,r)}v(p2,"state");function m2(t,e,{config:{themeVariables:r}}){var b,k;const{labelStyles:n,nodeStyles:i}=yt(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=gt.svg(u),p=xt(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 T=((k=(b=t.node())==null?void 0:b.ownerSVGElement)==null?void 0:k.id)??"",_=T?`${T}-drop-shadow-small`:"drop-shadow-small";y.attr("style",`filter:url(#${_})`)}return Ct(e,y),e.intersect=function(T){return ft.circle(e,(e.width??0)/2,T)},u}v(m2,"stateEnd");function g2(t,e,{config:{themeVariables:r}}){var a,l;const{lineColor:n,nodeShadow:i}=r;(e.width||e.height)&&((e.width??0)<14&&(e.width=14),(e.height??0)<14&&(e.height=14)),e.width||(e.width=14),e.height||(e.height=14);const s=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let o;if(e.look==="handDrawn"){const u=gt.svg(s).circle(0,0,e.width,q6(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 Ct(e,o),e.intersect=function(c){return ft.circle(e,(e.width??7)/2,c)},s}v(g2,"stateStart");var Ui=8;async function x2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),y=xt(e,{}),b=g.rectangle(f,m,d+16,p,y),k=g.line(f+Ui,m,f+Ui,m+p,y),T=g.line(f+Ui+d,m,f+Ui+d,m+p,y);a.insert(()=>k,":first-child"),a.insert(()=>T,":first-child");const _=a.insert(()=>b,":first-child"),{cssStyles:w}=e;_.attr("class","basic label-container").attr("style",De(w)),Ct(e,_)}else{const g=En(a,d,p,x);n&&g.attr("style",n),Ct(e,g)}return e.intersect=function(g){return ft.polygon(e,x,g)},a}v(x2,"subroutine");var cu=.2;async function y2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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-cu*(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=cu*c,d=cu*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=gt.svg(a),k=xt(e,{}),T=[{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}],_=[{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=Qt(T),E=b.path(w,k),B=Qt(_),F=b.path(B,{...k,fillStyle:"solid"}),N=a.insert(()=>F,":first-child");return N.insert(()=>E,":first-child"),N.attr("class","basic label-container outer-path"),y&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",y),n&&e.look!=="handDrawn"&&N.selectAll("path").attr("style",n),Ct(e,N),e.intersect=function(M){return ft.polygon(e,T,M)},a}v(y2,"taggedRect");async function b2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(i),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-a/2-a/2*.1,y:p/2},...Xn(-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},...Xn(y+a,(b+l)*1.25,y+a-u,(b+l)*1.3,-l*.02,.5)],T=Qt(g),_=m.path(T,x),w=Qt(k),E=m.path(w,{...x,fillStyle:"solid"}),B=i.insert(()=>E,":first-child");return B.insert(()=>_,":first-child"),B.attr("class","basic label-container outer-path"),f&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",n),B.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))})`),Ct(e,B),e.intersect=function(F){return ft.polygon(e,g,F)},i}v(b2,"taggedWaveEdgedRectangle");async function C2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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),Ct(e,u),e.intersect=function(d){return ft.rect(e,d)},i}v(C2,"text");var Fz=v((t,e,r,n,i,s)=>`M${t},${e}
571
- a${i},${s} 0,0,1 0,${-n}
572
- l${r},0
573
- a${i},${s} 0,0,1 0,${n}
574
- M${r},${-n}
575
- a${i},${s} 0,0,0 0,${n}
576
- l${-r},0`,"createCylinderPathD"),Pz=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"),Dz=v((t,e,r,n,i,s)=>[`M${t+r/2},${-n/2}`,`a${i},${s} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD"),Rx=5,$x=10;async function k2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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<Rx&&(e.height=Rx);const y=x/2/(2.5+x/50);e.width=(e.width??0)-s-y*3,e.width<$x&&(e.width=$x)}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=gt.svg(o),g=Pz(0,0,p,c,d,u),y=Dz(0,0,p,c,d,u),b=x.path(g,xt(e,{})),k=x.path(y,xt(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=Fz(0,0,p,c,d,u);m=o.insert("path",":first-child").attr("d",x).attr("class","basic label-container").attr("style",De(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))})`),Ct(e,m),e.intersect=function(x){const g=ft.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(k2,"tiltedCylinder");async function v2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(a),x=xt(e,{}),g=Qt(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=En(a,u,c,d);return n&&p.attr("style",n),e.width=u,e.height=c,Ct(e,p),e.intersect=function(m){return ft.polygon(e,d,m)},a}v(v2,"trapezoid");async function w2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(c),x=xt(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=Qt(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),Ct(e,k),e.intersect=function(T){return ft.polygon(e,g,T)},c}v(w2,"trapezoidalPentagon");var zx=10,Wx=10;async function S2(t,e){var T;const{labelStyles:r,nodeStyles:n}=yt(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<Wx&&(e.width=Wx),e.height=(e==null?void 0:e.height)??0,e.height<zx&&(e.height=zx));const{shapeSvg:o,bbox:a,label:l}=await It(t,e,At(e)),c=Tn((T=ee().flowchart)==null?void 0:T.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=gt.svg(o),g=xt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");const y=Qt(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,Ct(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(_){return J.info("Triangle intersect",e,f,_),ft.polygon(e,f,_)},o}v(S2,"triangle");async function T2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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=gt.svg(l),T=xt(e,{});e.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");const _=[{x:-d/2-b,y:m/2},...Xn(-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=Qt(_),E=k.path(w,T),B=l.insert(()=>E,":first-child");return B.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&B.selectAll("path").attr("style",n),B.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))})`),Ct(e,B),e.intersect=function(F){return ft.polygon(e,_,F)},l}v(T2,"waveEdgedRectangle");async function _2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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 T=Math.min(e.height*.2,e.height/4);e.height=Math.ceil(e.height-o-T*(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=gt.svg(a),x=xt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");const g=[{x:-c/2,y:p/2},...Xn(-c/2,p/2,c/2,p/2,d,1),{x:c/2,y:-p/2},...Xn(c/2,-p/2,-c/2,-p/2,d,-1)],y=Qt(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),Ct(e,k),e.intersect=function(T){return ft.polygon(e,g,T)},a}v(_2,"waveRectangle");var we=10;async function E2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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-we,10),e.height=Math.max(((e==null?void 0:e.height)??0)-s*2-we,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+we,u=(e!=null&&e.height?e==null?void 0:e.height:a.height)+s*2+we,d=c-we,p=u-we,f=-d/2,m=-p/2,{cssStyles:x}=e,g=gt.svg(o),y=xt(e,{}),b=[{x:f-we,y:m-we},{x:f-we,y:m+p},{x:f+d,y:m+p},{x:f+d,y:m-we}],k=`M${f-we},${m-we} L${f+d},${m-we} L${f+d},${m+p} L${f-we},${m+p} L${f-we},${m-we}
577
- M${f-we},${m} L${f+d},${m}
578
- M${f},${m-we} L${f},${m+p}`;e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");const T=g.path(k,y),_=o.insert(()=>T,":first-child");return _.attr("transform",`translate(${we/2}, ${we/2})`),_.attr("class","basic label-container outer-path"),x&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",x),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),l.attr("transform",`translate(${-(a.width/2)+we/2-(a.x-(a.left??0))}, ${-(a.height/2)+we/2-(a.y-(a.top??0))})`),Ct(e,_),e.intersect=function(w){return ft.polygon(e,b,w)},o}v(E2,"windowPane");var qx=new Set(["redux-color","redux-dark-color"]),Oz=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);async function Pp(t,e){var Q,kt,wt,lt;const r=e;r.alias&&(e.label=r.alias);const{theme:n,themeVariables:i}=ge(),{rowEven:s,rowOdd:o,nodeBorder:a,borderColorArray:l}=i;if(e.look==="handDrawn"){const{themeVariables:Z}=ge(),{background:at}=Z,vt={...e,id:e.id+"-background",domId:(e.domId||e.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${at}`]};await Pp(t,vt)}const c=ge();e.useHtmlLabels=c.htmlLabels;let u=((Q=c.er)==null?void 0:Q.diagramPadding)??10,d=((kt=c.er)==null?void 0:kt.entityPadding)??6;const{cssStyles:p}=e,{labelStyles:f,nodeStyles:m}=yt(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 Gs(t,e,Z);if(n!=null&&qx.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"),Mt=(wt=vt.node())==null?void 0:wt.getBBox();vt.attr("transform",`translate(${-Mt.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 rs(g,e.label??"",c,0,0,["name"],f);y.height+=d;let b=0;const k=[],T=[];let _=0,w=0,E=0,B=0,F=!0,N=!0;for(const Z of r.attributes){const at=await rs(g,Z.type,c,0,b,["attribute-type"],f);_=Math.max(_,at.width+u);const vt=await rs(g,Z.name,c,0,b,["attribute-name"],f);w=Math.max(w,vt.width+u);const Mt=await rs(g,Z.keys.join(),c,0,b,["attribute-keys"],f);E=Math.max(E,Mt.width+u);const Dt=await rs(g,Z.comment,c,0,b,["attribute-comment"],f);B=Math.max(B,Dt.width+u);const ce=Math.max(at.height,vt.height,Mt.height,Dt.height)+d;T.push({yOffset:b,rowHeight:ce}),b+=ce}let M=4;E<=u&&(F=!1,E=0,M--),B<=u&&(N=!1,B=0,M--);const $=g.node().getBBox();if(y.width+u*2-(_+w+E+B)>0){const Z=y.width+u*2-(_+w+E+B);_+=Z/M,w+=Z/M,E>0&&(E+=Z/M),B>0&&(B+=Z/M)}const U=_+w+E+B,O=gt.svg(g),I=xt(e,{});e.look!=="handDrawn"&&(I.roughness=0,I.fillStyle="solid");let A=0;T.length>0&&(A=T.reduce((Z,at)=>Z+((at==null?void 0:at.rowHeight)??0),0));const D=Math.max($.width+u*2,(e==null?void 0:e.width)||0,U),R=Math.max((A??0)+y.height,(e==null?void 0:e.height)||0),j=-D/2,S=-R/2;if(g.selectAll("g:not(:first-child)").each((Z,at,vt)=>{const Mt=Gt(vt[at]),Dt=Mt.attr("transform");let ce=0,oe=0;if(Dt){const Zt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(Dt);Zt&&(ce=parseFloat(Zt[1]),oe=parseFloat(Zt[2]),Mt.attr("class").includes("attribute-name")?ce+=_:Mt.attr("class").includes("attribute-keys")?ce+=_+w:Mt.attr("class").includes("attribute-comment")&&(ce+=_+w+E))}Mt.attr("transform",`translate(${j+u/2+ce}, ${oe+S+y.height+d/2})`)}),g.select(".name").attr("transform","translate("+-y.width/2+", "+(S+d/2)+")"),n!=null&&qx.has(n)){const Z=r.colorIndex??0;g.attr("data-color-id",`color-${Z%l.length}`)}const W=O.rectangle(j,S,D,R,I),K=g.insert(()=>W,":first-child").attr("class","outer-path").attr("style",p.join(""));k.push(0);for(const[Z,at]of T.entries()){const Mt=(Z+1)%2===0&&at.yOffset!==0,Dt=O.rectangle(j,y.height+S+(at==null?void 0:at.yOffset),D,at==null?void 0:at.rowHeight,{...I,fill:Mt?s:o,stroke:a});g.insert(()=>Dt,"g.label").attr("style",p.join("")).attr("class",`row-rect-${Mt?"even":"odd"}`)}const P=1e-4;let st=ns(j,y.height+S,D+j,y.height+S,P),ct=O.polygon(st.map(Z=>[Z.x,Z.y]),I);if(g.insert(()=>ct).attr("class","divider"),st=ns(_+j,y.height+S,_+j,R+S,P),ct=O.polygon(st.map(Z=>[Z.x,Z.y]),I),g.insert(()=>ct).attr("class","divider"),F){const Z=_+w+j;st=ns(Z,y.height+S,Z,R+S,P),ct=O.polygon(st.map(at=>[at.x,at.y]),I),g.insert(()=>ct).attr("class","divider")}if(N){const Z=_+w+E+j;st=ns(Z,y.height+S,Z,R+S,P),ct=O.polygon(st.map(at=>[at.x,at.y]),I),g.insert(()=>ct).attr("class","divider")}for(const Z of k){const at=y.height+S+Z;st=ns(j,at,D+j,at,P),ct=O.polygon(st.map(vt=>[vt.x,vt.y]),I),g.insert(()=>ct).attr("class","divider")}if(Ct(e,K),m&&e.look!=="handDrawn")if(n!=null&&Oz.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 ft.rect(e,Z)},g}v(Pp,"erBox");async function rs(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!==Mg(e)&&(e=Mg(e),e=e.replaceAll("<","&lt;").replaceAll(">","&gt;"));const l=a.node().appendChild(await _n(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=Gt(l);c=u.getBoundingClientRect(),d.attr("width",c.width),d.attr("height",c.height)}return c}v(rs,"addText");function ns(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(ns,"lineToPolygon");async function N2(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 Io(a,{text:`«${b}»`},0),d=a.node().getBBox().height}l=o.insert("g").attr("class","label-group text"),await Io(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 Io(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 Io(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(N2,"textHelper");async function Io(t,e,r,n=[]){const i=t.insert("g").attr("class","label").attr("style",n.join("; ")),s=ge();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)),Qo(a)&&(o=!0);const l=await _n(i,Uf(Ti(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=Gt(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,_=parseInt(k,10)*5+"px";x.style.minWidth=_,x.style.maxWidth=_}else x.style.width="100%";g(x)}v(y,"setupImage"),setTimeout(()=>{x.complete&&y()}),x.addEventListener("error",y),x.addEventListener("load",y)})))}c=d.getBoundingClientRect(),p.attr("width",c.width),p.attr("height",c.height)}else{n.includes("font-weight: bolder")&&Gt(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(Io,"addText");async function j2(t,e){var O,I;const r=ee(),{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 N2(t,e,r,a,o),{labelStyles:d,nodeStyles:p}=yt(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=gt.svg(c),g=xt(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 T=-y/2,_=-b/2;let w=m?s*2:l.members.length===0&&l.methods.length===0?-s:0;k&&(w=s*2);const E=x.rectangle(T-s,_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0),y+2*s,b+2*s+w,g),B=c.insert(()=>E,":first-child");B.attr("class","basic label-container outer-path");const F=B.node().getBBox(),N=c.select(".annotation-group").node().getBBox().height-(m?s/2:0)||0,M=c.select(".label-group").node().getBBox().height-(m?s/2:0)||0,$=c.select(".members-group").node().getBBox().height-(m?s/2:0)||0,U=(N+M+_+s-(_-s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0)))/2;if(c.selectAll(".text").each((A,D,R)=>{var st,ct;const j=Gt(R[D]),S=j.attr("transform");let W=0;if(S){const kt=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(S);kt&&(W=parseFloat(kt[2]))}let K=W+_+s-(m?s:l.members.length===0&&l.methods.length===0?-s/2:0);if(j.attr("class").includes("methods-group")){const Q=Math.max($,o/2);k?K=Math.max(U,N+M+Q+_+o*2+s)+o*2:K=N+M+Q+_+o*4+s}l.members.length===0&&l.methods.length===0&&((st=r.class)!=null&&st.hideEmptyMembersBox)&&(l.annotations.length>0?K=W-o:K=W),a||(K-=4);let P=T;(j.attr("class").includes("label-group")||j.attr("class").includes("annotation-group"))&&(P=-((ct=j.node())==null?void 0:ct.getBBox().width)/2||0,c.selectAll("text").each(function(Q,kt,wt){window.getComputedStyle(wt[kt]).textAnchor==="middle"&&(P=0)})),j.attr("transform",`translate(${P}, ${K})`)}),l.members.length>0||l.methods.length>0||m){const A=N+M+_+s,D=x.line(F.x,A,F.x+F.width,A+.001,g);c.insert(()=>D).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(m||l.members.length>0||l.methods.length>0){const A=N+M+$+_+o*2+s,D=x.line(F.x,k?Math.max(U,A):A,F.x+F.width,(k?Math.max(U,A):A)+.001,g);c.insert(()=>D).attr("class",`divider${e.look==="neo"&&!i?" neo-line":""}`).attr("style",f)}if(l.look!=="handDrawn"&&c.selectAll("path").attr("style",f),B.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 A=RegExp(/color\s*:\s*([^;]*)/),D=A.exec(f);if(D){const R=D[0].replace("color","fill");c.selectAll("tspan").attr("style",R)}else if(d){const R=A.exec(d);if(R){const j=R[0].replace("color","fill");c.selectAll("tspan").attr("style",j)}}}return Ct(e,B),e.intersect=function(A){return ft.rect(e,A)},c}v(j2,"classBox");async function L2(t,e){var F,N;const{labelStyles:r,nodeStyles:n}=yt(e);e.labelStyle=r;const i=e,s=e,o=20,a=20,l="verifyMethod"in e,c=At(e),{themeVariables:u}=ee(),{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 M=await Jr(f,`${i.requirementId?`ID: ${i.requirementId}`:""}`,x,e.labelStyle);x+=M;const $=await Jr(f,`${i.text?`Text: ${i.text}`:""}`,x,e.labelStyle);x+=$;const U=await Jr(f,`${i.risk?`Risk: ${i.risk}`:""}`,x,e.labelStyle);x+=U,await Jr(f,`${i.verifyMethod?`Verification: ${i.verifyMethod}`:""}`,x,e.labelStyle)}else{const M=await Jr(f,`${s.type?`Type: ${s.type}`:""}`,x,e.labelStyle);x+=M,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=(((N=f.node())==null?void 0:N.getBBox().height)??200)+o,k=-y/2,T=-b/2,_=gt.svg(f),w=xt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");const E=_.rectangle(k,T,y,b,w),B=f.insert(()=>E,":first-child");if(B.attr("class","basic label-container outer-path").attr("style",n),d!=null&&d.length){const M=e.colorIndex??0;f.attr("data-color-id",`color-${M%d.length}`)}if(f.selectAll(".label").each((M,$,U)=>{const O=Gt(U[$]),I=O.attr("transform");let A=0,D=0;if(I){const W=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(I);W&&(A=parseFloat(W[1]),D=parseFloat(W[2]))}const R=D-b/2;let j=k+o/2;($===0||$===1)&&(j=A),O.attr("transform",`translate(${j}, ${R+o})`)}),x>m+g+a){const M=T+m+g+a;let $;if(e.look==="neo"){const I=[[k,M],[k+y,M],[k+y,M+.001],[k,M+.001]];$=_.polygon(I,w)}else $=_.line(k,M,k+y,M,w);f.insert(()=>$).attr("class","divider")}return Ct(e,B),e.intersect=function(M){return ft.rect(e,M)},n&&e.look!=="handDrawn"&&(p||d!=null&&d.length)&&f.selectAll("path").attr("style",n),f}v(L2,"requirementBox");async function Jr(t,e,r,n=""){if(e==="")return 0;const i=t.insert("g").attr("class","label").attr("style",n),s=ee(),o=s.htmlLabels??!0,a=await _n(i,Uf(Ti(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=Gt(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 Rz=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 B2(t,e,{config:r}){var $,U;const{labelStyles:n,nodeStyles:i}=yt(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&&(($=r==null?void 0:r.kanban)!=null&&$.ticketBaseUrl)&&(d=(U=r==null?void 0:r.kanban)==null?void 0:U.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 lu(p,"ticket"in e&&e.ticket||"",f):{label:m,bbox:x}=await lu(a,"ticket"in e&&e.ticket||"",f);const{label:g,bbox:y}=await lu(a,"assigned"in e&&e.assigned||"",f);e.width=o;const b=10,k=(e==null?void 0:e.width)||0,T=Math.max(x.height,y.height)/2,_=Math.max(l.height+b*2,(e==null?void 0:e.height)||0)+T,w=-k/2,E=-_/2;c.attr("transform","translate("+(u-k/2)+", "+(-T-l.height/2)+")"),m.attr("transform","translate("+(u-k/2)+", "+(-T+l.height/2)+")"),g.attr("transform","translate("+(u+k/2-y.width-2*s)+", "+(-T+l.height/2)+")");let B;const{rx:F,ry:N}=e,{cssStyles:M}=e;if(e.look==="handDrawn"){const O=gt.svg(a),I=xt(e,{}),A=F||N?O.path(ei(w,E,k,_,F||0),I):O.rectangle(w,E,k,_,I);B=a.insert(()=>A,":first-child"),B.attr("class","basic label-container").attr("style",M||null)}else{B=a.insert("rect",":first-child"),B.attr("class","basic label-container __APA__").attr("style",i).attr("rx",F??5).attr("ry",N??5).attr("x",w).attr("y",E).attr("width",k).attr("height",_);const O="priority"in e&&e.priority;if(O){const I=a.append("line"),A=w+2,D=E+Math.floor((F??0)/2),R=E+_-Math.floor((F??0)/2);I.attr("x1",A).attr("y1",D).attr("x2",A).attr("y2",R).attr("stroke-width","4").attr("stroke",Rz(O))}}return Ct(e,B),e.height=_,e.intersect=function(O){return ft.rect(e,O)},a}v(B2,"kanbanItem");async function A2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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
579
- a${u},${u} 1 0,0 ${m*.25},${-1*x*.1}
580
- a${u},${u} 1 0,0 ${m*.25},0
581
- a${u},${u} 1 0,0 ${m*.25},0
582
- a${u},${u} 1 0,0 ${m*.25},${x*.1}
583
-
584
- a${u},${u} 1 0,0 ${m*.15},${x*.33}
585
- a${u*.8},${u*.8} 1 0,0 0,${x*.34}
586
- a${u},${u} 1 0,0 ${-1*m*.15},${x*.33}
587
-
588
- a${u},${u} 1 0,0 ${-1*m*.25},${x*.15}
589
- a${u},${u} 1 0,0 ${-1*m*.25},0
590
- a${u},${u} 1 0,0 ${-1*m*.25},0
591
- a${u},${u} 1 0,0 ${-1*m*.25},${-1*x*.15}
592
-
593
- a${u},${u} 1 0,0 ${-1*m*.1},${-1*x*.33}
594
- a${u*.8},${u*.8} 1 0,0 0,${-1*x*.34}
595
- a${u},${u} 1 0,0 ${m*.1},${-1*x*.33}
596
- H0 V0 Z`;if(e.look==="handDrawn"){const b=gt.svg(i),k=xt(e,{}),T=b.path(y,k);g=i.insert(()=>T,":first-child"),g.attr("class","basic label-container").attr("style",De(d))}else g=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",y);return g.attr("transform",`translate(${-m/2}, ${-x/2})`),Ct(e,g),e.calcIntersect=function(b,k){return ft.rect(b,k)},e.intersect=function(b){return J.info("Bang intersect",e,b),ft.rect(e,b)},i}v(A2,"bang");async function M2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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
597
- a${u},${u} 0 0,1 ${l*.25},${-1*l*.1}
598
- a${p},${p} 1 0,1 ${l*.4},${-1*l*.1}
599
- a${d},${d} 1 0,1 ${l*.35},${l*.2}
600
-
601
- a${u},${u} 1 0,1 ${l*.15},${c*.35}
602
- a${f},${f} 1 0,1 ${-1*l*.15},${c*.65}
603
-
604
- a${d},${u} 1 0,1 ${-1*l*.25},${l*.15}
605
- a${p},${p} 1 0,1 ${-1*l*.5},0
606
- a${u},${u} 1 0,1 ${-1*l*.25},${-1*l*.15}
607
-
608
- a${u},${u} 1 0,1 ${-1*l*.1},${-1*c*.35}
609
- a${f},${f} 1 0,1 ${l*.1},${-1*c*.65}
610
- H0 V0 Z`;if(e.look==="handDrawn"){const y=gt.svg(i),b=xt(e,{}),k=y.path(g,b);x=i.insert(()=>k,":first-child"),x.attr("class","basic label-container").attr("style",De(m))}else x=i.insert("path",":first-child").attr("class","basic label-container").attr("style",n).attr("d",g);return a.attr("transform",`translate(${-s.width/2}, ${-s.height/2})`),x.attr("transform",`translate(${-l/2}, ${-c/2})`),Ct(e,x),e.calcIntersect=function(y,b){return ft.rect(y,b)},e.intersect=function(y){return J.info("Cloud intersect",e,y),ft.rect(e,y)},i}v(M2,"cloud");async function I2(t,e){const{labelStyles:r,nodeStyles:n}=yt(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"?`
611
- M${-l/2} ${c/2-u}
612
- v${-c+2*u}
613
- q0,-${u} ${u},-${u}
614
- h${l-2*u}
615
- q${u},0 ${u},${u}
616
- v${c-u}
617
- H${-l/2}
618
- Z
619
- `:`
620
- M${-l/2} ${c/2-u}
621
- v${-c+2*u}
622
- q0,-${u} ${u},-${u}
623
- h${l-2*u}
624
- q${u},0 ${u},${u}
625
- v${c-2*u}
626
- q0,${u} ${-u},${u}
627
- h${-(l-2*u)}
628
- q${-u},0 ${-u},${-u}
629
- Z
630
- `;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()),Ct(e,p),e.calcIntersect=function(f,m){return ft.rect(f,m)},e.intersect=function(f){return ft.rect(e,f)},i}v(I2,"defaultMindmapNode");async function F2(t,e){const r={padding:e.padding??0};return Fp(t,e,r)}v(F2,"mindmapCircle");var $z=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:d2},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:c2},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:f2},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:x2},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:Fw},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:Pw},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Fp},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:A2},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:M2},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:o2},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:qw},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:Jw},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Qw},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:v2},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:Kw},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Ow},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:C2},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Ew},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:h2},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:g2},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:m2},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:zw},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:Hw},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Bw},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Aw},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:Mw},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:t2},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:T2},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Ww},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:k2},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:e2},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:Iw},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:Dw},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:S2},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:E2},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Rw},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:w2},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:$w},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:u2},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:i2},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:n2},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:_w},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Lw},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:b2},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:y2},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:_2},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:a2},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:r2}],zz=v(()=>{const e=[...Object.entries({state:p2,choice:Nw,note:s2,rectWithTitle:l2,labelRect:Zw,iconSquare:Yw,iconCircle:Gw,icon:Uw,iconRounded:Vw,imageSquare:Xw,anchor:Sw,kanbanItem:B2,mindmapCircle:F2,defaultMindmapNode:I2,classBox:j2,erBox:Pp,requirementBox:L2}),...$z.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),P2=zz();function Wz(t){return t in P2}v(Wz,"isValidShape");var ih=new Map;async function D2(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");const s=e.shape?P2[e.shape]:void 0;if(!s)throw new Error(`No such shape: ${e.shape}. Please check your syntax.`);if(e.link){let o;r.config.securityLevel==="sandbox"?o="_top":e.linkTarget&&(o=e.linkTarget||"_blank"),n=t.insert("svg:a").attr("xlink:href",e.link).attr("target",o??null),i=await s(n,e,r)}else i=await s(t,e,r),n=i;return n.attr("data-look",De(e.look)),e.tooltip&&i.attr("title",e.tooltip),ih.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}v(D2,"insertNode");var LZ=v((t,e)=>{ih.set(e.id,t)},"setNodeElem"),BZ=v(()=>{ih.clear()},"clear"),AZ=v(t=>{const e=ih.get(t.id);J.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"),qz=v((t,e,r,n,i,s=!1,o)=>{e.arrowTypeStart&&Hx(t,"start",e.arrowTypeStart,r,n,i,s,o),e.arrowTypeEnd&&Hx(t,"end",e.arrowTypeEnd,r,n,i,s,o)},"addEdgeMarkers"),Hz={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}},Uz=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],Hx=v((t,e,r,n,i,s,o=!1,a)=>{var m;const l=Hz[r],c=l&&Uz.includes(l.type);if(!l){J.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(T=>{T.setAttribute("stroke",a),l.fill&&T.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"),Gz=v(t=>{var e,r;return typeof t=="string"?t:(r=(e=ee())==null?void 0:e.flowchart)==null?void 0:r.curve},"resolveEdgeCurveType"),wc=new Map,ze=new Map,MZ=v(()=>{wc.clear(),ze.clear()},"clear"),ko=v(t=>t?typeof t=="string"?t:t.reduce((e,r)=>e+";"+r,""):"","getLabelStyles"),Vz=v(async(t,e)=>{const r=ee();let n=sr(r);const{labelStyles:i}=yt(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 _n(t,e.label,{style:ko(e.labelStyle),useHtmlLabels:n,addSvgBackground:!0,isNode:!1,markdown:a,width:a?void 0:void 0},r);o.node().appendChild(c),J.info("abc82",e,e.labelType);let u=c.getBBox(),d=u;if(n){const f=c.children[0],m=Gt(c);u=f.getBoundingClientRect(),d=u,m.attr("width",u.width),m.attr("height",u.height)}else{const f=Gt(c).select("text").node();f&&typeof f.getBBox=="function"&&(d=f.getBBox())}o.attr("transform",go(d,n)),wc.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 Rn(m,e.startLabelLeft,ko(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).startLeft=f,Fo(p,e.startLabelLeft)}if(e.startLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Rn(m,e.startLabelRight,ko(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).startRight=f,Fo(p,e.startLabelRight)}if(e.endLabelLeft){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Rn(f,e.endLabelLeft,ko(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).endLeft=f,Fo(p,e.endLabelLeft)}if(e.endLabelRight){const f=t.insert("g").attr("class","edgeTerminals"),m=f.insert("g").attr("class","inner"),x=await Rn(f,e.endLabelRight,ko(e.labelStyle)||"",!1,!1);p=x;let g=x.getBBox();if(n){const y=x.children[0],b=Gt(x);g=y.getBoundingClientRect(),b.attr("width",g.width),b.attr("height",g.height)}m.attr("transform",go(g,n)),ze.get(e.id)||ze.set(e.id,{}),ze.get(e.id).endRight=f,Fo(p,e.endLabelRight)}return c},"insertEdgeLabel");function Fo(t,e){sr(ee())&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}v(Fo,"setTerminalWidth");var Yz=v((t,e)=>{J.debug("Moving label abc88 ",t.id,t.label,wc.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath;const n=ee(),{subGraphTitleTotalMargin:i}=vp(n);if(t.label){const s=wc.get(t.id);let o=t.x,a=t.y;if(r){const l=zr.calcLabelPosition(r);J.debug("Moving label "+t.label+" from (",o,",",a,") to (",l.x,",",l.y,") abc88"),e.updatedPath&&(o=l.x,a=l.y)}s.attr("transform",`translate(${o}, ${a+i/2})`)}if(t.startLabelLeft){const s=ze.get(t.id).startLeft;let o=t.x,a=t.y;if(r){const l=zr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.startLabelRight){const s=ze.get(t.id).startRight;let o=t.x,a=t.y;if(r){const l=zr.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelLeft){const s=ze.get(t.id).endLeft;let o=t.x,a=t.y;if(r){const l=zr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}if(t.endLabelRight){const s=ze.get(t.id).endRight;let o=t.x,a=t.y;if(r){const l=zr.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);o=l.x,a=l.y}s.attr("transform",`translate(${o}, ${a})`)}},"positionEdgeLabel"),Xz=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"),Kz=v((t,e,r)=>{J.debug(`intersection calc abc89:
631
- outsidePoint: ${JSON.stringify(e)}
632
- insidePoint : ${JSON.stringify(r)}
633
- 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),J.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 J.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"),Ux=v((t,e)=>{J.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(s=>{if(J.info("abc88 checking point",s,e),!Xz(e,s)&&!i){const o=Kz(e,n,s);J.debug("abc88 inside",s,n,o),J.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)?J.warn("abc88 no intersect",o,r):r.push(o),i=!0}else J.warn("abc88 outside",s,n),n=s,i||r.push(s)}),J.debug("returning points",r),r},"cutPathAtIntersect");function O2(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(O2,"extractCornerPoints");var Gx=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"),Zz=v(function(t){const{cornerPointPositions:e}=O2(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=Gx(i,o,5),l=Gx(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){J.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 J.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"),Qz=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"),Jz=v(function(t,e,r,n,i,s,o,a=!1){var D;if(!o)throw new Error(`insertEdge: missing diagramId for edge "${e.id}" — edge IDs require a diagram prefix for uniqueness`);const{handDrawnSeed:l}=ee();let c=e.points,u=!1;const d=i;var p=s;const f=[];for(const R in e.cssCompiledStyles)Pv(R)||f.push(e.cssCompiledStyles[R]);J.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])),J.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&&(J.info("to cluster abc88",r.get(e.toCluster)),c=Ux(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(J.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(c,null,2)),c=Ux(c.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let x=c.filter(R=>!Number.isNaN(R.y));const g=Gz(e.curve);g!=="rounded"&&(x=Zz(x));let y=Ho;switch(g){case"linear":y=Ho;break;case"basis":y=ld;break;case"cardinal":y=wC;break;case"bumpX":y=yC;break;case"bumpY":y=bC;break;case"catmullRom":y=TC;break;case"monotoneX":y=BC;break;case"monotoneY":y=AC;break;case"natural":y=IC;break;case"step":y=FC;break;case"stepAfter":y=DC;break;case"stepBefore":y=PC;break;case"rounded":y=Ho;break;default:y=ld}const{x:b,y:k}=V$(e),T=LR().x(b).y(k).curve(y);let _;switch(e.thickness){case"normal":_="edge-thickness-normal";break;case"thick":_="edge-thickness-thick";break;case"invisible":_="edge-thickness-invisible";break;default:_="edge-thickness-normal"}switch(e.pattern){case"solid":_+=" edge-pattern-solid";break;case"dotted":_+=" edge-pattern-dotted";break;case"dashed":_+=" edge-pattern-dashed";break;default:_+=" edge-pattern-solid"}let w,E=g==="rounded"?R2($2(x,e),5):T(x);const B=Array.isArray(e.style)?e.style:[e.style];let F=B.find(R=>R==null?void 0:R.startsWith("stroke:")),N="";e.animate&&(N="edge-animation-fast"),e.animation&&(N="edge-animation-"+e.animation);let M=!1;if(e.look==="handDrawn"){const R=gt.svg(t);Object.assign([],x);const j=R.path(E,{roughness:.3,seed:l});_+=" transition",w=Gt(j).select("path").attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(N?" "+N:"")).attr("style",B?B.reduce((W,K)=>W+";"+K,""):"");let S=w.attr("d");w.attr("d",S),t.node().appendChild(w.node())}else{const R=f.join(";"),j=B?B.reduce((ct,Q)=>ct+Q+";",""):"",S=(R?R+";"+j+";":j)+";"+(B?B.reduce((ct,Q)=>ct+";"+Q,""):"");w=t.append("path").attr("d",E).attr("id",`${o}-${e.id}`).attr("class"," "+_+(e.classes?" "+e.classes:"")+(N?" "+N:"")).attr("style",S),F=(D=S.match(/stroke:([^;]+)/))==null?void 0:D[1],M=e.animate===!0||!!e.animation||R.includes("animation");const W=w.node(),K=typeof W.getTotalLength=="function"?W.getTotalLength():0,P=ox[e.arrowTypeStart]||0,st=ox[e.arrowTypeEnd]||0;if(e.look==="neo"&&!M){const Q=`stroke-dasharray: ${e.pattern==="dotted"||e.pattern==="dashed"?Qz(K,P,st):`0 ${P} ${K-P-st} ${st}`}; stroke-dashoffset: 0;`;w.attr("style",Q+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",De(e.look)),e.showPoints&&x.forEach(R=>{t.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",R.x).attr("cy",R.y)});let $="";(ee().flowchart.arrowMarkerAbsolute||ee().state.arrowMarkerAbsolute)&&($=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,$=$.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),J.info("arrowTypeStart",e.arrowTypeStart),J.info("arrowTypeEnd",e.arrowTypeEnd);const U=!M&&(e==null?void 0:e.look)==="neo";qz(w,e,$,o,n,U,F);const O=Math.floor(c.length/2),I=c[O];zr.isLabelCoordinateInPath(I,w.attr("d"))||(u=!0);let A={};return u&&(A.updatedPath=c),A.originalPath=e.points,A},"insertEdge");function R2(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,T=Math.max(-1,Math.min(1,k)),_=Math.acos(T);if(_<i||Math.abs(Math.PI-_)<i){r+=`L${o.x},${o.y}`;continue}const w=Math.min(e/Math.sin(_/2),f/2,m/2),E=o.x-x*w,B=o.y-g*w,F=o.x+y*w,N=o.y+b*w;r+=`L${E},${B}`,r+=`Q${o.x},${o.y} ${F},${N}`}}return r}v(R2,"generateRoundedPath");function Od(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(Od,"calculateDeltaAndAngle");function $2(t,e){const r=t.map(i=>({...i}));if(t.length>=2&&Ue[e.arrowTypeStart]){const i=Ue[e.arrowTypeStart],s=t[0],o=t[1],{angle:a}=Od(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&&Ue[e.arrowTypeEnd]){const i=Ue[e.arrowTypeEnd],s=t[n-1],o=t[n-2],{angle:a}=Od(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($2,"applyMarkerOffsetsToPoints");var t9=v((t,e,r,n)=>{e.forEach(i=>{w9[i](t,r,n)})},"insertMarkers"),e9=v((t,e,r)=>{J.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),t.append("marker").attr("id",r+"_"+e+"-extensionStart-margin").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd-margin").attr("class","marker extension "+e).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),r9=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"),n9=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"),i9=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"),s9=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"),o9=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"),a9=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"),l9=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"),c9=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"),h9=v((t,e,r)=>{const n=ge(),{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"),u9=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"),d9=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"),f9=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"),p9=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"),m9=v((t,e,r)=>{const n=ge(),{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"),g9=v((t,e,r)=>{const n=ge(),{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"),x9=v((t,e,r)=>{const n=ge(),{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"),y9=v((t,e,r)=>{const n=ge(),{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"),b9=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
634
- L20,10
635
- M20,10
636
- L0,20`)},"requirement_arrow"),C9=v((t,e,r)=>{const n=ge(),{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
637
- L20,10
638
- M20,10
639
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),k9=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"),v9=v((t,e,r)=>{const n=ge(),{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"),w9={extension:e9,composition:r9,aggregation:n9,dependency:i9,lollipop:s9,point:o9,circle:a9,cross:l9,barb:c9,barbNeo:h9,only_one:u9,zero_or_one:d9,one_or_more:f9,zero_or_more:p9,only_one_neo:m9,zero_or_one_neo:g9,one_or_more_neo:x9,zero_or_more_neo:y9,requirement_arrow:b9,requirement_contains:k9,requirement_arrow_neo:C9,requirement_contains_neo:v9},S9=t9,T9={common:ba,getConfig:ge,insertCluster:vz,insertEdge:Jz,insertEdgeLabel:Vz,insertMarkers:S9,insertNode:D2,interpolateToCurve:gp,labelHelper:It,log:J,positionEdgeLabel:Yz},la={},z2=v(t=>{for(const e of t)la[e.name]=e},"registerLayoutLoaders"),_9=v(()=>{z2([{name:"dagre",loader:v(async()=>await Jt(()=>import("./dagre-BM42HDAG-C0SrhQ_X.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"cose-bilkent",loader:v(async()=>await Jt(()=>import("./cose-bilkent-S5V4N54A-X3n23b12.js"),__vite__mapDeps([8,7,3,4,5,6])),"loader")}])},"registerDefaultLayoutLoaders");_9();var IZ=v(async(t,e)=>{if(!(t.layoutAlgorithm in la))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=la[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,T9,{algorithm:r.algorithm})},"render"),FZ=v((t="",{fallback:e="dagre"}={})=>{if(t in la)return t;if(e in la)return J.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"),Dp="comm",W2="rule",q2="decl",E9="@media",N9="@import",j9="@supports",L9="@namespace",Rd="@keyframes",H2="@layer",B9="@scope",A9=Math.abs,Go=String.fromCharCode;function U2(t){return t.trim()}function $d(t,e,r){return t.replace(e,r)}function us(t,e){return t.charCodeAt(e)|0}function Rs(t,e,r){return t.slice(e,r)}function en(t){return t.length}function G2(t){return t.length}function rl(t,e){return e.push(t),t}var sh=1,$s=1,V2=0,Br=0,je=0,Vs="";function Op(t,e,r,n,i,s,o,a){return{value:t,root:e,parent:r,type:n,props:i,children:s,line:sh,column:$s,length:o,return:"",siblings:a}}function M9(){return je}function I9(){return je=Br>0?us(Vs,--Br):0,$s--,je===10&&($s=1,sh--),je}function Hr(){return je=Br<V2?us(Vs,Br++):0,$s++,je===10&&($s=1,sh++),je}function $n(){return us(Vs,Br)}function jl(){return Br}function oh(t,e){return Rs(Vs,t,e)}function ca(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 F9(t){return sh=$s=1,V2=en(Vs=t),Br=0,[]}function P9(t){return Vs="",t}function hu(t){return U2(oh(Br-1,zd(t===91?t+2:t===40?t+1:t)))}function D9(t){for(;(je=$n())&&je<33;)Hr();return ca(t)>2||ca(je)>3?"":" "}function O9(t,e){for(;--e&&Hr()&&!(je<48||je>102||je>57&&je<65||je>70&&je<97););return oh(t,jl()+(e<6&&$n()==32&&Hr()==32))}function zd(t){for(;Hr();)switch(je){case t:return Br;case 34:case 39:t!==34&&t!==39&&zd(je);break;case 40:t===41&&zd(t);break;case 92:Hr();break}return Br}function R9(t,e){for(;Hr()&&t+je!==57;)if(t+je===84&&$n()===47)break;return"/*"+oh(e,Br-1)+"*"+Go(t===47?t:Hr())}function $9(t){for(;!ca($n());)Hr();return oh(t,Br)}function z9(t){return P9(Ll("",null,null,null,[""],t=F9(t),0,[0],t))}function Ll(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,T="",_=i,w=s,E=n,B=T;g;)switch(m=k,k=Hr()){case 40:m!=108&&us(B,d-1)==58?(b++,B+="("):B+=hu(k);break;case 41:b--,B+=")";break;case 34:case 39:case 91:B+=hu(k);break;case 9:case 10:case 13:case 32:if(b>0){B+=Go(k);break}B+=D9(m);break;case 92:B+=O9(jl()-1,7);continue;case 47:switch($n()){case 42:case 47:rl(W9(R9(Hr(),jl()),e,r,l),l),(ca(m||1)==5||ca($n()||1)==5)&&en(B)&&Rs(B,-1,void 0)!==" "&&(B+=" ");break;default:B+="/"}break;case 123*x:a[c++]=en(B)*y;case 125*x:case 59:case 0:if(b>0&&k){B+=Go(k);break}switch(k){case 0:case 125:g=0;case 59+u:y==-1&&(B=$d(B,/\f/g,"")),f>0&&(en(B)-d||x===0)&&rl(f>32?Yx(B+";",n,r,d-1,l):Yx($d(B," ","")+";",n,r,d-2,l),l);break;case 59:B+=";";default:if(rl(E=Vx(B,e,r,c,u,i,a,T,_=[],w=[],d,s),s),k===123)if(u===0)Ll(B,e,E,E,_,s,d,a,w);else{switch(p){case 99:if(us(B,3)===110)break;case 108:if(us(B,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Ll(t,E,E,n&&rl(Vx(t,E,E,0,0,i,a,T,i,_=[],d,w),w),i,w,d,a,n?_:w):Ll(B,E,E,E,[""],w,0,a,w)}}c=u=f=0,x=y=1,T=B="",d=o;break;case 58:d=1+en(B),f=m;default:if(x<1){if(k==123)--x;else if(k==125&&x++==0&&I9()==125)continue}switch(B+=Go(k),k*x){case 38:y=u>0?1:(B+="\f",-1);break;case 44:if(b>0)break;a[c++]=(en(B)-1)*y,y=1;break;case 64:$n()===45&&(B+=hu(Hr())),p=$n(),u=d=en(T=B+=$9(jl())),k++;break;case 45:m===45&&en(B)==2&&(x=0)}}return s}function Vx(t,e,r,n,i,s,o,a,l,c,u,d){for(var p=i-1,f=i===0?s:[""],m=G2(f),x=0,g=0,y=0;x<n;++x)for(var b=0,k=Rs(t,p+1,p=A9(g=o[x])),T=t;b<m;++b)(T=U2(g>0?f[b]+" "+k:$d(k,/&\f/g,f[b])))&&(l[y++]=T);return Op(t,e,r,i===0?W2:a,l,c,u,d)}function W9(t,e,r,n){return Op(t,e,r,Dp,Go(M9()),Rs(t,2,-2),0,n)}function Yx(t,e,r,n,i){return Op(t,e,r,q2,Rs(t,0,n),Rs(t,n+1,-1),n,i)}function Wd(t,e){for(var r="",n=0;n<t.length;n++)r+=e(t[n],n,t,e)||"";return r}function q9(t,e,r,n){switch(t.type){case H2:if(t.children.length)break;case N9:case L9:case q2:return t.return=t.return||t.value;case Dp:return"";case Rd:return t.return=t.value+"{"+Wd(t.children,n)+"}";case W2:if(!en(t.value=t.props.join(",")))return""}return en(r=Wd(t.children,n))?t.return=t.value+"{"+r+"}":""}function H9(t){var e=G2(t);return function(r,n,i,s){for(var o="",a=0;a<e;a++)o+=t[a](r,n,i,s)||"";return o}}var Y2="c4",U9=v(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),G9=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./c4Diagram-AAUBKEIU-EXIx4J1v.js");return{diagram:e}},__vite__mapDeps([9,10,3,4,5,6,7]));return{id:Y2,diagram:t}},"loader"),V9={id:Y2,detector:U9,loader:G9},Y9=V9,X2="flowchart",X9=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"),K9=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-vk6E_ebo.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:X2,diagram:t}},"loader"),Z9={id:X2,detector:X9,loader:K9},Q9=Z9,K2="flowchart-v2",J9=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"),t7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-vk6E_ebo.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:K2,diagram:t}},"loader"),e7={id:K2,detector:J9,loader:t7},r7=e7,Z2="er",n7=v(t=>/^\s*erDiagram/.test(t),"detector"),i7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./erDiagram-TEJ5UH35-EmDzXNsM.js");return{diagram:e}},__vite__mapDeps([16,13,14,15,3,4,5,6,7]));return{id:Z2,diagram:t}},"loader"),s7={id:Z2,detector:n7,loader:i7},o7=s7,Q2="gitGraph",a7=v(t=>/^\s*gitGraph/.test(t),"detector"),l7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-PVQCEYII-CWPZVbhV.js");return{diagram:e}},__vite__mapDeps([17,18,19,20,5,3,4,6,7]));return{id:Q2,diagram:t}},"loader"),c7={id:Q2,detector:a7,loader:l7},h7=c7,J2="gantt",u7=v(t=>/^\s*gantt/.test(t),"detector"),d7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ganttDiagram-6RSMTGT7-DYYSAjNx.js");return{diagram:e}},__vite__mapDeps([21,3,4,22,23,24,5,6,7]));return{id:J2,diagram:t}},"loader"),f7={id:J2,detector:u7,loader:d7},p7=f7,tS="info",m7=v(t=>/^\s*info/.test(t),"detector"),g7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./infoDiagram-5YYISTIA-Dsu-eeJm.js");return{diagram:e}},__vite__mapDeps([25,20,5,3,4,6,7]));return{id:tS,diagram:t}},"loader"),x7={id:tS,detector:m7,loader:g7},eS="pie",y7=v(t=>/^\s*pie/.test(t),"detector"),b7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./pieDiagram-4H26LBE5-CbYY5KL0.js");return{diagram:e}},__vite__mapDeps([26,18,20,5,3,4,6,27,28,23,7]));return{id:eS,diagram:t}},"loader"),C7={id:eS,detector:y7,loader:b7},rS="quadrantChart",k7=v(t=>/^\s*quadrantChart/.test(t),"detector"),v7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./quadrantDiagram-W4KKPZXB-D5S4_ac5.js");return{diagram:e}},__vite__mapDeps([29,22,23,24,3,4,5,6,7]));return{id:rS,diagram:t}},"loader"),w7={id:rS,detector:k7,loader:v7},S7=w7,nS="xychart",T7=v(t=>/^\s*xychart(-beta)?/.test(t),"detector"),_7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./xychartDiagram-2RQKCTM6-jC4Q0GvG.js");return{diagram:e}},__vite__mapDeps([30,23,28,22,24,3,4,5,6,7]));return{id:nS,diagram:t}},"loader"),E7={id:nS,detector:T7,loader:_7},N7=E7,iS="requirement",j7=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),L7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./requirementDiagram-4Y6WPE33-BrPWCnHz.js");return{diagram:e}},__vite__mapDeps([31,13,14,3,4,5,6,7]));return{id:iS,diagram:t}},"loader"),B7={id:iS,detector:j7,loader:L7},A7=B7,sS="sequence",M7=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),I7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sequenceDiagram-3UESZ5HK-c8DuhvUj.js");return{diagram:e}},__vite__mapDeps([32,10,19,3,4,5,6,7]));return{id:sS,diagram:t}},"loader"),F7={id:sS,detector:M7,loader:I7},P7=F7,oS="class",D7=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"),O7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-4FO5ZUOK-SGKYXTP4.js");return{diagram:e}},__vite__mapDeps([33,34,12,10,13,14,3,4,5,6,7]));return{id:oS,diagram:t}},"loader"),R7={id:oS,detector:D7,loader:O7},$7=R7,aS="classDiagram",z7=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"),W7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./classDiagram-v2-Q7XG4LA2-SGKYXTP4.js");return{diagram:e}},__vite__mapDeps([35,34,12,10,13,14,3,4,5,6,7]));return{id:aS,diagram:t}},"loader"),q7={id:aS,detector:z7,loader:W7},H7=q7,lS="state",U7=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"),G7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-AJRCARHV-KO9G1Jrm.js");return{diagram:e}},__vite__mapDeps([36,37,13,14,1,2,3,4,5,6,7]));return{id:lS,diagram:t}},"loader"),V7={id:lS,detector:U7,loader:G7},Y7=V7,cS="stateDiagram",X7=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"),K7=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-BHNVJYJU-eVyb8_R4.js");return{diagram:e}},__vite__mapDeps([38,37,13,14,3,4,5,6,7]));return{id:cS,diagram:t}},"loader"),Z7={id:cS,detector:X7,loader:K7},Q7=Z7,hS="journey",J7=v(t=>/^\s*journey/.test(t),"detector"),tW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./journeyDiagram-JHISSGLW-DkE5By_R.js");return{diagram:e}},__vite__mapDeps([39,12,10,27,3,4,5,6,7]));return{id:hS,diagram:t}},"loader"),eW={id:hS,detector:J7,loader:tW},rW=eW,nW=v((t,e,r)=>{J.debug(`rendering svg for syntax error
640
- `);const n=RR(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),z1(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"),uS={draw:nW},iW=uS,sW={db:{},renderer:uS,parser:{parse:v(()=>{},"parse")}},oW=sW,dS="flowchart-elk",aW=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"),lW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./flowDiagram-I6XJVG4X-vk6E_ebo.js");return{diagram:e}},__vite__mapDeps([11,12,10,13,14,15,3,4,5,6,7]));return{id:dS,diagram:t}},"loader"),cW={id:dS,detector:aW,loader:lW},hW=cW,fS="timeline",uW=v(t=>/^\s*timeline/.test(t),"detector"),dW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./timeline-definition-PNZ67QCA-Cs2HLlbG.js");return{diagram:e}},__vite__mapDeps([40,27,3,4,5,6,7]));return{id:fS,diagram:t}},"loader"),fW={id:fS,detector:uW,loader:dW},pW=fW,pS="mindmap",mW=v(t=>/^\s*mindmap/.test(t),"detector"),gW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./mindmap-definition-RKZ34NQL-DAp6uJ_b.js");return{diagram:e}},__vite__mapDeps([41,13,14,3,4,5,6,7]));return{id:pS,diagram:t}},"loader"),xW={id:pS,detector:mW,loader:gW},yW=xW,mS="kanban",bW=v(t=>/^\s*kanban/.test(t),"detector"),CW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./kanban-definition-UN3LZRKU-Cf_230xs.js");return{diagram:e}},__vite__mapDeps([42,12,3,4,5,6,7]));return{id:mS,diagram:t}},"loader"),kW={id:mS,detector:bW,loader:CW},vW=kW,gS="sankey",wW=v(t=>/^\s*sankey(-beta)?/.test(t),"detector"),SW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./sankeyDiagram-5OEKKPKP-CP8j1mcl.js");return{diagram:e}},__vite__mapDeps([43,28,23,3,4,5,6,7]));return{id:gS,diagram:t}},"loader"),TW={id:gS,detector:wW,loader:SW},_W=TW,xS="packet",EW=v(t=>/^\s*packet(-beta)?/.test(t),"detector"),NW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-LMA3HP47-DLOYeLM3.js");return{diagram:e}},__vite__mapDeps([44,18,20,5,3,4,6,7]));return{id:xS,diagram:t}},"loader"),jW={id:xS,detector:EW,loader:NW},yS="radar",LW=v(t=>/^\s*radar-beta/.test(t),"detector"),BW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-2AECGRRQ-Bc3qx6pJ.js");return{diagram:e}},__vite__mapDeps([45,18,20,5,3,4,6,7]));return{id:yS,diagram:t}},"loader"),AW={id:yS,detector:LW,loader:BW},bS="block",MW=v(t=>/^\s*block(-beta)?/.test(t),"detector"),IW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./blockDiagram-GPEHLZMM-DR9b_xXC.js");return{diagram:e}},__vite__mapDeps([46,12,1,15,3,4,5,6,7]));return{id:bS,diagram:t}},"loader"),FW={id:bS,detector:MW,loader:IW},PW=FW,CS="treeView",DW=v(t=>/^\s*treeView-beta/.test(t),"detector"),OW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-5GNKFQAL-UiCrD06F.js");return{diagram:e}},__vite__mapDeps([47,18,19,20,5,3,4,6,7]));return{id:CS,diagram:t}},"loader"),RW={id:CS,detector:DW,loader:OW},$W=RW,kS="architecture",zW=v(t=>/^\s*architecture/.test(t),"detector"),WW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./architectureDiagram-3BPJPVTR-DHOb5xas.js");return{diagram:e}},__vite__mapDeps([48,18,20,5,3,4,6,7]));return{id:kS,diagram:t}},"loader"),qW={id:kS,detector:zW,loader:WW},HW=qW,vS="eventmodeling",UW=v(t=>/^\s*eventmodeling/.test(t),"detector"),GW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-KO2AKTUF-B9Vn5KyO.js");return{diagram:e}},__vite__mapDeps([49,18,20,5,3,4,6,7]));return{id:vS,diagram:t}},"loader"),VW={id:vS,detector:UW,loader:GW},YW=VW,wS="ishikawa",XW=v(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),KW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-YF4QCWOH-BP1SP8WA.js");return{diagram:e}},__vite__mapDeps([50,3,4,5,6,7]));return{id:wS,diagram:t}},"loader"),ZW={id:wS,detector:XW,loader:KW},SS="venn",QW=v(t=>/^\s*venn-beta/.test(t),"detector"),JW=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./vennDiagram-CIIHVFJN-rcSRidqI.js");return{diagram:e}},__vite__mapDeps([51,3,4,5,6,7]));return{id:SS,diagram:t}},"loader"),tq={id:SS,detector:QW,loader:JW},eq=tq,TS="treemap",rq=v(t=>/^\s*treemap/.test(t),"detector"),nq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./diagram-OG6HWLK6-CXjh2miZ.js");return{diagram:e}},__vite__mapDeps([52,14,18,20,5,3,4,6,24,28,23,7]));return{id:TS,diagram:t}},"loader"),iq={id:TS,detector:rq,loader:nq},_S="wardley-beta",sq=v(t=>/^\s*wardley-beta/i.test(t),"detector"),oq=v(async()=>{const{diagram:t}=await Jt(async()=>{const{diagram:e}=await import("./wardleyDiagram-YWT4CUSO-CSWALc_m.js");return{diagram:e}},__vite__mapDeps([53,18,20,5,3,4,6,7]));return{id:_S,diagram:t}},"loader"),aq={id:_S,detector:sq,loader:oq},lq=aq,Xx=!1,ah=v(()=>{Xx||(Xx=!0,Ql("error",oW,t=>t.toLowerCase().trim()==="error"),Ql("---",{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("---")),Vu(hW,yW,HW),Vu(Y9,vW,H7,$7,o7,p7,x7,C7,A7,P7,r7,Q9,pW,h7,Q7,Y7,rW,S7,_W,jW,N7,PW,YW,$W,AW,ZW,iq,eq,lq))},"addDiagrams"),cq=v(async()=>{J.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(ki).map(async([r,{detector:n,loader:i}])=>{if(i)try{Qu(r)}catch{try{const{diagram:s,id:o}=await i();Ql(o,s,n)}catch(s){throw J.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){J.error(`Failed to load ${e.length} external diagrams`);for(const r of e)J.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),hq="graphics-document document";function ES(t,e){t.attr("role",hq),e!==""&&t.attr("aria-roledescription",e)}v(ES,"setA11yDiagramInfo");function NS(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(NS,"addSVGa11yTitleDescription");var yi,qd=(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=ge(),i=$f(e,n);e=W6(e)+`
641
- `;try{Qu(i)}catch{const d=s4(i);if(!d)throw new _1(`Diagram ${i} not found.`);const{id:p,diagram:f}=await d();Ql(p,f)}const{db:s,parser:o,renderer:a,init:l}=Qu(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),Kx=[],uq=v(()=>{Kx.forEach(t=>{t()}),Kx=[]},"attachFunctions"),dq=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function jS(t){const e=t.match(T1);if(!e)return{text:t,metadata:{}};let r=G$(e[1],{schema:U$})??{};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(jS,"extractFrontMatter");var fq=v(t=>t.replace(/\r\n?/g,`
642
- `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),pq=v(t=>{const{text:e,metadata:r}=jS(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"),mq=v(t=>{const e=zr.detectInit(t)??{},r=zr.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:j6(t),directive:e}},"processDirectives");function Rp(t){const e=fq(t),r=pq(e),n=mq(r.text),i=kp(r.config,n.directive);return t=dq(n.text),{code:t,title:r.title,config:i}}v(Rp,"preprocessDiagram");function LS(t){const e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(LS,"toBase64");var gq=5e4,xq="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",yq="sandbox",bq="loose",Cq="http://www.w3.org/2000/svg",kq="http://www.w3.org/1999/xlink",vq="http://www.w3.org/1999/xhtml",wq="100%",Sq="100%",Tq="border:0;margin:0;",_q="margin:0",Eq="allow-top-navigation-by-user-activation allow-popups",Nq='The "iframe" tag is not supported by your browser.',jq=["foreignobject"],Lq=["dominant-baseline"];function $p(t){const e=Rp(t);return Kl(),A4(e.config??{}),e}v($p,"processAndSetConfigs");async function BS(t,e){ah();try{const{code:r,config:n}=$p(t);return{diagramType:(await MS(r)).type,config:n}}catch(r){if(e!=null&&e.suppressErrors)return!1;throw r}}v(BS,"parse");var Zx=v((t,e,r=[])=>{const n=B1(`{ ${r.join(" !important; ")} !important; }`);return`.${t} ${e} ${n}`},"cssImportantStyles"),Bq=v((t,e=new Map)=>{const r=new CSSStyleSheet;if(t.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${t.fontFamily}}`,r.cssRules.length),t.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${t.altFontFamily}}`,r.cssRules.length),e instanceof Map){const a=sr(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(l=>{ux(l.styles)||a.forEach(c=>{r.insertRule(Zx(l.id,c,l.styles),r.cssRules.length)}),ux(l.textStyles)||r.insertRule(Zx(l.id,"tspan",((l==null?void 0:l.textStyles)||[]).map(c=>c.replace("color","fill"))),r.cssRules.length)})}let n="";if(t.themeCSS!==void 0)if(typeof r.replaceSync=="function"){const i=new CSSStyleSheet;i.replaceSync(t.themeCSS),n=Zu(i)+`
643
- `}else n+=`${t.themeCSS}
644
- `;return n+Zu(r)},"createCssStyles"),Aq=v((t,e)=>Wd(z9(`${t}{${e}}`),H9([v(function(n,i,s,o){if(n.type==="rule"&&Array.isArray(n.props)){if(n.parent&&n.parent.type===Rd)return;n.props=n.props.map(a=>a.startsWith(t)?a:`${t} ${a}`)}else n.type.startsWith("@")&&([...[E9,j9,H2,B9,"@container","@starting-style"],Rd].includes(n.type)||(J.warn(`Removing unsupported at-rule ${n.type} from CSS`),n.type=Dp))},"addNamespace"),q9])),"compileCSS"),Mq=v((t,e,r,n)=>{const i=Bq(t,r),s=Z4(e,i,{...t.themeVariables,theme:t.theme,look:t.look},n);return Aq(n,s)},"createUserStyles"),Iq=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=Ti(n),n=n.replace(/<br>/g,"<br/>"),n},"cleanUpSvgCode"),Fq=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":Sq,n=LS(`<body style="${_q}">${t}</body>`);return`<iframe style="width:${wq};height:${r};${Tq}" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="${Eq}">
645
- ${Nq}
646
- </iframe>`},"putIntoIFrame"),Qx=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",Cq);return i&&o.attr("xmlns:xlink",i),o.append("g"),t},"appendDivSvgG");function Hd(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(Hd,"sandboxedIframe");var Pq=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"),Dq=v(async function(t,e,r){var $,U,O,I,A,D;ah();const n=$p(e);e=n.code;const i=ge();J.debug(i),e.length>((i==null?void 0:i.maxTextSize)??gq)&&(e=xq);const s=`#${t}`,o="i"+t,a="#"+o,l="d"+t,c="#"+l,u=v(()=>{const j=Gt(p?a:c).node();j&&"remove"in j&&j.remove()},"removeTempElements");let d=Gt(document.body);const p=i.securityLevel===yq,f=i.securityLevel===bq,m=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),p){const R=Hd(Gt(r),o);d=Gt(R.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Gt(r);Qx(d,t,l,`font-family: ${m}`,kq)}else{if(Pq(document,t,l,o),p){const R=Hd(Gt(document.body),o);d=Gt(R.nodes()[0].contentDocument.body),d.node().style.margin="0"}else d=Gt("body");Qx(d,t,l)}let x,g;try{x=await qd.fromText(e,{title:n.title})}catch(R){if(i.suppressErrorRendering)throw u(),R;x=await qd.fromText("error"),g=R}const y=d.select(c).node(),b=x.type,k=y.firstChild,T=k.firstChild,_=(U=($=x.renderer).getClasses)==null?void 0:U.call($,e,x),w=Mq(i,b,_,s),E=document.createElement("style");E.innerHTML=w,k.insertBefore(E,T);try{await x.renderer.draw(e,t,"11.15.0",x)}catch(R){throw i.suppressErrorRendering?u():iW.draw(e,t,"11.15.0"),R}const B=d.select(`${c} svg`),F=(I=(O=x.db).getAccTitle)==null?void 0:I.call(O),N=(D=(A=x.db).getAccDescription)==null?void 0:D.call(A);IS(b,B,F,N),d.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",vq);let M=d.select(c).node().innerHTML;if(J.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),M=Iq(M,p,Tn(i.arrowMarkerAbsolute)),p){const R=d.select(c+" svg").node();M=Fq(M,R)}else f||(M=Ms.sanitize(M,{ADD_TAGS:jq,ADD_ATTR:Lq,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(uq(),g)throw g;return u(),{diagramType:b,svg:M,bindFunctions:x.db.bindFunctions}},"render");function AS(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),L4(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"?j4(e):A1();Rf(r.logLevel),ah()}v(AS,"initialize");var MS=v((t,e={})=>{const{code:r}=Rp(t);return qd.fromText(r,e)},"getDiagramFromText");function IS(t,e,r,n){ES(e,t),NS(e,r,n,e.attr("id"))}v(IS,"addA11yInfo");var Ei=Object.freeze({render:Dq,parse:BS,getDiagramFromText:MS,initialize:AS,getConfig:ge,setConfig:M1,getSiteConfig:A1,updateSiteConfig:B4,reset:v(()=>{Kl()},"reset"),globalReset:v(()=>{Kl(Is)},"globalReset"),defaultConfig:Is});Rf(ge().logLevel);Kl(ge());var Oq=v((t,e,r)=>{J.warn(t),Cp(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"),FS=v(async function(t={querySelector:".mermaid"}){try{await Rq(t)}catch(e){if(Cp(e)&&J.error(e.str),wr.parseError&&wr.parseError(e),!t.suppressErrors)throw J.error("Use the suppressErrors option to suppress these errors"),e}},"run"),Rq=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){const n=Ei.getConfig();J.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");J.debug(`Found ${i.length} diagrams`),(n==null?void 0:n.startOnLoad)!==void 0&&(J.debug("Start On Load: "+(n==null?void 0:n.startOnLoad)),Ei.updateSiteConfig({startOnLoad:n==null?void 0:n.startOnLoad}));const s=new zr.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed);let o;const a=[];for(const l of Array.from(i)){if(J.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");const c=`mermaid-${s.next()}`;o=l.innerHTML,o=Xv(zr.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,"<br/>");const u=zr.detectInit(o);u&&J.debug("Detected early reinit: ",u);try{const{svg:d,bindFunctions:p}=await RS(c,o,l);l.innerHTML=d,t&&await t(c),p&&p(l)}catch(d){Oq(d,a,wr.parseError)}}if(a.length>0)throw a[0]},"runThrowsErrors"),PS=v(function(t){Ei.initialize(t)},"initialize"),$q=v(async function(t,e,r){J.warn("mermaid.init is deprecated. Please use run instead."),t&&PS(t);const n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await FS(n)},"init"),zq=v(async(t,{lazyLoad:e=!0}={})=>{ah(),Vu(...t),e===!1&&await cq()},"registerExternalDiagrams"),DS=v(function(){if(wr.startOnLoad){const{startOnLoad:t}=Ei.getConfig();t&&wr.run().catch(e=>J.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",DS,!1);var Wq=v(function(t){wr.parseError=t},"setParseErrorHandler"),Sc=[],uu=!1,OS=v(async()=>{if(!uu){for(uu=!0;Sc.length>0;){const t=Sc.shift();if(t)try{await t()}catch(e){J.error("Error executing queue",e)}}uu=!1}},"executeQueue"),qq=v(async(t,e)=>new Promise((r,n)=>{const i=v(()=>new Promise((s,o)=>{Ei.parse(t,e).then(a=>{s(a),r(a)},a=>{var l;J.error("Error parsing",a),(l=wr.parseError)==null||l.call(wr,a),o(a),n(a)})}),"performCall");Sc.push(i),OS().catch(n)}),"parse"),RS=v((t,e,r)=>new Promise((n,i)=>{const s=v(()=>new Promise((o,a)=>{Ei.render(t,e,r).then(l=>{o(l),n(l)},l=>{var c;J.error("Error parsing",l),(c=wr.parseError)==null||c.call(wr,l),a(l),i(l)})}),"performCall");Sc.push(s),OS().catch(i)}),"render"),Hq=v(()=>Object.keys(ki).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),wr={startOnLoad:!0,mermaidAPI:Ei,parse:qq,render:RS,init:$q,run:FS,registerExternalDiagrams:zq,registerLayoutLoaders:z2,initialize:PS,parseError:void 0,contentLoaded:DS,setParseErrorHandler:Wq,detectType:$f,registerIconPacks:X8,getRegisteredDiagramsMetadata:Hq},$S=wr;/*! Check if previously processed *//*!
647
- * Wait for document loaded before starting the execution
648
- */$S.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",lineColor:"#475569",secondaryColor:"#1e293b",tertiaryColor:"#0f172a"}});function Uq({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 $S.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 Gq({className:t,children:e,...r}){const n=/language-(\w+)/.exec(t||"");return(n==null?void 0:n[1])==="mermaid"?h.jsx(Uq,{code:String(e).trim()}):h.jsx("code",{className:t,...r,children:e})}function Vq(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 zS(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=zS(s,e);(o.files.length>0||o.children.size>0)&&n.children.set(i,o)}return n}function WS(t){let e=t.files.length;for(const r of t.children.values())e+=WS(r);return e}function qS({node:t,depth:e,expandedDirs:r,onToggleDir:n,selectedFile:i,onSelectFile:s,trackedPaths:o,searchQuery:a}){const l=Yq(t,e),c=r.has(l)||!!a,u=WS(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(eM,{className:"h-3.5 w-3.5 shrink-0 text-accent"}):h.jsx(Ef,{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(qS,{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(HS,{file:d,depth:e+1,isSelected:i===d.path,isTracked:o.has(d.path),onSelect:()=>s(d.path)},d.path))]})]})}function HS({file:t,depth:e,isSelected:r,isTracked:n,onSelect:i}){return h.jsxs("button",{onClick:i,className:rt("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(Li,{className:"h-3 w-3 shrink-0",style:{color:n?"hsl(var(--primary))":void 0}}),h.jsx("span",{className:rt("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 Yq(t,e){return`dir-${e}-${t.name}`}function US({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),[T,_]=C.useState(!1),[w,E]=C.useState(""),[B,F]=C.useState(null),[N,M]=C.useState(!1),$=C.useRef(null),[U,O]=C.useState(""),[I,A]=C.useState(()=>new Set(["dir-0-docs"])),[D,R]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:docsTreeWidth"),10)||260}catch{return 260}}),j=C.useRef(!1),S=C.useRef(null),W=C.useCallback(Z=>{Z.preventDefault(),j.current=!0;const at=Mt=>{if(!j.current||!S.current)return;const Dt=S.current.getBoundingClientRect(),ce=Math.min(Math.max(Mt.clientX-Dt.left,160),500);R(ce)},vt=()=>{j.current=!1,document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",vt),R(Mt=>(localStorage.setItem("compose:docsTreeWidth",Mt),Mt))};document.addEventListener("mousemove",at),document.addEventListener("mouseup",vt)},[]),K=T&&w!==B,P=C.useCallback(async()=>{if(!(!m||N)){M(!0);try{(await zt("/api/file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:m,content:w})})).ok&&(F(w),y(w))}catch{}M(!1)}},[m,w,N]),st=C.useCallback(()=>{_(Z=>(!Z&&g!==null&&(E(g),F(g)),!Z))},[g]);C.useEffect(()=>{if(!T)return;const Z=at=>{(at.metaKey||at.ctrlKey)&&at.key==="s"&&(at.preventDefault(),P())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[T,P]),C.useEffect(()=>{_(!1),E(""),F(null)},[m]),C.useEffect(()=>{zt("/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 Mt=vt.split("/");Mt.length>1&&at.add(`dir-1-${Mt[1]}`)}A(at)}).catch(()=>d(!1))},[]),C.useEffect(()=>{if(!m){y(null);return}k(!0),zt(`/api/file?path=${encodeURIComponent(m)}`).then(Z=>Z.json()).then(Z=>{y(Z.content??null),k(!1)}).catch(()=>{y(null),k(!1)})},[m]);const ct=C.useMemo(()=>!o||!s?l:l.filter(Z=>Z.includes(`features/${s}/`)),[l,o,s]),Q=C.useMemo(()=>{const Z=new Set,at=vt=>vt.split("/").pop();for(const vt of t){const Mt=`${vt.title||""} ${vt.description||""} ${vt.planLink||""}`.toLowerCase();for(const Dt of ct)(Mt.includes(Dt.toLowerCase())||Mt.includes(at(Dt).replace(".md","").toLowerCase()))&&Z.add(Dt)}return Z},[t,ct]),kt=C.useMemo(()=>Vq(ct),[ct]),wt=C.useMemo(()=>zS(kt,U),[kt,U]),lt=C.useCallback(Z=>{A(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:S,className:"flex-1 flex min-h-0",children:[h.jsxs("div",{className:"shrink-0 flex flex-col min-h-0",style:{width:`${D}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(xa,{featureCode:s,active:o,onToggle:a})}),h.jsxs("div",{className:"relative",children:[h.jsx(Qn,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),h.jsx(Rc,{placeholder:"Search files...",value:U,onChange:Z=>O(Z.target.value),className:"h-7 pl-7 pr-7 text-xs"}),U&&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:[ct.length," files"]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[ct.length-Q.size," untracked"]})]})]}),h.jsx(Un,{className:"flex-1",children:h.jsxs("div",{className:"py-1",children:[[...wt.children.values()].sort((Z,at)=>Z.name.localeCompare(at.name)).map(Z=>h.jsx(qS,{node:Z,depth:0,expandedDirs:I,onToggleDir:lt,selectedFile:m,onSelectFile:x,trackedPaths:Q,searchQuery:U},Z.name)),wt.files.sort((Z,at)=>Z.name.localeCompare(at.name)).map(Z=>h.jsx(HS,{file:Z,depth:0,isSelected:m===Z.path,isTracked:Q.has(Z.path),onSelect:()=>x(Z.path)},Z.path))]})})]}),h.jsx("div",{onMouseDown:W,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(BA,{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}),K&&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"}),Q.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"}),T&&h.jsxs("button",{onClick:P,disabled:N||!K,className:rt("flex items-center gap-1 text-xs px-2 py-0.5 rounded transition-colors",K?"bg-accent text-accent-foreground hover:bg-accent/80":"bg-muted text-muted-foreground cursor-default"),title:"Save (Cmd+S)",children:[h.jsx(EM,{className:"h-3 w-3"}),N?"Saving...":"Save"]}),h.jsx("button",{onClick:st,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:T?"Preview":"Edit",disabled:g===null,children:T?h.jsx(wb,{className:"h-3.5 w-3.5"}):h.jsx(_b,{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&&T?h.jsx("textarea",{ref:$,value:w,onChange:Z=>E(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(Un,{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(Cf,{remarkPlugins:[Sf],components:{code:Gq},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(Li,{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 Xq=Bb("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"}}),Wt=C.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...i},s)=>{const o=n?w3:"button";return h.jsx(o,{className:rt(Xq({variant:e,size:r,className:t})),ref:s,...i})});Wt.displayName="Button";class Kq{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 T=f[b-1],_=f[b+1];T&&(f[b-1]=void 0);let w=!1;if(_){const B=_.oldPos-b;w=_&&0<=B&&B<a}const E=T&&T.oldPos+1<l;if(!w&&!E){f[b]=void 0;continue}if(!E||w&&T.oldPos<_.oldPos?k=this.addToPath(_,!0,!1,0,n):k=this.addToPath(T,!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 Zq extends Kq{constructor(){super(...arguments),this.tokenize=tH}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 Qq=new Zq;function Jq(t,e,r){return Qq.diff(t,e,r)}function tH(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 zp({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=Jq(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 GS(t){if(!t)return"";const e=Date.now()-new Date(t).getTime(),r=Math.floor(e/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function eH({gate:t}){var n,i;const e=t.artifactAssessment;if(!e)return null;const r=oy[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 rH(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 nH({gate:t}){const e=rH(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 Jx({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 iH({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]??`${_e[t.fromPhase]??t.fromPhase} → ${_e[t.toPhase]??t.toPhase}`}),h.jsx(eH,{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(zp,{oldText:r.priorSnapshot,newText:r.currentSnapshot})})]}):null]}),h.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:GS(t.createdAt)})]}),h.jsx("div",{className:"mt-1.5",children:h.jsx(nH,{gate:t})}),h.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[h.jsx(Wt,{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(Wt,{variant:"outline",size:"sm",className:rt("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(Wt,{variant:"outline",size:"sm",className:rt("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(Wt,{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 sH(t){if(t.resolvedBy==="system"){const e=t.policyMode;return e==="flag"?"auto (flag)":e==="skip"?"auto (skip)":"auto"}return t.resolvedBy??"human"}function oH({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=sH(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(rr,{variant:"outline",className:rt("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:GS(t.resolvedAt)})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:kn[t.stepId]??`${_e[t.fromPhase]??t.fromPhase} → ${_e[t.toPhase]??t.toPhase}`}),t.comment&&h.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 truncate italic",children:t.comment})]})}function VS({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(T=>{var _;return T.featureCode===i||((_=T.lifecycle)==null?void 0:_.featureCode)===i}).map(T=>T.id));return t.filter(T=>k.has(T.itemId))},[t,e,s,i]),p=(k,T)=>{l(k),u(T)},{pending:f,resolved:m,priorRevisions:x}=C.useMemo(()=>{const k=[],T=[];for(const w of d)w.status==="pending"?k.push(w):w.resolvedAt&&T.push(w);k.sort((w,E)=>new Date(w.createdAt)-new Date(E.createdAt)),T.sort((w,E)=>new Date(E.resolvedAt)-new Date(w.resolvedAt));const _=new Map;for(const w of k){const E=T.find(B=>B.stepId===w.stepId&&B.itemId===w.itemId&&(B.outcome==="revised"||B.outcome==="revise")&&B.comment);E&&_.set(w.id,{comment:E.comment,priorSnapshot:E.artifactSnapshot||null,currentSnapshot:w.artifactSnapshot||null})}return{pending:k,resolved:T,priorRevisions:_}},[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(xa,{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(Jx,{title:"Pending",count:f.length,color:"#f59e0b",children:f.map(k=>h.jsx(iH,{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(Jx,{title:"History",count:m.length,color:"#22c55e",children:[(g?m.slice(0,50):m.slice(0,10)).map(k=>h.jsx(oH,{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 YS({event:t,items:e,onNavigate:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(null);if(C.useEffect(()=>{if(!t)return;o(t),i(!0);const u=setTimeout(()=>i(!1),5e3);return()=>clearTimeout(u)},[t]),!n||!s)return null;const a=e.find(u=>u.id===s.itemId),l=(a==null?void 0:a.title)??"Unknown",c=s.type==="pending"?`Gate pending: ${Xo(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 aH({item:t,onUpdate:e}){const{newIds:r,changedIds:n}=C.useContext(Oc),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:Po({"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:rt("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))":gr.question}}),h.jsx("p",{className:rt("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:rt("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(Wt,{variant:"ghost",size:"icon",className:"h-7 w-7 text-success",onClick:f,children:h.jsx(Nf,{className:"h-3 w-3"})}),h.jsx(Wt,{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(Pc,{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(ma,{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(VA,{className:"h-2.5 w-2.5"})," Dismiss"]})]}),c&&h.jsx("div",{className:"pl-4",children:h.jsx("span",{className:rt("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 XS({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 zt(`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 zt("http://localhost:4001/api/agent/spawn",{method:"POST",headers:Po({"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(zl,{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(Wt,{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(Tb,{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(aH,{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(Wt,{size:"sm",className:rt("h-8 text-xs gap-1.5",a==="running"&&"opacity-50 pointer-events-none"),onClick:m,children:[h.jsx(zl,{className:"h-3.5 w-3.5"}),a==="running"?"Generating...":"Run Pressure Test"]})]})]})]})}const lH=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],cH=["gate","flag","skip"],hH=["light","dark","system"],t0=["graph","tree","pipeline","gates","docs","design","sessions","settings"];function vo({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 uH({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 KS({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 T=k==="null"?null:k;e({policies:{[b]:T}})},[e]),i=C.useCallback((b,k)=>{const T=parseInt(k,10);T>=1&&T<=100&&e({iterations:{[b]:{maxIterations:T}}})},[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(vo,{title:"Phase Policies",children:lH.map(b=>h.jsx(Gi,{label:_e[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:"—"}),cH.map(k=>h.jsx("option",{value:k,children:k},k))]})},b))}),h.jsxs(vo,{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(vo,{title:"Agent Models",children:["interactive","agentRun","summarizer"].map(b=>{var k;return h.jsx(Gi,{label:b,children:h.jsx(uH,{className:d+" w-48",value:((k=t.models)==null?void 0:k[b])||"",onCommit:T=>s(b,T)},b)},b)})}),h.jsxs(vo,{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:hH.map(b=>h.jsx("option",{value:b,children:b},b))})}),h.jsx(Gi,{label:"Default view",children:h.jsx("select",{className:u,value:t0.includes((y=t.ui)==null?void 0:y.defaultView)?t.ui.defaultView:"graph",onChange:b=>a(b.target.value),children:t0.map(b=>h.jsx("option",{value:b,children:b},b))})})]}),h.jsx(vo,{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 T;return h.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[h.jsx("input",{type:"radio",name:"enforcement",value:b,checked:(((T=t.capabilities)==null?void 0:T.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 dH({icon:t=aM,title:e,description:r,action:n,onAction:i,className:s}){return h.jsxs("div",{className:rt("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(Wt,{variant:"outline",size:"sm",onClick:i,children:n})]})}function fH(){const[t,e]=C.useState([]),[r,n]=C.useState(!0),[i,s]=C.useState(null);C.useEffect(()=>{zt("/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 zt("/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(Tb,{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:rt("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",b_[a.category]||"border-border bg-card"),children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Li,{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(cM,{className:"w-3 h-3"})," ",a.steps," steps"]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(vb,{className:"w-3 h-3"})," ~",a.estimated_minutes,"m"]}),h.jsx("span",{className:"ml-auto capitalize",children:a.category})]})]},a.id))})]})}function ZS({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 T=i===k?null:k;s(T),r&&r(T)},d=()=>{n&&n()},p=async()=>{if(e!=null&&e.draftId){a(!0);try{await zt("/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 zt("/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($l,{className:"w-3 h-3"})," Refresh"]})})]}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(fH,{})})]});if(e){const k=e.steps||[],T=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:rt("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:rt("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(ma,{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: ",T.label||T.id||"Pipeline"]}),h.jsx("span",{className:"text-muted-foreground ml-2",children:T.description||""}),T.category&&h.jsxs("span",{className:"text-muted-foreground ml-2",children:["· ",T.category]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-3",children:h.jsx("div",{className:"space-y-1",children:k.map((_,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:_.id}),_.agent&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:_.agent}),_.function&&h.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["fn:",_.function]})]},_.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=gh.map(k=>{const T=g[k.id];return T?{...k,...T}:k});if(t!=null&&t.steps)for(const k of t.steps)gh.find(T=>T.id===k.id)||y.push({id:k.id,name:k.id.replace(/_/g," "),agent:"claude",phase:"implementation",...k});const b=Object.keys(Xp).map(k=>({phase:k,config:Xp[k],steps:y.filter(T=>T.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(nl,{icon:ls,color:"text-orange-400 bg-orange-500/10",label:"Claude"}),h.jsx(nl,{icon:_f,color:"text-emerald-400 bg-emerald-500/10",label:"Codex"}),h.jsx(nl,{icon:jf,color:"text-slate-300 bg-slate-500/10",label:"Human"}),h.jsx(nl,{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($l,{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??gh.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:T,steps:_})=>h.jsxs("div",{className:rt("rounded-lg border p-3",T.color),children:[h.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:T.label}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:_.map((w,E)=>{const B=m[w.id]??null,F=w.id===x,N=w.id===i;return h.jsxs(Xt.Fragment,{children:[h.jsx(pH,{step:w,liveStatus:B,isCurrent:F,isSelected:N,onClick:()=>u(w.id)}),E<_.length-1&&h.jsx(yb,{className:"h-3 w-3 self-center text-muted-foreground/40"})]},w.id)})})]},k))})]})}function pH({step:t,liveStatus:e,isCurrent:r,isSelected:n,onClick:i}){const s=t.hasGate?qs:t.agent==="claude"?ls:t.agent==="codex"?_f:jf,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:rt("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:rt("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 nl({icon:t,color:e,label:r}){return h.jsxs("div",{className:rt("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 mH(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 gH={claude:{bg:"bg-orange-500/20",text:"text-orange-400",Icon:ls},codex:{bg:"bg-emerald-500/20",text:"text-emerald-400",Icon:_f},gemini:{bg:"bg-blue-500/20",text:"text-blue-400",Icon:ls},human:{bg:"bg-slate-500/20",text:"text-slate-400",Icon:jf},unassigned:{bg:"bg-slate-800",text:"text-slate-600",Icon:ls}},xH={bg:"bg-slate-800",text:"text-slate-600",Icon:ls},e0={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 yH({agent:t,size:e="md",className:r}){const n=gH[t]||xH,i=e0[e]||e0.md,{Icon:s}=n;return h.jsx("span",{className:rt("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 ae(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 Kn(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const QS=6048e5,bH=864e5,il=43200,r0=1440;let CH={};function Ea(){return CH}function ha(t,e){var a,l,c,u;const r=Ea(),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=ae(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 Tc(t){return ha(t,{weekStartsOn:1})}function JS(t){const e=ae(t),r=e.getFullYear(),n=Kn(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=Tc(n),s=Kn(t,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=Tc(s);return e.getTime()>=i.getTime()?r+1:e.getTime()>=o.getTime()?r:r-1}function n0(t){const e=ae(t);return e.setHours(0,0,0,0),e}function _c(t){const e=ae(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 kH(t,e){const r=n0(t),n=n0(e),i=+r-_c(r),s=+n-_c(n);return Math.round((i-s)/bH)}function vH(t){const e=JS(t),r=Kn(t,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),Tc(r)}function Bl(t,e){const r=ae(t),n=ae(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function wH(t){return Kn(t,Date.now())}function SH(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function TH(t){if(!SH(t)&&typeof t!="number")return!1;const e=ae(t);return!isNaN(Number(e))}function _H(t,e){const r=ae(t),n=ae(e),i=r.getFullYear()-n.getFullYear(),s=r.getMonth()-n.getMonth();return i*12+s}function EH(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function NH(t,e){return+ae(t)-+ae(e)}function jH(t){const e=ae(t);return e.setHours(23,59,59,999),e}function LH(t){const e=ae(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function BH(t){const e=ae(t);return+jH(e)==+LH(e)}function AH(t,e){const r=ae(t),n=ae(e),i=Bl(r,n),s=Math.abs(_H(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=Bl(r,n)===-i;BH(ae(t))&&s===1&&Bl(t,n)===1&&(a=!1),o=i*(s-Number(a))}return o===0?0:o}function MH(t,e,r){const n=NH(t,e)/1e3;return EH(r==null?void 0:r.roundingMethod)(n)}function IH(t){const e=ae(t),r=Kn(t,0);return r.setFullYear(e.getFullYear(),0,1),r.setHours(0,0,0,0),r}const FH={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"}},PH=(t,e,r)=>{let n;const i=FH[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 du(t){return(e={})=>{const r=e.width?String(e.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const DH={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},OH={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},RH={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$H={date:du({formats:DH,defaultWidth:"full"}),time:du({formats:OH,defaultWidth:"full"}),dateTime:du({formats:RH,defaultWidth:"full"})},zH={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},WH=(t,e,r,n)=>zH[t];function wo(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 qH={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},HH={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},UH={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"]},GH={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"]},VH={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"}},YH={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"}},XH=(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"},KH={ordinalNumber:XH,era:wo({values:qH,defaultWidth:"wide"}),quarter:wo({values:HH,defaultWidth:"wide",argumentCallback:t=>t-1}),month:wo({values:UH,defaultWidth:"wide"}),day:wo({values:GH,defaultWidth:"wide"}),dayPeriod:wo({values:VH,defaultWidth:"wide",formattingValues:YH,defaultFormattingWidth:"wide"})};function So(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)?QH(a,d=>d.test(o)):ZH(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 ZH(t,e){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return r}function QH(t,e){for(let r=0;r<t.length;r++)if(e(t[r]))return r}function JH(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 tU=/^(\d+)(th|st|nd|rd)?/i,eU=/\d+/i,rU={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},nU={any:[/^b/i,/^(a|c)/i]},iU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},sU={any:[/1/i,/2/i,/3/i,/4/i]},oU={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},aU={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]},lU={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},cU={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]},hU={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},uU={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}},dU={ordinalNumber:JH({matchPattern:tU,parsePattern:eU,valueCallback:t=>parseInt(t,10)}),era:So({matchPatterns:rU,defaultMatchWidth:"wide",parsePatterns:nU,defaultParseWidth:"any"}),quarter:So({matchPatterns:iU,defaultMatchWidth:"wide",parsePatterns:sU,defaultParseWidth:"any",valueCallback:t=>t+1}),month:So({matchPatterns:oU,defaultMatchWidth:"wide",parsePatterns:aU,defaultParseWidth:"any"}),day:So({matchPatterns:lU,defaultMatchWidth:"wide",parsePatterns:cU,defaultParseWidth:"any"}),dayPeriod:So({matchPatterns:hU,defaultMatchWidth:"any",parsePatterns:uU,defaultParseWidth:"any"})},tT={code:"en-US",formatDistance:PH,formatLong:$H,formatRelative:WH,localize:KH,match:dU,options:{weekStartsOn:0,firstWeekContainsDate:1}};function fU(t){const e=ae(t);return kH(e,IH(e))+1}function pU(t){const e=ae(t),r=+Tc(e)-+vH(e);return Math.round(r/QS)+1}function eT(t,e){var u,d,p,f;const r=ae(t),n=r.getFullYear(),i=Ea(),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=Kn(t,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=ha(o,e),l=Kn(t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const c=ha(l,e);return r.getTime()>=a.getTime()?n+1:r.getTime()>=c.getTime()?n:n-1}function mU(t,e){var a,l,c,u;const r=Ea(),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=eT(t,e),s=Kn(t,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),ha(s,e)}function gU(t,e){const r=ae(t),n=+ha(r,e)-+mU(r,e);return Math.round(n/QS)+1}function se(t,e){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return r+n}const In={y(t,e){const r=t.getFullYear(),n=r>0?r:1-r;return se(e==="yy"?n%100:n,e.length)},M(t,e){const r=t.getMonth();return e==="M"?String(r+1):se(r+1,2)},d(t,e){return se(t.getDate(),e.length)},a(t,e){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,e){return se(t.getHours()%12||12,e.length)},H(t,e){return se(t.getHours(),e.length)},m(t,e){return se(t.getMinutes(),e.length)},s(t,e){return se(t.getSeconds(),e.length)},S(t,e){const r=e.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return se(i,e.length)}},Vi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},i0={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 In.y(t,e)},Y:function(t,e,r,n){const i=eT(t,n),s=i>0?i:1-i;if(e==="YY"){const o=s%100;return se(o,2)}return e==="Yo"?r.ordinalNumber(s,{unit:"year"}):se(s,e.length)},R:function(t,e){const r=JS(t);return se(r,e.length)},u:function(t,e){const r=t.getFullYear();return se(r,e.length)},Q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return se(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,r){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return se(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,r){const n=t.getMonth();switch(e){case"M":case"MM":return In.M(t,e);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,r){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return se(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,r,n){const i=gU(t,n);return e==="wo"?r.ordinalNumber(i,{unit:"week"}):se(i,e.length)},I:function(t,e,r){const n=pU(t);return e==="Io"?r.ordinalNumber(n,{unit:"week"}):se(n,e.length)},d:function(t,e,r){return e==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):In.d(t,e)},D:function(t,e,r){const n=fU(t);return e==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):se(n,e.length)},E:function(t,e,r){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return se(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,r,n){const i=t.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return se(s,e.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,r){const n=t.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return se(i,e.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,r){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,r){const n=t.getHours();let i;switch(n===12?i=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 In.h(t,e)},H:function(t,e,r){return e==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):In.H(t,e)},K:function(t,e,r){const n=t.getHours()%12;return e==="Ko"?r.ordinalNumber(n,{unit:"hour"}):se(n,e.length)},k:function(t,e,r){let n=t.getHours();return n===0&&(n=24),e==="ko"?r.ordinalNumber(n,{unit:"hour"}):se(n,e.length)},m:function(t,e,r){return e==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):In.m(t,e)},s:function(t,e,r){return e==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):In.s(t,e)},S:function(t,e){return In.S(t,e)},X:function(t,e,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return o0(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 o0(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"+s0(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"+s0(n,":");case"zzzz":default:return"GMT"+di(n,":")}},t:function(t,e,r){const n=Math.trunc(t.getTime()/1e3);return se(n,e.length)},T:function(t,e,r){const n=t.getTime();return se(n,e.length)}};function s0(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),s=n%60;return s===0?r+String(i):r+String(i)+e+se(s,2)}function o0(t,e){return t%60===0?(t>0?"-":"+")+se(Math.abs(t)/60,2):di(t,e)}function di(t,e=""){const r=t>0?"-":"+",n=Math.abs(t),i=se(Math.trunc(n/60),2),s=se(n%60,2);return r+i+e+s}const a0=(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"})}},rT=(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"})}},xU=(t,e)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return a0(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}}",a0(n,e)).replace("{{time}}",rT(i,e))},yU={p:rT,P:xU},bU=/^D+$/,CU=/^Y+$/,kU=["D","DD","YY","YYYY"];function vU(t){return bU.test(t)}function wU(t){return CU.test(t)}function SU(t,e,r){const n=TU(t,e,r);if(console.warn(n),kU.includes(t))throw new RangeError(n)}function TU(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 _U=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,EU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,NU=/^'([^]*?)'?$/,jU=/''/g,LU=/[a-zA-Z]/;function BU(t,e,r){var u,d,p,f;const n=Ea(),i=n.locale??tT,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=ae(t);if(!TH(a))throw new RangeError("Invalid time value");let l=e.match(EU).map(m=>{const x=m[0];if(x==="p"||x==="P"){const g=yU[x];return g(m,i.formatLong)}return m}).join("").match(_U).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const x=m[0];if(x==="'")return{isToken:!1,value:AU(m)};if(i0[x])return{isToken:!0,value:m};if(x.match(LU))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;(wU(x)||vU(x))&&SU(x,e,String(t));const g=i0[x[0]];return g(a,x,i.localize,c)}).join("")}function AU(t){const e=t.match(NU);return e?e[1].replace(jU,"'"):t}function MU(t,e,r){const n=Ea(),i=(r==null?void 0:r.locale)??n.locale??tT,s=2520,o=Bl(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=ae(e),c=ae(t)):(l=ae(t),c=ae(e));const u=MH(c,l),d=(_c(c)-_c(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<r0){const m=Math.round(p/60);return i.formatDistance("aboutXHours",m,a)}else{if(p<s)return i.formatDistance("xDays",1,a);if(p<il){const m=Math.round(p/r0);return i.formatDistance("xDays",m,a)}else if(p<il*2)return f=Math.round(p/il),i.formatDistance("aboutXMonths",f,a)}if(f=AH(c,l),f<12){const m=Math.round(p/il);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 IU(t,e){return MU(t,wH(t),e)}function FU({date:t,className:e}){if(!t)return h.jsx("span",{className:rt("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:rt("text-muted-foreground",e),children:"—"})}catch{return h.jsx("span",{className:rt("text-muted-foreground",e),children:"—"})}const n=IU(r,{addSuffix:!0}),i=BU(r,"PPpp");return h.jsx("time",{dateTime:r.toISOString(),title:i,className:rt("text-muted-foreground tabular-nums",e),children:n})}function nT({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=mH(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(xa,{featureCode:n,active:i,onToggle:s}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px]",children:[h.jsx("span",{className:rt("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(Qn,{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"}),ay.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(dH,{icon:Tf,title:"No sessions",description:"Sessions appear when agents start working",className:"py-8"}),f.map(m=>h.jsx(PU,{session:m,items:e,onSelectItem:r},m.id))]})]})}function PU({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=Yp[n]||Yp.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(yH,{agent:t.agent,size:"sm",className:"shrink-0"}),h.jsx(Of,{status:t.status,className:"shrink-0"}),n&&h.jsx("span",{className:rt("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:rt("text-[10px] font-mono",a?"text-blue-400 hover:underline cursor-pointer":"text-muted-foreground cursor-default"),children:i}),h.jsx(FU,{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 l0=t=>Symbol.iterator in t,c0=t=>"entries"in t,h0=(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},DU=(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 OU(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:l0(t)&&l0(e)?c0(t)&&c0(e)?h0(t,e):DU(t,e):h0({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Mi(t){const e=Xt.useRef(void 0);return r=>{const n=t(r);return OU(e.current,n)?e.current:e.current=n}}function iT({open:t,onClose:e,onSelectItem:r,onSelectGate:n}){const{items:i,gates:s,sessions:o}=mr(Mi(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 T=s.filter(w=>w.status==="pending").slice(0,3).map(w=>({type:"gate",id:w.id,label:Xo(w,i.find(E=>E.id===w.itemId)),sub:kn[w.stepId]?`${_e[w.fromPhase]??w.fromPhase} → ${_e[w.toPhase]??w.toPhase}`:null,status:"pending",gate:w})),_=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[...T.length?[{type:"section",label:"Pending Gates"}]:[],...T,..._.length?[{type:"section",label:"Blocked Items"}]:[],..._]}const g=a.toLowerCase(),y=i.filter(T=>{var _,w;return((_=T.title)==null?void 0:_.toLowerCase().includes(g))||((w=T.featureCode)==null?void 0:w.toLowerCase().includes(g))||(T.description||"").toLowerCase().includes(g)}).slice(0,5).map(T=>({type:"item",id:T.id,label:T.title,sub:`${T.type} · ${T.phase??""}`,status:T.status,item:T})),b=s.filter(T=>{var _;return(T.fromPhase||"").toLowerCase().includes(g)||(T.toPhase||"").toLowerCase().includes(g)||(((_=i.find(w=>w.id===T.itemId))==null?void 0:_.title)??"").toLowerCase().includes(g)}).slice(0,3).map(T=>({type:"gate",id:T.id,label:Xo(T,i.find(_=>_.id===T.itemId)),sub:T.status,status:T.status,gate:T})),k=(o||[]).filter(T=>(T.featureCode||"").toLowerCase().includes(g)||(T.summary||"").toLowerCase().includes(g)).slice(0,2).map(T=>({type:"session",id:T.id,label:T.featureCode||T.id,sub:T.summary||T.agent||"",status:T.status,session:T}));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(Qn,{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:rt("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(Dc,{className:"h-4 w-4 text-muted-foreground/60 shrink-0"}),g.type==="session"&&h.jsx(Tf,{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(Of,{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 RU=rf[" useId ".trim().toString()]||(()=>{}),$U=0;function fu(t){const[e,r]=C.useState(RU());return Ls(()=>{r(n=>n??String($U++))},[t]),t||(e?`radix-${e}`:"")}var zU=rf[" useInsertionEffect ".trim().toString()]||Ls;function WU({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){const[i,s,o]=qU({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=HU(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 qU({defaultProp:t,onChange:e}){const[r,n]=C.useState(t),i=C.useRef(r),s=C.useRef(e);return zU(()=>{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 HU(t){return typeof t=="function"}function UU(t,e=globalThis==null?void 0:globalThis.document){const r=jr(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 GU="DismissableLayer",Ud="dismissableLayer.update",VU="dismissableLayer.pointerDownOutside",YU="dismissableLayer.focusOutside",u0,sT=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),oT=C.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=C.useContext(sT),[u,d]=C.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=C.useState({}),m=Tr(e,E=>d(E)),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,T=b>=y,_=ZU(E=>{const B=E.target,F=[...c.branches].some(N=>N.contains(B));!T||F||(i==null||i(E),o==null||o(E),E.defaultPrevented||a==null||a())},p),w=QU(E=>{const B=E.target;[...c.branches].some(N=>N.contains(B))||(s==null||s(E),o==null||o(E),E.defaultPrevented||a==null||a())},p);return UU(E=>{b===c.layers.size-1&&(n==null||n(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},p),C.useEffect(()=>{if(u)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(u0=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),d0(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=u0)}},[u,p,r,c]),C.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),d0())},[u,c]),C.useEffect(()=>{const E=()=>f({});return document.addEventListener(Ud,E),()=>document.removeEventListener(Ud,E)},[]),h.jsx(yr.div,{...l,ref:m,style:{pointerEvents:k?T?"auto":"none":void 0,...t.style},onFocusCapture:nr(t.onFocusCapture,w.onFocusCapture),onBlurCapture:nr(t.onBlurCapture,w.onBlurCapture),onPointerDownCapture:nr(t.onPointerDownCapture,_.onPointerDownCapture)})});oT.displayName=GU;var XU="DismissableLayerBranch",KU=C.forwardRef((t,e)=>{const r=C.useContext(sT),n=C.useRef(null),i=Tr(e,n);return C.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),h.jsx(yr.div,{...t,ref:i})});KU.displayName=XU;function ZU(t,e=globalThis==null?void 0:globalThis.document){const r=jr(t),n=C.useRef(!1),i=C.useRef(()=>{});return C.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){aT(VU,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 QU(t,e=globalThis==null?void 0:globalThis.document){const r=jr(t),n=C.useRef(!1);return C.useEffect(()=>{const i=s=>{s.target&&!n.current&&aT(YU,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 d0(){const t=new CustomEvent(Ud);document.dispatchEvent(t)}function aT(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?JI(i,s):i.dispatchEvent(s)}var pu="focusScope.autoFocusOnMount",mu="focusScope.autoFocusOnUnmount",f0={bubbles:!1,cancelable:!0},JU="FocusScope",lT=C.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=C.useState(null),c=jr(i),u=jr(s),d=C.useRef(null),p=Tr(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 T=k.target;a.contains(T)?d.current=T:Dn(d.current,{select:!0})},g=function(k){if(f.paused||!a)return;const T=k.relatedTarget;T!==null&&(a.contains(T)||Dn(d.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&Dn(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){m0.add(f);const x=document.activeElement;if(!a.contains(x)){const y=new CustomEvent(pu,f0);a.addEventListener(pu,c),a.dispatchEvent(y),y.defaultPrevented||(tG(sG(cT(a)),{select:!0}),document.activeElement===x&&Dn(a))}return()=>{a.removeEventListener(pu,c),setTimeout(()=>{const y=new CustomEvent(mu,f0);a.addEventListener(mu,u),a.dispatchEvent(y),y.defaultPrevented||Dn(x??document.body,{select:!0}),a.removeEventListener(mu,u),m0.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,T]=eG(b);k&&T?!x.shiftKey&&y===T?(x.preventDefault(),r&&Dn(k,{select:!0})):x.shiftKey&&y===k&&(x.preventDefault(),r&&Dn(T,{select:!0})):y===b&&x.preventDefault()}},[r,n,f.paused]);return h.jsx(yr.div,{tabIndex:-1,...o,ref:p,onKeyDown:m})});lT.displayName=JU;function tG(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Dn(n,{select:e}),document.activeElement!==r)return}function eG(t){const e=cT(t),r=p0(e,t),n=p0(e.reverse(),t);return[r,n]}function cT(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 p0(t,e){for(const r of t)if(!rG(r,{upTo:e}))return r}function rG(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 nG(t){return t instanceof HTMLInputElement&&"select"in t}function Dn(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&nG(t)&&e&&t.select()}}var m0=iG();function iG(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=g0(t,e),t.unshift(e)},remove(e){var r;t=g0(t,e),(r=t[0])==null||r.resume()}}}function g0(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function sG(t){return t.filter(e=>e.tagName!=="A")}var oG="Portal",hT=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?UI.createPortal(h.jsx(yr.div,{...n,ref:e}),o):null});hT.displayName=oG;var gu=0;function aG(){C.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??x0()),document.body.insertAdjacentElement("beforeend",t[1]??x0()),gu++,()=>{gu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),gu--}},[])}function x0(){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 uT(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 lG(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 Al="right-scroll-bar-position",Ml="width-before-scroll-bar",cG="with-scroll-bars-hidden",hG="--removed-body-scroll-bar-size";function xu(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function uG(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 dG=typeof window<"u"?C.useLayoutEffect:C.useEffect,y0=new WeakMap;function fG(t,e){var r=uG(null,function(n){return t.forEach(function(i){return xu(i,n)})});return dG(function(){var n=y0.get(r);if(n){var i=new Set(n),s=new Set(t),o=r.current;i.forEach(function(a){s.has(a)||xu(a,null)}),s.forEach(function(a){i.has(a)||xu(a,o)})}y0.set(r,t)},[t]),r}function pG(t){return t}function mG(t,e){e===void 0&&(e=pG);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 gG(t){t===void 0&&(t={});var e=mG(null);return e.options=rn({async:!0,ssr:!1},t),e}var dT=function(t){var e=t.sideCar,r=uT(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))};dT.isSideCarExport=!0;function xG(t,e){return t.useMedium(e),dT}var fT=gG(),yu=function(){},lh=C.forwardRef(function(t,e){var r=C.useRef(null),n=C.useState({onScrollCapture:yu,onWheelCapture:yu,onTouchMoveCapture:yu}),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,T=uT(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=p,w=fG([r,e]),E=rn(rn({},T),i);return C.createElement(C.Fragment,null,u&&C.createElement(_,{sideCar:fT,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({},E),{ref:w})):C.createElement(b,rn({},E,{className:l,ref:w}),a))});lh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};lh.classNames={fullWidth:Ml,zeroRight:Al};var yG=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function bG(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=yG();return e&&t.setAttribute("nonce",e),t}function CG(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function kG(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var vG=function(){var t=0,e=null;return{add:function(r){t==0&&(e=bG())&&(CG(e,r),kG(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},wG=function(){var t=vG();return function(e,r){C.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}},pT=function(){var t=wG(),e=function(r){var n=r.styles,i=r.dynamic;return t(n,i),null};return e},SG={left:0,top:0,right:0,gap:0},bu=function(t){return parseInt(t||"",10)||0},TG=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[bu(r),bu(n),bu(i)]},_G=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return SG;var e=TG(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])}},EG=pT(),ds="data-scroll-locked",NG=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(cG,` {
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(Al,` {
692
- right: `).concat(a,"px ").concat(n,`;
693
- }
694
-
695
- .`).concat(Ml,` {
696
- margin-right: `).concat(a,"px ").concat(n,`;
697
- }
698
-
699
- .`).concat(Al," .").concat(Al,` {
700
- right: 0 `).concat(n,`;
701
- }
702
-
703
- .`).concat(Ml," .").concat(Ml,` {
704
- margin-right: 0 `).concat(n,`;
705
- }
706
-
707
- body[`).concat(ds,`] {
708
- `).concat(hG,": ").concat(a,`px;
709
- }
710
- `)},b0=function(){var t=parseInt(document.body.getAttribute(ds)||"0",10);return isFinite(t)?t:0},jG=function(){C.useEffect(function(){return document.body.setAttribute(ds,(b0()+1).toString()),function(){var t=b0()-1;t<=0?document.body.removeAttribute(ds):document.body.setAttribute(ds,t.toString())}},[])},LG=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n;jG();var s=C.useMemo(function(){return _G(i)},[i]);return C.createElement(EG,{styles:NG(s,!e,i,r?"":"!important")})},Gd=!1;if(typeof window<"u")try{var sl=Object.defineProperty({},"passive",{get:function(){return Gd=!0,!0}});window.addEventListener("test",sl,sl),window.removeEventListener("test",sl,sl)}catch{Gd=!1}var Yi=Gd?{passive:!1}:!1,BG=function(t){return t.tagName==="TEXTAREA"},mT=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!BG(t)&&r[e]==="visible")},AG=function(t){return mT(t,"overflowY")},MG=function(t){return mT(t,"overflowX")},C0=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=gT(t,n);if(i){var s=xT(t,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},IG=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},FG=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},gT=function(t,e){return t==="v"?AG(e):MG(e)},xT=function(t,e){return t==="v"?IG(e):FG(e)},PG=function(t,e){return t==="h"&&e==="rtl"?-1:1},DG=function(t,e,r,n,i){var s=PG(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=xT(t,a),m=f[0],x=f[1],g=f[2],y=x-g-s*m;(m||y)&&gT(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},ol=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},k0=function(t){return[t.deltaX,t.deltaY]},v0=function(t){return t&&"current"in t?t.current:t},OG=function(t,e){return t[0]===e[0]&&t[1]===e[1]},RG=function(t){return`
711
- .block-interactivity-`.concat(t,` {pointer-events: none;}
712
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
713
- `)},$G=0,Xi=[];function zG(t){var e=C.useRef([]),r=C.useRef([0,0]),n=C.useRef(),i=C.useState($G++)[0],s=C.useState(pT)[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=lG([t.lockRef.current],(t.shards||[]).map(v0),!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=ol(x),b=r.current,k="deltaX"in x?x.deltaX:b[0]-y[0],T="deltaY"in x?x.deltaY:b[1]-y[1],_,w=x.target,E=Math.abs(k)>Math.abs(T)?"h":"v";if("touches"in x&&E==="h"&&w.type==="range")return!1;var B=window.getSelection(),F=B&&B.anchorNode,N=F?F===w||F.contains(w):!1;if(N)return!1;var M=C0(E,w);if(!M)return!0;if(M?_=E:(_=E==="v"?"h":"v",M=C0(E,w)),!M)return!1;if(!n.current&&"changedTouches"in x&&(k||T)&&(n.current=_),!_)return!0;var $=n.current||_;return DG($,g,x,$==="h"?k:T)},[]),l=C.useCallback(function(x){var g=x;if(!(!Xi.length||Xi[Xi.length-1]!==s)){var y="deltaY"in g?k0(g):ol(g),b=e.current.filter(function(_){return _.name===g.type&&(_.target===g.target||g.target===_.shadowParent)&&OG(_.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var k=(o.current.shards||[]).map(v0).filter(Boolean).filter(function(_){return _.contains(g.target)}),T=k.length>0?a(g,k[0]):!o.current.noIsolation;T&&g.cancelable&&g.preventDefault()}}},[]),c=C.useCallback(function(x,g,y,b){var k={name:x,delta:g,target:y,should:b,shadowParent:WG(y)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(T){return T!==k})},1)},[]),u=C.useCallback(function(x){r.current=ol(x),n.current=void 0},[]),d=C.useCallback(function(x){c(x.type,k0(x),x.target,a(x,t.lockRef.current))},[]),p=C.useCallback(function(x){c(x.type,ol(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:RG(i)}):null,f?C.createElement(LG,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function WG(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const qG=xG(fT,zG);var yT=C.forwardRef(function(t,e){return C.createElement(lh,rn({},t,{ref:e,sideCar:qG}))});yT.classNames=lh.classNames;var HG=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ki=new WeakMap,al=new WeakMap,ll={},Cu=0,bT=function(t){return t&&(t.host||bT(t.parentNode))},UG=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=bT(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})},GG=function(t,e,r,n){var i=UG(e,Array.isArray(t)?t:[t]);ll[r]||(ll[r]=new WeakMap);var s=ll[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&&al.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(),Cu++,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||(al.has(d)||d.removeAttribute(n),al.delete(d)),f||d.removeAttribute(r)}),Cu--,Cu||(Ki=new WeakMap,Ki=new WeakMap,al=new WeakMap,ll={})}},VG=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=HG(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live], script"))),GG(n,i,r,"aria-hidden")):function(){return null}};function YG(t){const e=XG(t),r=C.forwardRef((n,i)=>{const{children:s,...o}=n,a=C.Children.toArray(s),l=a.find(ZG);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 XG(t){const e=C.forwardRef((r,n)=>{const{children:i,...s}=r;if(C.isValidElement(i)){const o=JG(i),a=QG(s,i.props);return i.type!==C.Fragment&&(a.ref=n?$c(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 KG=Symbol("radix.slottable");function ZG(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===KG}function QG(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 JG(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 ch="Dialog",[CT]=Gb(ch),[tV,Yr]=CT(ch),kT=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]=WU({prop:n,defaultProp:i??!1,onChange:s,caller:ch});return h.jsx(tV,{scope:e,triggerRef:a,contentRef:l,contentId:fu(),titleId:fu(),descriptionId:fu(),open:c,onOpenChange:u,onOpenToggle:C.useCallback(()=>u(d=>!d),[u]),modal:o,children:r})};kT.displayName=ch;var vT="DialogTrigger",eV=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Yr(vT,r),s=Tr(e,i.triggerRef);return h.jsx(yr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Hp(i.open),...n,ref:s,onClick:nr(t.onClick,i.onOpenToggle)})});eV.displayName=vT;var Wp="DialogPortal",[rV,wT]=CT(Wp,{forceMount:void 0}),ST=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=Yr(Wp,e);return h.jsx(rV,{scope:e,forceMount:r,children:C.Children.map(n,o=>h.jsx(ti,{present:r||s.open,children:h.jsx(hT,{asChild:!0,container:i,children:o})}))})};ST.displayName=Wp;var Ec="DialogOverlay",TT=C.forwardRef((t,e)=>{const r=wT(Ec,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Yr(Ec,t.__scopeDialog);return s.modal?h.jsx(ti,{present:n||s.open,children:h.jsx(iV,{...i,ref:e})}):null});TT.displayName=Ec;var nV=YG("DialogOverlay.RemoveScroll"),iV=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Yr(Ec,r);return h.jsx(yT,{as:nV,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(yr.div,{"data-state":Hp(i.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Ni="DialogContent",_T=C.forwardRef((t,e)=>{const r=wT(Ni,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=Yr(Ni,t.__scopeDialog);return h.jsx(ti,{present:n||s.open,children:s.modal?h.jsx(sV,{...i,ref:e}):h.jsx(oV,{...i,ref:e})})});_T.displayName=Ni;var sV=C.forwardRef((t,e)=>{const r=Yr(Ni,t.__scopeDialog),n=C.useRef(null),i=Tr(e,r.contentRef,n);return C.useEffect(()=>{const s=n.current;if(s)return VG(s)},[]),h.jsx(ET,{...t,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nr(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:nr(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:nr(t.onFocusOutside,s=>s.preventDefault())})}),oV=C.forwardRef((t,e)=>{const r=Yr(Ni,t.__scopeDialog),n=C.useRef(!1),i=C.useRef(!1);return h.jsx(ET,{...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()}})}),ET=C.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Yr(Ni,r),l=C.useRef(null),c=Tr(e,l);return aG(),h.jsxs(h.Fragment,{children:[h.jsx(lT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(oT,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Hp(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(aV,{titleId:a.titleId}),h.jsx(cV,{contentRef:l,descriptionId:a.descriptionId})]})]})}),qp="DialogTitle",NT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Yr(qp,r);return h.jsx(yr.h2,{id:i.titleId,...n,ref:e})});NT.displayName=qp;var jT="DialogDescription",LT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Yr(jT,r);return h.jsx(yr.p,{id:i.descriptionId,...n,ref:e})});LT.displayName=jT;var BT="DialogClose",AT=C.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=Yr(BT,r);return h.jsx(yr.button,{type:"button",...n,ref:e,onClick:nr(t.onClick,()=>i.onOpenChange(!1))})});AT.displayName=BT;function Hp(t){return t?"open":"closed"}var MT="DialogTitleWarning",[PZ,IT]=n3(MT,{contentName:Ni,titleName:qp,docsSlug:"dialog"}),aV=({titleId:t})=>{const e=IT(MT),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},lV="DialogDescriptionWarning",cV=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${IT(lV).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},hV=kT,uV=ST,FT=TT,PT=_T,DT=NT,OT=LT,dV=AT;const Up=hV,fV=uV,RT=C.forwardRef(({className:t,...e},r)=>h.jsx(FT,{ref:r,className:rt("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}));RT.displayName=FT.displayName;const hh=C.forwardRef(({className:t,children:e,...r},n)=>h.jsxs(fV,{children:[h.jsx(RT,{}),h.jsxs(PT,{ref:n,className:rt("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(dV,{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"})]})]})]}));hh.displayName=PT.displayName;const uh=({className:t,...e})=>h.jsx("div",{className:rt("flex flex-col space-y-1.5 p-6 pb-4",t),...e});uh.displayName="DialogHeader";const Gp=({className:t,...e})=>h.jsx("div",{className:rt("flex items-center justify-end gap-2 p-6 pt-4",t),...e});Gp.displayName="DialogFooter";const dh=C.forwardRef(({className:t,...e},r)=>h.jsx(DT,{ref:r,className:rt("text-sm font-semibold text-foreground leading-none tracking-tight",t),...e}));dh.displayName=DT.displayName;const pV=C.forwardRef(({className:t,...e},r)=>h.jsx(OT,{ref:r,className:rt("text-sm text-muted-foreground",t),...e}));pV.displayName=OT.displayName;const w0=[{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"}}],mV=["gate","flag","skip"];function S0(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=mr(b=>b.createItem),[i,s]=C.useState(()=>S0(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=S0(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=w0.find(T=>T.id===b);k&&(a(b),s(T=>({...T,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(Up,{open:t,onOpenChange:b=>!b&&e(),children:h.jsxs(hh,{className:"max-w-md",onKeyDown:y,children:[h.jsx(uh,{children:h.jsx(dh,{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:w0.map(b=>h.jsx("button",{type:"button",onClick:()=>x(b.id),className:rt("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(Cb,{className:"h-3 w-3"}):h.jsx(ga,{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:sy.map(b=>h.jsx("option",{value:b,children:Il[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:ay.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:mV.map(b=>h.jsx("button",{type:"button",onClick:()=>s(k=>({...k,governance:b})),className:rt("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(Gp,{children:[h.jsx(Wt,{variant:"ghost",size:"sm",onClick:e,disabled:u,children:"Cancel"}),h.jsx(Wt,{size:"sm",onClick:g,disabled:u||!i.title.trim(),children:u?"Creating…":"Create"})]})]})})}const gV=["explore_design","prd","architecture","blueprint","verification","plan","execute","report","docs","ship"],xV=[{id:"gate",Icon:qs,label:"Gate",active:"bg-amber-500/20 text-amber-300 border-amber-500/40"},{id:"flag",Icon:wb,label:"Flag",active:"bg-blue-500/20 text-blue-300 border-blue-500/40"},{id:"skip",Icon:Nb,label:"Skip",active:"bg-slate-700 text-slate-400 border-slate-600"}];function yV(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 zT({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(Up,{open:t,onOpenChange:l=>!l&&e(),children:h.jsxs(hh,{className:"max-w-sm",children:[h.jsx(uh,{children:h.jsxs("div",{className:"flex items-center justify-between pr-6",children:[h.jsx(dh,{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:gV.map(l=>{const c=l==="explore_design",u=yV(r,l),d=_e[l]??l;return h.jsxs("div",{className:rt("flex items-center gap-3 rounded-md px-2 py-1.5",c&&"opacity-40"),children:[h.jsx("span",{className:rt("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:xV.map(p=>{const f=u===p.id,{Icon:m}=p;return h.jsxs("button",{onClick:()=>a(l,p.id),title:p.label,className:rt("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 WT({onOpenGate:t}){const{gates:e,items:r}=mr(Mi(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=Xo(c,u),p=C_[c.fromPhase]??k_,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:rt("shrink-0 h-10 border-t flex items-center gap-2 px-3",p.bg,p.border),children:[h.jsx(qs,{className:rt("h-3.5 w-3.5 shrink-0",p.text)}),h.jsx("span",{className:rt("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(bb,{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:rt("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 bV="●",CV="text-zinc-400";function kV(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 vV(t){var e;return((e=ly[t])==null?void 0:e.icon)??bV}function wV(t){var e;return((e=ly[t])==null?void 0:e.color)??CV}const SV={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 TV(t){return SV[t]??"bg-zinc-500/15 text-zinc-300 border border-zinc-500/25"}function _V(t,e){return t.filter(r=>r.feature_code===e).slice().sort((r,n)=>r.timestamp.localeCompare(n.timestamp))}function EV(t){if(!t)return"";try{return new Date(t).toISOString().slice(11,16)}catch{return""}}function NV({event:t,now:e}){const r=vV(t.kind),n=wV(t.kind),i=kV(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:rt("text-[11px] shrink-0",n),children:r}),h.jsx("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums",children:i||EV(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:rt("text-[9px] px-1 py-px rounded-full leading-tight",TV(s.name)),children:s.name},o))})]})}function qT({events:t=[],currentFeatureCode:e,now:r}){const n=_V(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(NV,{event:i,now:r},i.id))})})}function jV(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 LV="Select a feature to see status.";function HT({featureCode:t,snapshot:e}){const[r,n]=C.useState(!1),i=C.useCallback(()=>{n(a=>!a)},[]),s=(e==null?void 0:e.sentence)??LV,o=jV(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 BV({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:T,settings:_,updateSettings:w,resetSettings:E,activeBuild:B,setActiveBuild:F,pipelineDraft:N,sessions:M,selectedPhase:$,setSelectedPhase:U,decisionEvents:O,statusSnapshots:I,setStatusSnapshot:A}=mr(),[D,R]=C.useState(()=>sessionStorage.getItem("vision-selectedItemId")||null),j=C.useRef(!!sessionStorage.getItem("vision-activeView")),[S,W]=C.useState(()=>sessionStorage.getItem("vision-activeView")||"roadmap"),[K,P]=C.useState(""),[st,ct]=C.useState(null),[Q,kt]=C.useState(!1),[wt,lt]=C.useState(!1),[Z,at]=C.useState(!1);C.useEffect(()=>{sessionStorage.setItem("vision-activeView",S)},[S]),C.useEffect(()=>{D?sessionStorage.setItem("vision-selectedItemId",D):sessionStorage.removeItem("vision-selectedItemId")},[D]);const vt=C.useRef(!1);C.useEffect(()=>{var et;(et=_==null?void 0:_.ui)!=null&&et.defaultView&&!vt.current&&!j.current&&(W(_.ui.defaultView),vt.current=!0)},[_]),C.useEffect(()=>{o&&(o.view&&W(o.view),o.phase!==void 0&&U(o.phase),o.select!==void 0&&R(o.select),a())},[o,a]),C.useEffect(()=>{const et=()=>{var G;return["INPUT","TEXTAREA","SELECT"].includes((G=document.activeElement)==null?void 0:G.tagName)},bt=G=>{(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),kt(it=>!it)),(G.metaKey||G.ctrlKey)&&G.key==="n"&&(G.preventDefault(),lt(!0)),G.key===","&&!G.metaKey&&!G.ctrlKey&&!et()&&at(!0)};return window.addEventListener("keydown",bt),()=>window.removeEventListener("keydown",bt)},[]);const Mt=C.useMemo(()=>{let et=n;if($&&(et=et.filter(bt=>bt.phase===$)),K){const bt=K.toLowerCase();et=et.filter(G=>G.title.toLowerCase().includes(bt)||(G.description||"").toLowerCase().includes(bt))}return et},[n,$,K]),Dt=C.useMemo(()=>$?n.filter(et=>et.phase===$):n,[n,$]),ce=C.useMemo(()=>new Set(Dt.map(et=>et.id)),[Dt]),oe=C.useMemo(()=>$?b.filter(et=>ce.has(et.itemId)):b,[b,ce,$]),Pe=C.useMemo(()=>{if(!$&&!K)return i;const et=new Set(Mt.map(bt=>bt.id));return i.filter(bt=>et.has(bt.fromId)&&et.has(bt.toId))},[i,Mt,$,K]);C.useEffect(()=>{y(()=>({activeView:S,selectedPhase:$,searchQuery:K,selectedItemId:D,totalItems:n.length,filteredCount:Mt.length,connected:s}))},[y,S,$,K,D,n.length,Mt.length,s]);const Zt=C.useCallback(et=>{R(et),t&&t({type:"item",id:et})},[t]),Be=C.useCallback((et,bt)=>{u(et,bt)},[u]);C.useCallback(async()=>{const bt=await c({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:$||"vision"});bt&&bt.id&&R(bt.id)},[c,$]),C.useCallback(async et=>{await d(et),D===et&&(R(null),t&&t(null))},[d,D,t]);const V=C.useCallback(et=>{const bt=b.find(G=>G.id===et);bt&&(R(bt.itemId),t&&t({type:"item",id:bt.itemId}))},[b,t]);C.useCallback(async et=>p(et),[p]),C.useCallback(async et=>f(et),[f]);const nt=C.useCallback(()=>{zt("/api/build/state").then(et=>et.json()).then(et=>F(et.state??null)).catch(()=>{})},[F]),dt=C.useCallback(et=>{t&&t({type:"step",id:et})},[t]),jt=C.useMemo(()=>{var bt;if(!D)return null;const et=n.find(G=>G.id===D);return((bt=et==null?void 0:et.lifecycle)==null?void 0:bt.featureCode)||null},[D,n]);return C.useEffect(()=>{jt&&(I&&I[jt]||zt(`/api/lifecycle/status?featureCode=${encodeURIComponent(jt)}`).then(et=>et.json()).then(et=>{et.snapshot&&A&&A(jt,et.snapshot)}).catch(()=>{}))},[jt]),h.jsx(Oc.Provider,{value:l,children:h.jsxs("div",{className:"h-full flex flex-col bg-background","data-snapshot-root":!0,children:[h.jsx(HT,{featureCode:jt,snapshot:jt?(I==null?void 0:I[jt])??null:null}),jt&&h.jsx(qT,{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(p1,{items:n,gates:b,activeBuild:B,activeView:S,onViewChange:W,selectedPhase:$,onPhaseSelect:U,searchQuery:K,onSearchChange:P,connected:s,agentActivity:m,agentErrors:x,sessionState:g,onSelectItem:Zt,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..."}),S==="tree"&&h.jsx(g1,{items:Mt,connections:Pe,selectedItemId:D,onSelect:Zt}),S==="graph"&&h.jsx(y1,{items:Mt,connections:Pe,selectedItemId:D,onSelect:Zt}),S==="pipeline"&&h.jsx(ZS,{activeBuild:B,pipelineDraft:N,onSelectStep:dt,onRefresh:nt}),S==="sessions"&&h.jsx(nT,{sessions:M,items:n,onSelectItem:Zt}),S==="docs"&&h.jsx(US,{items:Dt}),S==="gates"&&h.jsx(VS,{gates:oe,items:Dt,onResolve:T,onSelect:Zt}),S==="settings"&&h.jsx(KS,{settings:_,onSettingsChange:w,onReset:E})]}),h.jsx(WT,{onOpenGate:V}),st&&(()=>{const et=n.find(bt=>bt.id===st);return et?h.jsx(XS,{item:et,items:n,connections:i,onUpdate:Be,onClose:()=>ct(null)}):null})(),h.jsx(YS,{event:k,items:n,onNavigate:()=>W("gates")}),h.jsx(iT,{open:Q,onClose:()=>kt(!1),onSelectItem:et=>{Zt(et),kt(!1)},onSelectGate:et=>{V(et),kt(!1)}}),h.jsx($T,{open:wt,onClose:()=>lt(!1)}),h.jsx(zT,{open:Z,onClose:()=>at(!1),settings:_,onSettingsChange:w})]})]})})}ua.use(iy);const AV={background:"#0b0b14",overlay:"#161625",textPrimary:"#f1f5f9",textSecondary:"#94a3b8",textTertiary:"#64748b",textMuted:"#475569",accent:"#FBBF24"},MV={background:"#FFFFFF",overlay:"#F5F5F5",textPrimary:"#0a0a0a",textSecondary:"#404040",textTertiary:"#737373",textMuted:"#a3a3a3",accent:"#FBBF24"};function IV(t){return[{selector:"node",style:{label:"data(label)","text-valign":"center","text-halign":"center","font-size":"11px","font-weight":600,"font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textPrimary,"text-wrap":"wrap","text-max-width":"110px","background-color":t.overlay,"border-width":1,"border-color":"data(color)","border-opacity":.5,width:140,height:52,shape:"round-rectangle","text-outline-width":0,"overlay-padding":4,"overlay-opacity":0}},{selector:'node[shape = "diamond"]',style:{shape:"diamond",width:160,height:80,"font-size":"10px"}},{selector:"node:selected",style:{"border-width":2,"border-opacity":1,"border-color":t.accent}},{selector:"edge",style:{width:1,"line-color":t.textMuted,"target-arrow-color":t.textMuted,"target-arrow-shape":"triangle","curve-style":"bezier","arrow-scale":.7,opacity:.5}},{selector:"edge[label]",style:{label:"data(label)","font-size":"10px","font-family":'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',color:t.textSecondary,"text-rotation":"autorotate","text-margin-y":-8,"text-outline-width":3,"text-outline-color":t.background}},{selector:"edge[color]",style:{"line-color":"data(color)","target-arrow-color":"data(color)"}},{selector:'edge[lineStyle = "dashed"]',style:{"line-style":"dashed"}},{selector:'edge[lineStyle = "dotted"]',style:{"line-style":"dotted"}},{selector:":parent",style:{"background-color":t.overlay,"background-opacity":.3,"border-width":1,"border-color":"data(color)","border-opacity":.3,"text-valign":"top","text-halign":"center","font-size":"10px",color:t.textTertiary,padding:"16px"}}]}function FV(){const[t,e]=C.useState(()=>document.documentElement.classList.contains("dark"));return C.useEffect(()=>{const r=new MutationObserver(()=>e(document.documentElement.classList.contains("dark")));return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t}const PV={"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}},DV={"dagre-tb":"Top → Down","dagre-lr":"Left → Right",circle:"Circle",grid:"Grid",concentric:"Concentric",breadthfirst:"Breadthfirst"};function OV(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 Nc="compose:graph:";function RV(t){try{const e=localStorage.getItem(Nc+t);return e?JSON.parse(e):null}catch{return null}}function $V(t,e){try{localStorage.setItem(Nc+t,JSON.stringify(e))}catch{}}const zV=[{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 cl({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 ku(){return h.jsx("div",{className:"w-px h-4 mx-0.5",style:{background:"hsl(var(--border))"}})}function T0({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 WV({nodes:t,edges:e,graphKey:r}){const[n,i]=C.useState(()=>{try{const l=localStorage.getItem(Nc+r+":tree-collapsed");return l?new Set(JSON.parse(l)):new Set}catch{return new Set}});C.useEffect(()=>{try{localStorage.setItem(Nc+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(T0,{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(T0,{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 qV({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=FV(),m=f?AV:MV,x=C.useMemo(()=>RV(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),[T,_]=C.useState(()=>new Set((x==null?void 0:x.hiddenNodes)||[])),[w,E]=C.useState((x==null?void 0:x.showLegend)??!0),[B,F]=C.useState((x==null?void 0:x.viewMode)||"graph");C.useEffect(()=>{$V(a,{layoutKey:g,showEdgeLabels:b,hiddenNodes:[...T],showLegend:w,viewMode:B})},[a,g,b,T,w,B]);const N=t||(e&&r?OV(e,r):[]),M=C.useMemo(()=>i||IV(m),[i,f]),$=n||PV[g],U=C.useMemo(()=>N.filter(S=>!S.data.source).map(S=>({id:S.data.id,label:S.data.label,color:S.data.color})),[JSON.stringify(N)]),O=C.useMemo(()=>T.size===0?N:N.filter(S=>S.data.source?!T.has(S.data.source)&&!T.has(S.data.target):!T.has(S.data.id)),[N,T]);C.useEffect(()=>{if(!c.current)return;const S=ua({container:c.current,elements:O,style:M,layout:$,minZoom:.2,maxZoom:4,wheelSensitivity:.3,boxSelectionEnabled:!1});return u.current=S,S.on("mouseover","node",W=>{const K=W.target;K.style("border-width",2),K.style("border-opacity",1);const P=K.renderedPosition();p({x:P.x,y:P.y-K.renderedHeight()/2-12,label:K.data("label"),sublabel:K.data("sublabel"),id:K.id(),color:K.data("color")})}),S.on("mouseout","node",W=>{W.target.style("border-width",1),W.target.style("border-opacity",.5),p(null)}),l&&S.on("tap","node",W=>l(W.target.id())),S.on("layoutstop",()=>S.fit(void 0,40)),()=>{S.destroy(),u.current=null}},[JSON.stringify(O),JSON.stringify($),f,B]),C.useEffect(()=>{const S=u.current;S&&S.edges().forEach(W=>{W.data("label")&&W.style("label",b?W.data("label"):"")})},[b]);const I=C.useCallback(()=>{var S;return(S=u.current)==null?void 0:S.fit(void 0,40)},[]),A=C.useCallback(()=>{const S=u.current;S&&S.zoom({level:S.zoom()*1.3,renderedPosition:{x:S.width()/2,y:S.height()/2}})},[]),D=C.useCallback(()=>{const S=u.current;S&&S.zoom({level:S.zoom()/1.3,renderedPosition:{x:S.width()/2,y:S.height()/2}})},[]),R=C.useCallback(S=>{_(W=>{const K=new Set(W);return K.has(S)?K.delete(S):K.add(S),K})},[]),j=C.useCallback(()=>_(new Set),[]);return B==="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(cl,{mode:"graph",active:B==="graph",onClick:()=>F("graph")}),h.jsx(cl,{mode:"tree",active:B==="tree",onClick:()=>F("tree")})]})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(WV,{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:S=>y(S.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(DV).map(([S,W])=>h.jsx("option",{value:S,style:{background:"hsl(var(--accent))",color:"hsl(var(--foreground))"},children:W},S))}),h.jsx(ku,{}),h.jsx(os,{onClick:D,title:"Zoom out",children:"−"}),h.jsx(os,{onClick:I,title:"Fit to view",children:"Fit"}),h.jsx(os,{onClick:A,title:"Zoom in",children:"+"}),h.jsx(ku,{}),h.jsx(os,{onClick:()=>E(!w),active:w,title:w?"Hide legend":"Show legend",children:"Legend"}),h.jsx(ku,{}),h.jsx(cl,{mode:"graph",active:B==="graph",onClick:()=>F("graph")}),h.jsx(cl,{mode:"tree",active:B==="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"}),T.size>0&&h.jsx("button",{onClick:j,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:U.map(S=>{const W=T.has(S.id);return h.jsxs("button",{onClick:()=>R(S.id),className:"flex items-center gap-1.5 bg-transparent border-none py-0.5 cursor-pointer transition-opacity",style:{opacity:W?.35:1},title:W?`Show ${S.label}`:`Hide ${S.label}`,children:[h.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0 transition-colors",style:{background:W?"transparent":S.color,border:`1.5px solid ${S.color}`}}),h.jsx("span",{className:"text-xs",style:{color:W?"hsl(var(--muted-foreground) / 0.6)":"hsl(var(--muted-foreground))",textDecoration:W?"line-through":"none"},children:S.label})]},S.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:zV.map(S=>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:S.dash||"none"})}),h.jsx("span",{className:"text-[10px]",style:{color:"hsl(var(--muted-foreground) / 0.6)"},children:S.label})]},S.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 qt={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"},HV=[{id:"discovery",label:"Discovery",sublabel:"orthogonal process",color:qt.discovery,shape:"diamond"},{id:"pipeline",label:"Feature Development Pipeline",color:qt.pipeline},{id:"p-vision",label:"Vision",parent:"pipeline",color:qt.pipeline},{id:"p-specification",label:"Specification",parent:"pipeline",color:qt.pipeline},{id:"p-planning",label:"Planning",parent:"pipeline",color:qt.pipeline},{id:"p-implementation",label:"Implementation",parent:"pipeline",color:qt.pipeline},{id:"p-verification",label:"Verification",parent:"pipeline",color:qt.pipeline},{id:"p-release",label:"Release",parent:"pipeline",color:qt.pipeline},{id:"feature",label:"Feature",sublabel:"strategic container",color:qt.feature},{id:"track",label:"Track",sublabel:"deliverable unit",color:qt.track},{id:"task",label:"Task",sublabel:"planned → doing → done",color:qt.task},{id:"spec",label:"Spec",sublabel:"behavioral specification",color:qt.spec},{id:"evaluation",label:"Evaluation",sublabel:"assessment / gap analysis",color:qt.evaluation},{id:"idea",label:"Idea",sublabel:"can float free",color:qt.idea},{id:"thread",label:"Thread",sublabel:"deliberation",color:qt.thread},{id:"decision",label:"Decision",sublabel:"resolved choice",color:qt.decision},{id:"question",label:"Question",sublabel:"may block progress",color:qt.question},{id:"artifact",label:"Artifact",sublabel:"journal / doc / output",color:qt.artifact}],UV=[{from:"p-vision",to:"p-specification",color:qt.pipeline},{from:"p-specification",to:"p-planning",color:qt.pipeline},{from:"p-planning",to:"p-implementation",color:qt.pipeline},{from:"p-implementation",to:"p-verification",color:qt.pipeline},{from:"p-verification",to:"p-release",color:qt.pipeline},{from:"idea",to:"p-vision",label:"lives in",color:qt.idea,style:"dotted"},{from:"spec",to:"p-specification",label:"lives in",color:qt.spec,style:"dotted"},{from:"task",to:"p-implementation",label:"lives in",color:qt.task,style:"dotted"},{from:"evaluation",to:"p-verification",label:"lives in",color:qt.evaluation,style:"dotted"},{from:"discovery",to:"feature",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"idea",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"thread",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"decision",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"question",label:"produces",color:qt.discovery,style:"dashed"},{from:"discovery",to:"spec",label:"produces",color:qt.discovery,style:"dashed"},{from:"track",to:"feature",label:"implements",color:qt.track},{from:"task",to:"feature",label:"implements",color:qt.task},{from:"spec",to:"feature",label:"implements",color:qt.spec},{from:"feature",to:"feature",label:"blocks",color:qt.question,id:"feat-blocks"},{from:"idea",to:"feature",label:"informs",color:qt.informs,style:"dashed"},{from:"thread",to:"decision",label:"informs",color:qt.informs,style:"dashed"},{from:"evaluation",to:"decision",label:"informs",color:qt.informs,style:"dashed"},{from:"artifact",to:"feature",label:"supports",color:qt.artifact},{from:"question",to:"decision",label:"contradicts",color:qt.question},{from:"feature",to:"p-vision",label:"enters",color:qt.feature,style:"dashed"}];function GV(){return h.jsx(qV,{graphKey:"product",nodes:HV,edges:UV,title:"Compose Product Ontology",subtitle:"10 entity types · 6 phases · 5 edge types · Discovery orthogonal"})}const VV="compose-popout";function UT(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 hl({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:UT(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(jA,{style:{width:11,height:11}}),"pop in"]})]})}function YV({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=UT(t)+" — Compose"},[t]),C.useEffect(()=>{const c=new BroadcastChannel(VV);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}zt(`/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(hl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(BV,{})})]}):a==="graph"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(hl,{path:t,onDock:l}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(GV,{})})]}):a==="html"?h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background",children:[h.jsx(hl,{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(hl,{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(Cf,{remarkPlugins:[Sf],children:e||""})})})]})}const XV="/api/stratum";async function fh(t,e={}){return(await zt(`${XV}${t}`,{headers:{"Content-Type":"application/json",...e.headers||{}},...e})).json()}function KV(t,e){return fh(t,{method:"POST",body:JSON.stringify(e)})}function GT({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 Vp(){return h.jsx("span",{style:{opacity:.5,fontSize:"0.85em"},children:"loading…"})}function ZV({onAction:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState({}),[a,l]=C.useState({}),c=C.useCallback(()=>{fh("/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 KV(`/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(Vp,{}):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 QV({flowId:t,onClose:e}){const[r,n]=C.useState(null),[i,s]=C.useState(null);return C.useEffect(()=>{fh(`/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(Vp,{}),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(GT,{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 JV({activeBuild:t}){const[e,r]=C.useState(null),[n,i]=C.useState(null),[s,o]=C.useState(null),a=C.useCallback(()=>{fh("/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(Vp,{}):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(GT,{status:l.status})]})]})},l.flow_id)),s&&h.jsx("div",{style:{marginTop:8},children:h.jsx(QV,{flowId:s,onClose:()=>o(null)})})]})}const tY={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 eY({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:tY}),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 rY(){const t=mr(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(eY,{build:t,onDismiss:n}),h.jsx(ZV,{}),h.jsx("div",{style:{marginTop:20},children:h.jsx(JV,{activeBuild:t})})]})}function nY({projectName:t,projectRoot:e,onSwitch:r}){const[n,i]=C.useState(!1),[s,o]=C.useState(e||""),a=C.useRef(null);return C.useEffect(()=>{o(e||"")},[e]),C.useEffect(()=>{if(!n)return;const l=c=>{var u;(u=a.current)!=null&&u.contains(c.target)||i(!1)};return window.addEventListener("mousedown",l),()=>window.removeEventListener("mousedown",l)},[n]),C.useEffect(()=>{if(!n)return;const l=c=>{c.key==="Escape"&&i(!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]),h.jsxs("div",{ref:a,className:"flex items-center shrink-0 gap-2 relative",children:[h.jsx("span",{className:"text-xs font-semibold tracking-widest uppercase text-blue-600 dark:text-accent",children:"Compose"}),h.jsx("button",{"data-testid":"project-btn",className:"text-[10px] uppercase tracking-wider text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(l=>!l),title:e||"Switch project","aria-label":"Switch project","aria-haspopup":"dialog","aria-expanded":n,children:t||"no project"}),n&&h.jsxs("div",{"data-testid":"project-popover",role:"dialog","aria-label":"Switch project",className:"absolute top-full left-0 mt-1 z-50 p-2 rounded-md shadow-lg",style:{background:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",minWidth:"280px"},children:[h.jsxs("div",{className:"text-[10px] text-muted-foreground mb-1 px-1",children:["Current: ",e]}),h.jsx("input",{autoFocus:!0,"data-testid":"project-input",className:"w-full px-2 py-1 text-xs rounded border bg-background text-foreground",style:{borderColor:"hsl(var(--border))"},placeholder:"Absolute path to project...",value:s,onChange:l=>o(l.target.value),onKeyDown:async l=>{l.key==="Enter"&&await r(s)&&i(!1),l.key==="Escape"&&i(!1)}})]})]})}const iY={dashboard:{label:"Dashboard",icon:uM,tip:"Overview of project status and activity"},tree:{label:"Items",icon:Sb,tip:"Hierarchical list of all items and features"},graph:{label:"Graph",icon:vM,tip:"Visual dependency graph of items"},pipeline:{label:"Pipeline",icon:UM,tip:"Build pipeline stages and progress"},sessions:{label:"Sessions",icon:Tf,tip:"Active and past agent sessions"},gates:{label:"Gates",icon:qs,tip:"Quality gates and approval checkpoints"},docs:{label:"Docs",icon:Li,tip:"Project documentation and specs"},design:{label:"Design",icon:Pc,tip:"Design agent conversations and decisions"},ideabox:{label:"Ideabox",icon:Ci,tip:"Captured ideas and suggestions"}};function sY({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=iY[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,title:o==null?void 0:o.tip,className:["flex items-center gap-1.5 px-3 h-full text-[11px] uppercase tracking-wider font-medium transition-colors","border-b-2 -mb-px",a?"border-blue-600 text-blue-600 dark:border-accent dark:text-accent":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"].join(" "),onClick:()=>r==null?void 0:r(s),children:[l&&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(Qn,{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 oY(){const[t,e]=C.useState(hy);function r(){const n=!t;q_(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 Ge={COLLAPSED:"collapsed",EXPANDED:"expanded",MAXIMIZED:"maximized"},aY={[Ge.COLLAPSED]:Ge.EXPANDED,[Ge.EXPANDED]:Ge.MAXIMIZED,[Ge.MAXIMIZED]:Ge.COLLAPSED};function lY(t){return aY[t]??Ge.COLLAPSED}function cY(t){return Ge.COLLAPSED}function hY(t){return Ge.MAXIMIZED}const uY=new Set(Object.values(Ge));function dY(t){return uY.has(t)}function fY(t){switch(t){case Ge.COLLAPSED:return"h-7";case Ge.EXPANDED:return"h-[40vh]";case Ge.MAXIMIZED:return"flex-1";default:return"h-7"}}const VT="compose:agentBarState";function pY(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(VT);return dY(e)?e:Ge.COLLAPSED}catch{return Ge.COLLAPSED}}function mY(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(VT,t)}catch{}}const _0="▾",gY="▴",xY="⤢";function yY({barState:t="collapsed",onStateChange:e}){const[r,n]=C.useState("ready"),[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"?"ready":f?`${f} — ${m??p}`:m||(p==="idle"?"ready":p??"ready"))}return window.addEventListener("compose:agent-status",u),()=>window.removeEventListener("compose:agent-status",u)},[]);const o=C.useCallback(()=>{e==null||e(lY(t))},[t,e]),a=C.useCallback(()=>{e==null||e(cY())},[t,e]);C.useCallback(()=>{e==null||e(hY())},[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?gY:c?xY:_0}),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(oY,{}),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:_0})]}),!l&&h.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:h.jsx(dy,{})})]})}const bY=280,kY=.6;function vY({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*kY,b=Math.max(bY,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:Xt.Children.toArray(i).length>0?h.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:i}):h.jsx(SY,{activeBuild:s,pendingGates:d,agentErrors:a,items:l})})]})}const wY={implementation:"#3b82f6",vision:"#a855f7",planning:"#f59e0b",specification:"#06b6d4",verification:"#22c55e",design:"#f43f5e"};function E0(t){return wY[t]||"#6b7280"}function SY({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:Xo(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:E0(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:E0(a)}}),a,": ",l]},a))})]})]})]})}const Fn=60,Pr=24,ul=80,vu=28,wu=48,N0=8,fs=5,jc=9;function TY(t,e){return t?t.length>e?t.slice(0,e)+"…":t:""}function _Y(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 Su(t,e,r,n,i){const s=Math.min(t,fs),o=s*n+(s-1)*N0,a=(r-o)/2,l=[];for(let c=0;c<s;c++)l.push({x:a+c*(n+N0),y:e,w:n,h:i});return{positions:l,overflow:t>fs?t-fs+1:0}}function dl({item:t,x:e,y:r,w:n,h:i,isSelected:s,isDashed:o,onSelect:a,onHover:l,onLeave:c}){const u=gr[t.type]||gr.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?jc+1:jc,fontWeight:s?600:400,fill:"hsl(var(--foreground))",children:TY(t.title,s?10:8)})]})}function EY({item:t,pos:e}){if(!t||!e)return null;const r=gr[t.type]||gr.task,n=Hn[t.status]||Hn.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:nf[t.confidence||0]})]})]})}function NY({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(()=>_Y(t,e,r),[t,e,r]),d=C.useCallback((I,A)=>{const D=A.currentTarget.closest(".connection-graph-wrap").getBoundingClientRect(),R=A.currentTarget.getBoundingClientRect();s(I),a({x:R.x+R.width/2-D.x,y:R.y-D.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=Su(l.length,g,m,Fn,Pr);y=I.positions,b=I.overflow,g+=Pr+wu}const k=(m-ul)/2,T=g;g+=vu+wu;let _=[],w=0;if(c.length>0){const I=Su(c.length,g,m,Fn,Pr);_=I.positions,w=I.overflow,g+=Pr}let E=new Map,B=new Map;const F=[...u.entries()];let N=[];if(F.length>0){g+=wu;for(const[D,R]of F)for(const j of R)N.push({...j,_parentChildId:D});const I=Su(N.length,g,m,Fn,Pr);let A=0;for(const[D,R]of F){const j=[];for(let S=0;S<R.length&&A<I.positions.length;S++,A++)j.push(I.positions[A]);E.set(D,j)}I.overflow>0&&B.set("all",I.overflow),g+=Pr}const M=g+12;for(let I=0;I<y.length;I++){const A=y[I];x.push({x1:A.x+A.w/2,y1:A.y+A.h,x2:k+ul/2,y2:T})}for(let I=0;I<_.length;I++){const A=_[I];x.push({x1:k+ul/2,y1:T+vu,x2:A.x+A.w/2,y2:A.y})}for(const[I,A]of E){const D=c.findIndex(R=>R.id===I);if(D>=0&&D<_.length){const R=_[D];for(const j of A)x.push({x1:R.x+R.w/2,y1:R.y+R.h,x2:j.x+j.w/2,y2:j.y})}}const $=l.slice(0,fs-(b>0?1:0)),U=c.slice(0,fs-(w>0?1:0)),O=N.slice(0,fs-(B.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:M,className:"w-full",viewBox:`0 0 ${m} ${M}`,children:[x.map((I,A)=>h.jsx("line",{x1:I.x1,y1:I.y1,x2:I.x2,y2:I.y2,stroke:"hsl(var(--muted-foreground))",strokeOpacity:.3,strokeWidth:1},A)),$.map((I,A)=>h.jsx(dl,{item:I,x:y[A].x,y:y[A].y,w:Fn,h:Pr,isSelected:!1,isDashed:!0,onSelect:n,onHover:d,onLeave:p},I.id)),b>0&&h.jsxs("text",{x:y[y.length-1].x+Fn/2,y:y[0].y+Pr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:jc,fill:"hsl(var(--muted-foreground))",children:["+",b," more"]}),h.jsx(dl,{item:t,x:k,y:T,w:ul,h:vu,isSelected:!0,isDashed:!1,onSelect:n,onHover:d,onLeave:p}),U.map((I,A)=>h.jsx(dl,{item:I,x:_[A].x,y:_[A].y,w:Fn,h:Pr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},I.id)),w>0&&h.jsxs("text",{x:_[_.length-1].x+Fn/2,y:_[0].y+Pr/2,textAnchor:"middle",dominantBaseline:"central",fontSize:jc,fill:"hsl(var(--muted-foreground))",children:["+",w," more"]}),O.map((I,A)=>{const R=[...E.values()].flat()[A];return R?h.jsx(dl,{item:I,x:R.x,y:R.y,w:Fn,h:Pr,isSelected:!1,isDashed:!1,onSelect:n,onHover:d,onLeave:p},I.id):null})]}),h.jsx(EY,{item:i,pos:o})]})]})}const jY=["Untested","Low","Moderate","High","Crystallized"];function LY({level:t=0,className:e}){const r=Math.max(0,Math.min(4,t||0)),n=jY[r]??"Untested",i=r===0?Zp[0]:Zp[r];return h.jsxs("span",{className:rt("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:rt("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 BY(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 j0(t){return t==null?"—":t<1e3?String(t):t<1e6?`${(t/1e3).toFixed(1)}k`:`${(t/1e6).toFixed(1)}M`}function AY(t){return t==null?"—":`$${Number(t).toFixed(t<1?3:2)}`}function MY(t){if(t==null)return"—";const e=Math.round(t/1e3);if(e<60)return`${e}s`;const r=Math.round(e/60);if(r<60)return`${r}m`;const n=Math.floor(r/60),i=r%60;return`${n}h${i?` ${i}m`:""}`}function IY(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:BY(new Date(n).toISOString(),e)}function FY(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=IY(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 PY(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 L0({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:`${j0(i.tokens_in)} / ${j0(i.tokens_out)}`},{label:"USD",value:AY(i.usd)},{label:"Wall clock",value:MY(i.wall_clock_ms)},{label:"Final artifact",value:((o=t.final_artifact)==null?void 0:o.path)||"—"},...e];return 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 DY({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}=FY(t,i),[u,d]=PY(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(L0,{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(L0,{branch:d,extraRows:n(d)})]})]}),h.jsx("div",{className:"col-span-2",children:x?h.jsx(zp,{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 OY={path_drift:"Path drift",contract_drift:"Contract drift",review_debt_drift:"Review debt"};function RY(t){return OY[t]??t}function B0(t){return t==null||typeof t!="number"||isNaN(t)?"—":`${Math.round(t*100)}%`}function $Y(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 zY({item:t}){const[e,r]=C.useState(!1),n=$Y(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(Dc,{size:13}),h.jsxs("span",{children:[i," drift alert",i!==1?"s":""," — click to ",e?"collapse":"expand"]}),e?h.jsx(Cb,{size:13,style:{marginLeft:"auto"}}):h.jsx(ga,{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:RY(s.axis_id)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--destructive))"},children:B0(s.ratio)}),h.jsx("td",{style:{padding:"2px 4px",textAlign:"right",color:"hsl(var(--muted-foreground))"},children:B0(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 WY({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:nf[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 qY({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:Hn[c.status]||Hn.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:gr[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 fl(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 HY({featureCode:t,lineage:e}){const r=mr(i=>i.selectedBranches),n=mr(i=>i.setSelectedBranches);return h.jsx(DY,{lineage:e,selectedPair:(r==null?void 0:r[t])||[],onSelectPair:i=>n(t,i)})}function UY({featureCode:t}){const[e,r]=C.useState([]),[n,i]=C.useState(!0);return C.useEffect(()=>{const s=new AbortController;return i(!0),zt(`/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 GY=["informs","supports","blocks","contradicts"];function VY({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:GY.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(Qn,{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:Hn[u.status]||Hn.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:gr[u.type]},children:u.type})]},u.id))})]})})}function YY({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(Wt,{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(Wt,{variant:"outline",size:"sm",className:rt("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(Wt,{variant:"outline",size:"sm",className:rt("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(Wt,{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 XY({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,A,D,R,j,S;const[p,f]=C.useState(!1),[m,x]=C.useState(""),[g,y]=C.useState(!1),[b,k]=C.useState(""),[T,_]=C.useState(!1),[w,E]=C.useState("");C.useEffect(()=>{E((t==null?void 0:t.group)||"")},[t==null?void 0:t.id,t==null?void 0:t.group]);const B=C.useCallback(()=>{const W=w.trim(),K=(t==null?void 0:t.group)||"";W!==K&&i(t.id,{group:W||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]),N=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]),M=C.useCallback(()=>{k(t.description||""),y(!0)},[t==null?void 0:t.description]),$=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]),U=C.useMemo(()=>{if(!t)return 0;let W=0;for(const K of r)K.type==="contradicts"&&(K.fromId===t.id||K.toId===t.id)&&W++;return W},[t==null?void 0:t.id,r]);if(!t)return null;const O=gr[t.type]||gr.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(rr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",style:{color:O,borderColor:O},children:t.type}),t.phase&&h.jsx(rr,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4",children:Il[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:W=>x(W.target.value),onBlur:N,onKeyDown:W=>{W.key==="Enter"&&N(),W.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(Wt,{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(Gl,{}),h.jsx(Un,{className:"flex-1",children:h.jsxs("div",{className:"p-3 space-y-4",children:[h.jsx(zY,{item:t}),((I=t.lifecycle)==null?void 0:I.featureCode)&&h.jsx(HY,{featureCode:t.lifecycle.featureCode,lineage:(A=t.lifecycle.lifecycle_ext)==null?void 0:A.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:W=>i(t.id,{status:W.target.value}),children:x_.map(W=>h.jsx("option",{value:W,children:W.replace("_"," ")},W))}),h.jsx(WY,{level:t.confidence||0,onChange:W=>i(t.id,{confidence:W})})]}),h.jsx(LY,{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:W=>i(t.id,{phase:W.target.value||null}),children:[h.jsx("option",{value:"",children:"No phase"}),sy.map(W=>h.jsx("option",{value:W,children:Il[W]},W))]})]}),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:W=>E(W.target.value),onBlur:B,onKeyDown:W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(E(t.group||""),W.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:W=>k(W.target.value),onBlur:$,onKeyDown:W=>{W.key==="Escape"&&y(!1)},autoFocus:!0}):h.jsx("p",{className:rt("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:M,children:t.description||"Click to add description..."})]}),h.jsx(qY,{item:t,connections:r,items:e,onSelect:l,onDeleteConnection:a}),h.jsx(NY,{item:t,items:e,connections:r,onSelect:l}),((D=t.lifecycle)==null?void 0:D.featureCode)&&h.jsx(UY,{featureCode:t.lifecycle.featureCode}),(t.lifecycle||n&&n.some(W=>W.itemId===t.id))&&(()=>{var ct;const W=t.lifecycle,K=n?n.filter(Q=>Q.itemId===t.id):[],P=K.filter(Q=>Q.status==="pending"),st=K.filter(Q=>Q.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:[W&&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:_e[W.currentPhase]??W.currentPhase}),W.featureCode&&h.jsx("span",{className:"text-[10px] text-muted-foreground ml-auto font-mono",children:W.featureCode})]}),((ct=W==null?void 0:W.phaseHistory)==null?void 0:ct.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:W.phaseHistory.map((Q,kt)=>h.jsxs("span",{className:rt("text-[10px]",Q.phase===W.currentPhase?"text-foreground font-medium":"text-muted-foreground"),children:[_e[Q.phase]??Q.phase,Q.outcome&&Q.outcome!=="approved"&&h.jsxs("span",{className:"text-amber-400",children:[" (",Q.outcome,")"]}),kt<W.phaseHistory.length-1&&" → "]},kt))})]}),P.map(Q=>{var lt,Z;const kt=Q.artifactAssessment,wt=oy[Q.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[Q.stepId]??`${_e[Q.fromPhase]??Q.fromPhase} → ${_e[Q.toPhase]??Q.toPhase}`]}),kt&&kt.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[wt&&h.jsx("span",{className:"font-mono",children:wt}),wt&&": ",Math.round(kt.completeness*100),"% complete"," · ",kt.wordCount," words",((Z=(lt=kt.sections)==null?void 0:lt.missing)==null?void 0:Z.length)>0&&h.jsxs("span",{className:"text-amber-400",children:[" (missing: ",kt.sections.missing.join(", "),")"]}),!kt.meetsMinWordCount&&h.jsx("span",{className:"text-amber-400",children:" (below min word count)"})]}),kt&&!kt.exists&&h.jsxs("p",{className:"text-[10px] text-muted-foreground mb-1",children:[wt??"Artifact"," not found"]}),d&&h.jsx(YY,{gate:Q,onResolveGate:d})]},Q.id)}),st.map(Q=>{const kt={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[Q.stepId]??`${_e[Q.fromPhase]??Q.fromPhase} → ${_e[Q.toPhase]??Q.toPhase}`}),h.jsx(rr,{variant:"outline",className:rt("text-[10px] px-1.5 py-0 h-4 ml-auto",kt[Q.outcome]||""),children:Q.outcome})]},Q.id)})]})]})})(),((j=(R=t.evidence)==null?void 0:R.stratumViolations)==null?void 0:j.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:fl(t.evidence.violatedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:t.evidence.stratumViolations.map((W,K)=>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:W})]},K))})]}),((S=t.evidence)==null?void 0:S.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:fl(t.evidence.tracedAt)})]}),h.jsx("div",{className:"space-y-0.5",children:(t.evidence.stratumTrace.trace||[]).map(W=>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:W.step_id}),W.attempts>1&&h.jsxs("span",{className:"text-[10px] text-amber-400 shrink-0",children:[W.attempts,"x"]}),W.duration_ms!=null&&h.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:W.duration_ms<1e3?`${W.duration_ms}ms`:`${(W.duration_ms/1e3).toFixed(1)}s`})]},W.step_id))})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Created ",fl(t.createdAt)]}),h.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Updated ",fl(t.updatedAt)]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[h.jsxs("div",{className:"relative",children:[h.jsxs(Wt,{variant:"outline",size:"sm",className:rt("h-7 text-xs gap-1",T&&"bg-accent/10 border-accent"),onClick:()=>_(!T),children:[h.jsx(pM,{className:"h-3 w-3"})," Connect"]}),T&&h.jsx(VY,{item:t,items:e,onCreateConnection:o,onDismiss:()=>_(!1)})]}),h.jsxs(Wt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:F,children:[h.jsx(_b,{className:"h-3 w-3"})," Rename"]}),t.type!=="question"&&h.jsxs(Wt,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(t.id),title:"Challenge this item's assumptions",children:[h.jsx(zl,{className:"h-3 w-3"})," Pressure Test",U>0&&h.jsx("span",{className:"ml-0.5 text-[10px] px-1 py-0 rounded-full bg-amber-500/20 text-amber-400",children:U})]}),t.status!=="killed"&&h.jsxs(Wt,{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 W=await zt(`/api/vision/items/${t.id}/lifecycle/kill`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Killed via UI"})});if(!W.ok){const K=await W.json();console.error("[vision] Lifecycle kill failed:",K.error)}}catch(W){console.error("[vision] Lifecycle kill failed:",W.message)}else i(t.id,{status:"killed"})},children:[h.jsx(Xm,{className:"h-3 w-3"})," Kill"]}),s&&h.jsxs(Wt,{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(Xm,{className:"h-3 w-3"})," Delete"]})]})]})})]})}const YT=[{id:"overview",label:"Overview"},{id:"pipeline",label:"Pipeline"},{id:"sessions",label:"Sessions"},{id:"errors",label:"Errors"},{id:"files",label:"Files"}];YT.map(t=>t.id);const KY={overview:Li,pipeline:Sb,sessions:vb,errors:Dc,files:Ef};function ZY({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:YT.map(({id:n,label:i})=>{const s=KY[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 A0=[{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 Vd(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 QY({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:A0.map((o,a)=>{const l=Vd(o.id,i,e,s),c=Kp[l],u=r===o.id;return h.jsxs(Xt.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:A0.map(o=>{const a=Vd(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)":Kp[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(JY,{stepId:r,phaseHistory:i,activeBuild:e,featureCode:s})})]})}function JY({stepId:t,phaseHistory:e,activeBuild:r,featureCode:n}){const i=Vd(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 tX(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 eX(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(0)}s`:`${(t/6e4).toFixed(1)}m`:"—"}function rX({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:eX(a.durationMs)}),h.jsx("span",{className:"text-[9px] text-muted-foreground ml-auto shrink-0",children:tX(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 nX(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 Tu=10;function iX({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(HA,{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,Tu);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:nX(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>Tu&&h.jsxs("button",{onClick:()=>o(!0),className:"w-full text-center text-[10px] text-accent hover:underline py-1",children:["Show ",l.length-Tu," more"]})]})}function sX(t){return t?t<1024?`${t}B`:t<1048576?`${(t/1024).toFixed(1)}KB`:`${(t/1048576).toFixed(1)}MB`:"—"}function oX(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 aX({featureCode:t,onOpenFile:e}){const[r,n]=C.useState([]),[i,s]=C.useState(!0);C.useEffect(()=>{const l=new AbortController;return s(!0),zt("/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(Ef,{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(Li,{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:sX(p)}),f&&h.jsx("span",{className:"text-[9px] text-muted-foreground shrink-0",children:oX(f)})]},c)})]})}function lX({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}=mr(Mi(E=>({items:E.items,connections:E.connections,gates:E.gates,updateItem:E.updateItem,deleteItem:E.deleteItem,createConnection:E.createConnection,deleteConnection:E.deleteConnection,resolveGate:E.resolveGate,activeBuild:E.activeBuild,sessions:E.sessions,agentErrors:E.agentErrors}))),y=o.find(E=>E.id===t)||null,[b,k]=C.useState("overview"),T=((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)||"",_=C.useMemo(()=>T?g.filter(E=>E.featureCode===T||T&&E.message&&E.message.includes(T)):[],[g,T]);return y?h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsx(ZY,{activeTab:b,onTabChange:k,errorCount:_.length}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-auto",children:[b==="overview"&&h.jsxs(h.Fragment,{children:[h.jsx(XY,{item:y,items:o,connections:a,gates:l,onUpdate:(E,B)=>c(E,B),onDelete:E=>{u(E),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(QY,{item:y,activeBuild:m}),b==="sessions"&&h.jsx(rX,{featureCode:T,sessions:x,items:o}),b==="errors"&&h.jsx(iX,{featureCode:T,errors:g,items:o}),b==="files"&&h.jsx(aX,{featureCode:T,onOpenFile:n})]})]}):h.jsx("div",{className:"p-3 text-[11px] text-muted-foreground italic",children:"Item not found."})}function cX(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 hX(t){var e;return(e=t==null?void 0:t.violations)!=null&&e.length?t.violations:[]}function uX(t,e){if(!t)return null;for(const r of t.values())if(r.stepId===e)return r;return null}function dX(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 fX(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 M0(t){return!t||t<=0?"$0.00":`$${t.toFixed(4)}`}const I0=[{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 pX({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:[I0.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(Xt.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=I0.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 _u(t){return t>=80?"text-success":t>=60?"text-amber-400":"text-destructive"}function mX(t){return t==="improving"?"↑":t==="declining"?"↓":"→"}const F0={test_coverage:"Tests",review_findings:"Review",contract_compliance:"Contracts",runtime_errors:"Runtime",doc_freshness:"Docs",plan_completion:"Plan"};function P0(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 gX({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=dX(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:[P0(i.elapsedMs),i.timeoutMs!=null&&h.jsxs("span",{className:"text-muted-foreground",children:[" / ",P0(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 xX({stepId:t,tierEvents:e=[],healthEvents:r=[],capabilityEvents:n=[]}){const{activeBuild:i,iterationStates:s}=mr(Mi(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,zt(`/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(N=>N.id===t||N.step_id===t)||null,allSteps:i.steps}:{step:null,allSteps:[]},[i,t]),m=C.useMemo(()=>{if(!r||r.length===0)return null;for(let F=r.length-1;F>=0;F--){const N=r[F];if(N.subtype==="health_score"&&typeof N.score=="number")return N}return null},[r]),{tierMap:x,tierSummary:g}=C.useMemo(()=>{if(!e||e.length===0)return{tierMap:{},tierSummary:null};const F={};let N=null;for(const M of e)M.subtype==="gate_tier_result"?F[M.tierId]=M.passed:M.subtype==="gate_tier_summary"&&(N=M);return{tierMap:F,tierSummary:N}},[e]),y=Object.keys(x).length>0||g!==null,b=C.useMemo(()=>{const F=f.filter(N=>N.cost_usd!=null);return F.length===0?[]:[...F].sort((N,M)=>o?(N.cost_usd??0)-(M.cost_usd??0):(M.cost_usd??0)-(N.cost_usd??0))},[f,o]),k=b.length>0?b[0].id:null,T=C.useMemo(()=>cX(p),[p]),_=C.useMemo(()=>hX(p),[p]),w=C.useMemo(()=>uX(s,t),[s,t]),E=C.useMemo(()=>{if(!n||n.length===0)return null;const F=n.filter($=>$.stepId===t);if(F.length===0)return null;const N=F.filter($=>$.severity==="violation").length,M=F.filter($=>$.severity==="warning").length;return{total:F.length,hardViolations:N,warnings:M}},[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 B={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 ${B[p.status]||"text-foreground"}`,children:p.status||"unknown"})]}),T&&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 ",T.count," ",T.count===1?"time":"times"]}),T.isArray&&T.items.length>0&&h.jsx("div",{className:"mt-1 space-y-0.5",children:T.items.map((F,N)=>h.jsxs("div",{className:"text-[10px] text-muted-foreground pl-2",children:["#",N+1,F.reason?`: ${F.reason}`:""]},N))})]}),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,N)=>h.jsx("p",{className:"text-[10px] text-foreground font-mono truncate",children:F},N))})]}),(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:M0(p.cost_usd)})]})]}),y&&h.jsx("div",{children:h.jsx(pX,{tierMap:x,tierSummary:g})}),_.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:_.map((F,N)=>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)})]},N))})]}),E&&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:[E.total," ",E.total===1?"finding":"findings"," ","(",E.hardViolations," ",E.hardViolations===1?"violation":"violations",","," ",E.warnings," ",E.warnings===1?"warning":"warnings",")"]})]}),(w==null?void 0:w.status)==="running"&&h.jsx(gX,{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 ${_u(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 ${_u(m.score)}`,children:[mX(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,N])=>h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[9px] text-muted-foreground w-16 shrink-0",children:F0[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 ${N>=80?"bg-success":N>=60?"bg-amber-400":"bg-destructive"}`,style:{width:`${N}%`}})}),h.jsx("span",{className:`text-[9px] font-mono w-6 text-right ${_u(N)}`,children:N})]},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=>F0[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 N=F.id===k,M=F.id===t,$=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:`${N?"text-amber-400":"text-foreground"} ${M?"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:M0(F.cost_usd)}),h.jsx("td",{className:"text-right pl-2 py-0.5 text-muted-foreground",children:$})]},F.id)})})]})})]})]})}function XT(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 D0(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 yX(t,e){return(e||[]).filter(n=>!n.superseded).map(n=>({title:n.question,type:"decision",decided:!0}))}const To={es:null},qn=Lf((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 zt(`/api/design/session${a}`),{session:c}=await l.json();if(c){const u=c.messages||[],d=c.decisions||[],p=D0(u,d),f=yX(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 zt("/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 zt("/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 zt("/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 zt("/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 zt("/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(To.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}`);To.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:()=>{To.es&&(To.es.close(),To.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=D0(r,n);t({draftDoc:i,docManuallyEdited:!1})}}));function bX(){const{draftDoc:t,docManuallyEdited:e,updateDraftDoc:r,resetDocEdited:n}=qn(Mi(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(Cf,{remarkPlugins:[Sf],children:t})})})]})}const CX=4e3,O0={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 kX(){const[t,e]=C.useState(null),r=C.useRef(null);if(C.useEffect(()=>{function i(s){const{message:o,level:a="info",ttl:l=CX}=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=O0[t.level]??O0.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 Eu={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%)"}},R0={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 vX({type:t="build",label:e,retries:r=0,onClick:n,onApprove:i,onDismiss:s,animationState:o="steady"}){const a=(o==="flash"?Eu.done:Eu[t])||Eu.build,l=R0[o]||R0.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 wX(t){return!t||t<=0?"":`$${t.toFixed(2)}`}function SX(t){const e=Math.floor(t/1e3),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function TX(t){const e=Math.round(t*60),r=Math.floor(e/60),n=e%60;return`${r}:${String(n).padStart(2,"0")}`}function _X({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=wX(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=`, ${SX(p)}/${TX(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 EX({activeView:t,onSelectFeature:e}){const{activeBuild:r,gates:n,items:i,recentErrors:s,resolveGate:o,iterationStates:a}=mr(Mi(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,zt(`/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,A)=>I+(A.count??0),0):0;O!==y.current&&(y.current=O,zt(`/api/lifecycle/budget?featureCode=${encodeURIComponent(g)}`).then(I=>I.json()).then(I=>m(I)).catch(()=>{}))},[a,g]);const b=C.useRef(r),[k,T]=C.useState(null);C.useEffect(()=>{const O=b.current;if(O&&O.featureCode&&!r){T({...O,status:"complete"});const I=setTimeout(()=>T(null),3e3);return b.current=r,()=>clearTimeout(I)}b.current=r},[r]);const _=r||k,[w,E]=C.useState(()=>Date.now()),B=a&&[...a.values()].some(O=>O.status==="running");C.useEffect(()=>{if(!B)return;const O=setInterval(()=>E(Date.now()),1e3);return()=>clearInterval(O)},[B]);const F=C.useMemo(()=>_X({activeBuild:_,gates:n,items:i,recentErrors:s,iterationStates:a,now:w}),[_,n,i,s,a,w]),N=C.useMemo(()=>F.filter(O=>!d.current.has(O.key)),[F]);C.useEffect(()=>{const O=new Set(u.current.map(A=>A.key)),I=N.filter(A=>!O.has(A.key)).map(A=>A.key);I.length>0&&(c(A=>{const D=new Map(A);for(const R of I)D.set(R,"enter");return D}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{c(A=>{const D=new Map(A);for(const R of I)D.get(R)==="enter"&&D.set(R,"steady");return D})})}));for(const A of N)A.type==="done"&&!p.current.has(A.key)&&(p.current.add(A.key),c(D=>{const R=new Map(D);return R.set(A.key,"flash"),R}),setTimeout(()=>{c(D=>{const R=new Map(D);return R.set(A.key,"exit"),R}),setTimeout(()=>{d.current.add(A.key),c(D=>{const R=new Map(D);return R.delete(A.key),R})},500)},2e3));u.current=N},[N]);const M=C.useCallback(O=>{c(I=>{const A=new Map(I);return A.set(O,"exit"),A}),setTimeout(()=>{d.current.add(O),c(I=>{const A=new Map(I);return A.delete(O),A})},200)},[]),$=C.useCallback(O=>{o&&o(O,"approve","Approved from ops strip")},[o]);if(t==="docs"||N.length===0)return null;const U=fX(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:[N.map(O=>h.jsx(vX,{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?()=>$(O.gateId):void 0,onDismiss:O.type==="error"?()=>M(O.key):void 0},O.key)),U&&h.jsx("span",{className:"ml-auto text-[9px] text-muted-foreground font-mono shrink-0 opacity-70",title:"Cumulative budget usage: review / coverage",children:U})]})}const Nu=["dashboard","graph","tree","docs","design","gates","pipeline","sessions","ideabox"];function NX(t,e){return!e||!Array.isArray(t)?!1:t.includes(e)}function jX(t){return(t==null?void 0:t[0])??null}const LX="compose:mainTabs",KT="compose:activeTab";function BX(){var t;try{const e=(t=globalThis.localStorage)==null?void 0:t.getItem(LX);if(!e)return[...Nu];const r=JSON.parse(e);if(Array.isArray(r)&&r.length>=1){let n=r;for(const i of Nu)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[...Nu]}function AX(t){var e;try{const r=(e=globalThis.localStorage)==null?void 0:e.getItem(KT);if(r&&NX(t,r))return r}catch{}return jX(t)}function $0(t){var e;try{(e=globalThis.localStorage)==null||e.setItem(KT,t)}catch{}}function ZT(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 QT(t,e){var r;try{(r=globalThis.localStorage)==null||r.setItem(t,String(!!e))}catch{}}const JT="compose:sidebarOpen",t_="compose:contextPanelOpen";function MX(){return ZT(JT,!0)}function IX(t){return QT(JT,t)}function FX(){return ZT(t_,!1)}function z0(t){return QT(t_,t)}const Yd=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Yd.displayName="Card";const Xd=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("flex flex-col space-y-1.5 p-6",t),...e}));Xd.displayName="CardHeader";const Kd=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("font-semibold leading-none tracking-tight",t),...e}));Kd.displayName="CardTitle";const PX=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("text-sm text-muted-foreground",t),...e}));PX.displayName="CardDescription";const Zd=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("p-6 pt-0",t),...e}));Zd.displayName="CardContent";const DX=C.forwardRef(({className:t,...e},r)=>h.jsx("div",{ref:r,className:rt("flex items-center p-6 pt-0",t),...e}));DX.displayName="CardFooter";function OX(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 W0({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:rt("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:rt("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:OX(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:rt(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 q0(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const RX=(t,e)=>Math.abs(t-e)<1.01,$X=(t,e,r)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),r)}},H0=t=>{const{offsetWidth:e,offsetHeight:r}=t;return{width:e,height:r}},zX=t=>t,WX=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},qX=(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(H0(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(H0(r))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(r,{box:"border-box"}),()=>{s.unobserve(r)}},U0={passive:!0},G0=typeof window>"u"?!0:"onscrollend"in window,HX=(t,e)=>{const r=t.scrollElement;if(!r)return;const n=t.targetWindow;if(!n)return;let i=0;const s=t.options.useScrollendEvent&&G0?()=>{}:$X(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,U0);const c=t.options.useScrollendEvent&&G0;return c&&r.addEventListener("scrollend",l,U0),()=>{r.removeEventListener("scroll",a),c&&r.removeEventListener("scrollend",l)}},UX=(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"]},GX=(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 VX{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:zX,rangeExtractor:WX,onChange:()=>{},measureElement:UX,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],E=w!==void 0?d[w]:void 0;y=E?E.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),T=typeof k=="number"?k:this.options.estimateSize(f),_=y+T;d[f]={index:f,start:y,size:T,end:_,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?YX({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 q0(n[e_(0,n.length-1,i=>q0(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&&RX(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 e_=(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 YX({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=e_(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 V0=typeof document<"u"?C.useLayoutEffect:C.useEffect;function XX({useFlushSync:t=!0,...e}){const r=C.useReducer(()=>({}),{})[1],n={...e,onChange:(s,o)=>{var a;t&&o?Mf.flushSync(r):r(),(a=e.onChange)==null||a.call(e,s,o)}},[i]=C.useState(()=>new VX(n));return i.setOptions(n),V0(()=>i._didMount(),[]),V0(()=>i._willUpdate()),i}function KX(t){return XX({observeElementRect:qX,observeElementOffset:HX,scrollToFn:GX,...t})}function ZX(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?`${_e[u.fromPhase]??u.fromPhase} → ${_e[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 QX={phase:"→",gate:"◈",session:"●",iteration:"↻",error:"⚠"};function JX(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 tK({event:t,onSelectItem:e,style:r}){const n=QX[t.category]||"●",i=w_[t.category]||"text-zinc-400",s=v_[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:rt("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:rt("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:JX(t.timestamp)})]})}const eK=["all","phase","gate","session","iteration","error"],Y0={all:"All",phase:"Phase",gate:"Gate",session:"Session",iteration:"Iteration",error:"Error"};function rK({featureCode:t,itemId:e,onSelectItem:r}){const[n,i]=C.useState("all"),[s,o]=C.useState([]),a=C.useRef(null),l=mr(m=>m.gates),c=mr(m=>m.featureTimeline),u=mr(m=>m.setFeatureTimeline);C.useEffect(()=>{if(!t)return;let m=!1;return zt(`/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=ZX(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,T=(y=b.meta)==null?void 0:y.featureCode;(!k&&!T||k===e||T===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=KX({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:eK.map(m=>h.jsxs("button",{className:rt("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:[Y0[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 "${Y0[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(tK,{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 Vo=["explore_design","prd","architecture","blueprint","plan","execute","report"];function nK(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 iK({currentPhase:t}){const e=Vo.indexOf(t);return h.jsx("div",{className:"space-y-1.5",children:Vo.map((r,n)=>{const i=e>n,s=e===n,o=_e[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(kb,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0",style:{animation:"phase-check-pop 400ms ease-out"}}):s?h.jsx(yb,{className:"w-3.5 h-3.5 text-blue-400 shrink-0",style:{animation:"phase-active-pulse 2s ease-in-out infinite"}}):h.jsx(XA,{className:"w-3.5 h-3.5 text-muted-foreground/40 shrink-0"}),h.jsx("span",{className:rt("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 sK({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(W0,{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(W0,{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(Li,{className:rt("w-3 h-3",a.done?"text-emerald-400":"text-muted-foreground/40")}),h.jsx("span",{className:rt("text-[11px] font-mono",a.done?"text-foreground":"text-muted-foreground/50"),children:a.name})]},a.name))})]})]})}function oK({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]??_e[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(zp,{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(Wt,{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(Wt,{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(Wt,{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 aK({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:rt("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($M,{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(rr,{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:nK(a)}),h.jsx("span",{className:rt("w-1.5 h-1.5 rounded-full shrink-0",i.status==="active"?"bg-emerald-400":"bg-slate-600")})]},i.id)})})}function lK({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 T;const p=C.useMemo(()=>t.find(_=>{var w;return _.featureCode===s||((w=_.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(_=>{const w=!_;try{localStorage.setItem("compose:timeline-open",String(w))}catch{}return w})},[]),g=((T=p==null?void 0:p.lifecycle)==null?void 0:T.currentPhase)||(p==null?void 0:p.phase)||(n==null?void 0:n.currentStepId)||(n==null?void 0:n.currentStep)||null,y=Vo.indexOf(g),b=g?Math.max(0,(y+1)/Vo.length):0,k=C.useMemo(()=>{let _=e.filter(w=>w.status==="pending"||!w.resolvedAt);if(s){const w=new Set(t.filter(E=>{var B;return E.featureCode===s||((B=E.lifecycle)==null?void 0:B.featureCode)===s}).map(E=>E.id));_=_.filter(E=>w.has(E.itemId))}return _},[e,t,s]);if(!s){const _=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."}),_.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:_.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(kb,{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(rr,{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(rr,{variant:"outline",className:"text-[9px] px-1.5 py-0 h-4 font-mono shrink-0",children:s}),g&&h.jsx(rr,{variant:"secondary",className:"text-[9px] px-1.5 py-0 h-4 shrink-0",children:_e[g]??g}),h.jsxs("button",{className:rt("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(gM,{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 ${Vo.length} phases`:"Phase unknown"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs(Yd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out"},children:[h.jsx(Xd,{className:"p-3 pb-2",children:h.jsx(Kd,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Phase Timeline"})}),h.jsx(Zd,{className:"p-3 pt-0",children:h.jsx(iK,{currentPhase:g})})]}),h.jsxs(Yd,{className:"bg-card border-border",style:{animation:"phase-card-enter 400ms ease-out 100ms both"},children:[h.jsx(Xd,{className:"p-3 pb-2",children:h.jsx(Kd,{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-semibold",children:"Agents & Artifacts"})}),h.jsx(Zd,{className:"p-3 pt-0",children:h.jsx(sK,{spawnedAgents:i,activeBuild:n,sessionState:o,agentActivity:a})})]})]}),l&&l.size>0&&h.jsx("div",{className:"space-y-2",children:[...l.values()].map(_=>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:[_.status==="running"?"↻":_.outcome==="clean"?"✓":"✗"," ",_.loopType==="review"?"Review Loop":"Coverage Sweep"]}),h.jsxs("span",{className:"text-[11px] text-blue-300 font-mono",children:[_.count," of ",_.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(_.count/_.maxIterations*100)}%`,transition:"width 600ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:_.outcome==="clean"?"#22c55e":_.outcome==="max_reached"?"#ef4444":"#3b82f6"}})}),h.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:_.status==="running"?_.loopType==="review"?"Waiting for clean review...":"Waiting for tests passing...":_.outcome==="clean"?"Clean!":_.outcome==="max_reached"?"Max iterations reached":"Aborted"})]},_.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(oK,{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(aK,{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(rK,{featureCode:s,itemId:p==null?void 0:p.id,onSelectItem:c})]})]})}function cK(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 hK(t,e){return e.filter(r=>r.id!==t.id).map(r=>({idea:r,score:cK(t,r)})).filter(({score:r})=>r>.25).sort((r,n)=>n.score-r.score).slice(0,3).map(({idea:r})=>r)}function uK({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(Wt,{size:"sm",onClick:e,className:"mt-2",children:"Done"})]})}function dK({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),T=o[l]??null;o.length-l;const _=C.useMemo(()=>T?hK(T,s.filter(M=>M.id!==T.id)):[],[T,s]),w=C.useCallback(()=>{const M=l+1;M>=o.length?f(!0):(c(M),y(!1),x(""))},[l,o.length]),E=C.useCallback(async M=>{if(!(!T||b)){k(!0);try{await r(T.id,M),d($=>[...$,{id:T.id,action:"priority",priority:M}]),w()}finally{k(!1)}}},[T,b,r,w]),B=C.useCallback(async()=>{if(!(!T||b)){k(!0);try{await n(T.id,m),d(M=>[...M,{id:T.id,action:"kill"}]),y(!1),x(""),w()}finally{k(!1)}}},[T,b,n,m,w]),F=C.useCallback(()=>{T&&(d(M=>[...M,{id:T.id,action:"skip"}]),w())},[T,w]),N=C.useCallback(async()=>{if(!(!T||b)){k(!0);try{await i(T.id),d(M=>[...M,{id:T.id,action:"promote"}]),w()}finally{k(!1)}}},[T,b,i,w]);return C.useEffect(()=>{const M=$=>{if($.key==="Escape"){e();return}g||($.key==="0"&&E("P0"),$.key==="1"&&E("P1"),$.key==="2"&&E("P2"),($.key==="s"||$.key==="ArrowRight")&&F(),$.key==="k"&&y(!0))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[g,E,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(uK,{results:u,onClose:e}):T?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(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:T.id}),T.cluster&&h.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:T.cluster})]}),h.jsx("h3",{className:"text-[14px] text-foreground font-semibold leading-snug mb-2",children:T.title}),T.description&&h.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed mb-2",children:T.description}),h.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:(T.tags||[]).map(M=>h.jsx("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:M},M))}),T.source&&h.jsxs("p",{className:"text-[10px] text-muted-foreground/50 mt-2",children:["Source: ",T.source]})]}),_.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:_.map(M=>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(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono opacity-70",children:M.id}),h.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:M.title})]},M.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:M=>x(M.target.value),onKeyDown:M=>{M.key==="Enter"&&B(),M.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(Wt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[11px]",onClick:()=>{y(!1),x("")},children:"Cancel"}),h.jsx(Wt,{size:"sm",className:"flex-1 h-7 text-[11px] bg-destructive/80 hover:bg-destructive text-destructive-foreground",onClick:B,disabled:b,children:"Confirm Kill"})]})]})]}):h.jsx("p",{className:"text-[12px] text-muted-foreground text-center py-8",children:"No more untriaged ideas."})}),!p&&T&&!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(Wt,{size:"sm",className:"h-9 text-[12px] bg-red-500/80 hover:bg-red-500 text-white border-0",onClick:()=>E("P0"),disabled:b,title:"Press 0",children:["P0 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"0"})]}),h.jsxs(Wt,{size:"sm",className:"h-9 text-[12px] bg-amber-500/80 hover:bg-amber-500 text-white border-0",onClick:()=>E("P1"),disabled:b,title:"Press 1",children:["P1 ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"1"})]}),h.jsxs(Wt,{size:"sm",className:"h-9 text-[12px] bg-blue-500/80 hover:bg-blue-500 text-white border-0",onClick:()=>E("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(Wt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-emerald-400 border-emerald-400/30 hover:bg-emerald-400/10",onClick:N,disabled:b,children:"Promote"}),h.jsxs(Wt,{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(Wt,{size:"sm",variant:"outline",className:"h-7 text-[11px] text-muted-foreground gap-1",onClick:F,title:"Press s or →",children:[h.jsx(Nb,{className:"w-3 h-3"}),"Skip ",h.jsx("kbd",{className:"ml-1 text-[9px] opacity-60 font-mono",children:"s"})]})]})]})]})})}function X0(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 fK(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 pK({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:rt("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(ma,{className:"w-3 h-3"}):t})})}function mK({idea:t,onClose:e}){var _;const{promoteIdea:r}=As(),[n,i]=C.useState(1),[s,o]=C.useState(()=>X0(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(fK(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)}}},T=["Feature ID","Preview","Confirm"];return h.jsx(Up,{open:!0,onOpenChange:w=>!w&&e(),children:h.jsxs(hh,{className:"max-w-lg",children:[h.jsx(uh,{children:h.jsxs(dh,{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,E)=>h.jsxs(Xt.Fragment,{children:[h.jsx(pK,{step:w,current:n}),h.jsx("span",{className:rt("text-[10px] transition-colors",n===w?"text-foreground font-medium":"text-muted-foreground/60"),children:T[E]}),E<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(rr,{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:rt("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:[X0(t),`COMP-${(((_=t.tags)==null?void 0:_[0])||"FEAT").replace("#","").toUpperCase()}-1`].filter((w,E,B)=>B.indexOf(w)===E).map(w=>h.jsx("button",{onClick:()=>{o(w),l("")},className:rt("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(ma,{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(Wt,{size:"sm",onClick:e,className:"mt-1",children:"Close"})]})]}),n<4&&h.jsxs(Gp,{children:[n>1&&h.jsxs(Wt,{variant:"ghost",size:"sm",onClick:b,disabled:d,children:[h.jsx(bb,{className:"w-3 h-3 mr-1"}),"Back"]}),h.jsx(Wt,{variant:"ghost",size:"sm",onClick:e,disabled:d,children:"Cancel"}),n<3?h.jsxs(Wt,{size:"sm",onClick:y,children:["Next",h.jsx(js,{className:"w-3 h-3 ml-1"})]}):h.jsx(Wt,{size:"sm",onClick:k,disabled:d,children:d?"Promoting…":"Promote"})]})]})})}const Qd=["S","M","L"],gK=["high","medium","low"],xK={"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"},K0={"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"},Z0=["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 yK({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:Qd.map(a=>h.jsx("button",{onClick:()=>i(a),className:rt("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:rt("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 bK({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]=Z0[f%Z0.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:Qd.map(u=>h.jsx("div",{className:"flex-1 text-center text-[10px] text-muted-foreground font-medium uppercase tracking-wider",children:u},u))}),gK.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})}),Qd.map(d=>{const p=`${u}-${d}`,f=xK[p],m=a.filter(x=>x.impact===u&&x.effort===d);return h.jsxs("div",{className:rt("flex-1 min-h-[90px] rounded border p-1.5 mr-1 relative transition-colors",K0[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:rt("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(K0).map(([u,d])=>h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:rt("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:rt("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(yK,{idea:u,onSubmit:c,onCancel:()=>s(null)})})]},u.id))})]})]})}function ju({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:rt("h-full rounded-full transition-all",r),style:{width:`${n}%`}})})}function CK({ideas:t,killed:e}){const[r,n]=C.useState(!1),i=C.useMemo(()=>{var b,k,T,_;const s=[...t,...e||[]],o={};for(const w of s){const E=((b=w.source)==null?void 0:b.trim())||"(no source)",B=E.length>30?E.slice(0,30)+"…":E;o[B]=(o[B]||0)+1}const a=Object.entries(o).sort((w,E)=>E[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 E;return(E=w.status)==null?void 0:E.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 E=w.cluster||"(unclustered)";x[E]||(x[E]={total:0,promoted:0}),x[E].total+=1,(T=w.status)!=null&&T.startsWith("PROMOTED")&&(x[E].promoted+=1)}const g=Object.entries(x).sort((w,E)=>E[1].total-w[1].total).slice(0,5),y=((_=g[0])==null?void 0:_[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(ga,{className:"w-3 h-3"}):h.jsx(js,{className:"w-3 h-3"}),h.jsx(DA,{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(ju,{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(ju,{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(ju,{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 kK=[{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 Q0(t){return t==="P0"?0:t==="P1"?1:t==="P2"?2:3}function r_({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:rt("inline-block w-2 h-2 rounded-full shrink-0",e),title:t})}function vK({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:rt("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 wK({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:rt("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(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono shrink-0",children:t.id}),h.jsx(r_,{status:t.status}),h.jsx("div",{className:"flex-1"}),h.jsx(vK,{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 SK({idea:t,onClose:e,onPromote:r,onKill:n,onSetPriority:i,onAddDiscussion:s}){var y,b,k,T;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 _=p.trim();if(_){x(!0);try{await s(t.id,"human",_),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(rr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono",children:t.id}),h.jsx(r_,{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(_=>h.jsx("span",{className:"text-[10px] bg-muted/50 px-1.5 py-0.5 rounded font-mono text-muted-foreground",children:_},_))})]}),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(Pc,{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((_,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:rt("text-[9px] font-mono font-semibold",_.author==="agent"?"text-blue-400":"text-emerald-400"),children:_.author}),h.jsx("span",{className:"text-[9px] text-muted-foreground/50",children:_.date})]}),h.jsx("p",{className:"text-[10px] text-muted-foreground leading-relaxed",children:_.text})]},w))}),h.jsxs("div",{className:"flex gap-1.5 items-end",children:[h.jsx("input",{type:"text",placeholder:"Add comment…",value:p,onChange:_=>f(_.target.value),onKeyDown:_=>_.key==="Enter"&&!_.shiftKey&&g(),className:"flex-1 text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring",disabled:m}),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(Nf,{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(_=>h.jsx("button",{onClick:()=>i(t.id,_),className:rt("flex-1 text-[10px] px-1.5 py-1 rounded border transition-colors",t.priority===_?_==="P0"?"bg-red-400/20 text-red-400 border-red-400/50":_==="P1"?"bg-amber-400/20 text-amber-400 border-amber-400/50":_==="P2"?"bg-blue-400/20 text-blue-400 border-blue-400/50":"bg-muted text-muted-foreground border-border":"border-border/40 text-muted-foreground hover:border-border"),children:_==="—"?"none":_},_))})]})]}),!((T=t.status)!=null&&T.startsWith("PROMOTED"))&&t.status!=="KILLED"&&h.jsxs("div",{className:"p-3 border-t border-border space-y-2",children:[h.jsx(Wt,{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:_=>a(_.target.value),className:"w-full text-[11px] bg-muted text-foreground px-2 py-1.5 rounded border border-border outline-none focus:border-ring"}),h.jsxs("div",{className:"flex gap-1.5",children:[h.jsx(Wt,{size:"sm",variant:"outline",className:"flex-1 h-7 text-[10px]",onClick:()=>{c(!1),a("")},children:"Cancel"}),h.jsx(Wt,{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(Wt,{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 TK({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(ga,{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(rr,{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 _K(){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),[T,_]=C.useState(null),[w,E]=C.useState("cards"),B=C.useMemo(()=>{var K;const D=t.filter(P=>P.status==="NEW").length,R=t.filter(P=>!P.priority||P.priority==="—").length,j=t.filter(P=>P.priority==="P0").length,S={};t.filter(P=>P.priority==="P0"&&P.cluster).forEach(P=>{S[P.cluster]=(S[P.cluster]||0)+1});const W=((K=Object.entries(S).sort((P,st)=>st[1]-P[1])[0])==null?void 0:K[0])??null;return{newCount:D,untriaged:R,p0Count:j,topCluster:W}},[t]),F=C.useMemo(()=>{const D=new Set;return t.forEach(R=>(R.tags||[]).forEach(j=>D.add(j))),[...D].sort()},[t]),N=C.useMemo(()=>t.filter(D=>{var R;if(s.tag&&!((R=D.tags)!=null&&R.includes(s.tag))||s.status&&(D.status||"").split(/\s+/)[0]!==s.status||s.priority&&D.priority!==s.priority)return!1;if(s.search){const j=s.search.toLowerCase();if(!`${D.title} ${D.description} ${D.id} ${(D.tags||[]).join(" ")}`.toLowerCase().includes(j))return!1}return!0}),[t,s]),M=C.useMemo(()=>{const D=new Map,R=[];N.forEach(W=>{W.cluster?(D.has(W.cluster)||D.set(W.cluster,[]),D.get(W.cluster).push(W)):R.push(W)});const j=W=>[...W].sort((K,P)=>Q0(K.priority)-Q0(P.priority)),S=[];for(const[W,K]of D)S.push({cluster:W,ideas:j(K)});return R.length>0&&S.push({cluster:null,ideas:j(R)}),S},[N]),$=C.useMemo(()=>t.find(D=>D.id===i)||e.find(D=>D.id===i)||null,[t,e,i]),U=C.useCallback((D,R)=>{k(R),D.dataTransfer.effectAllowed="move"},[]),O=C.useCallback(()=>{k(null),_(null)},[]),I=C.useCallback((D,R)=>{D.preventDefault(),D.dataTransfer.dropEffect="move",_(R)},[]),A=C.useCallback(async(D,R)=>{D.preventDefault(),b&&await a(b,R),k(null),_(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($l,{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:()=>E("cards"),className:rt("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:()=>E("matrix"),className:rt("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($l,{className:"w-3 h-3"})}),h.jsxs(Wt,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1",onClick:()=>x(!0),disabled:B.untriaged===0,children:["Triage (",B.untriaged,")"]})]}),h.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[B.newCount>0&&h.jsxs("span",{className:"text-emerald-400",children:[B.newCount," new"]}),h.jsxs("span",{children:[B.untriaged," untriaged"]}),B.p0Count>0&&h.jsxs("span",{className:"text-red-400",children:[B.p0Count," P0"]}),B.topCluster&&h.jsxs("span",{children:["top cluster: ",h.jsx("span",{className:"text-foreground",children:B.topCluster})]}),h.jsxs("span",{className:"text-muted-foreground/40",children:[t.length," total"]})]}),h.jsx(CK,{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(iM,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsxs("select",{value:s.tag,onChange:D=>d({tag:D.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(D=>h.jsx("option",{value:D,children:D},D))]}),h.jsxs("select",{value:s.status,onChange:D=>d({status:D.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:D=>d({priority:D.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(Qn,{className:"w-3 h-3 text-muted-foreground/60 shrink-0"}),h.jsx("input",{type:"text",placeholder:"Search…",value:s.search,onChange:D=>d({search:D.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(bK,{ideas:N,selectedIdeaId:i,onSelectIdea:u,onUpdateIdea:f}),w==="cards"&&N.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"&&M.map(({cluster:D,ideas:R})=>h.jsxs("div",{className:"mb-6",children:[D&&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:D}),h.jsxs("span",{className:"text-muted-foreground/40 normal-case tracking-normal font-normal",children:["(",R.length,")"]})]}),h.jsx("div",{className:"grid grid-cols-4 gap-3",children:kK.map(j=>{const S=R.filter(K=>K.priority===j.key),W=T===j.key&&b;return h.jsxs("div",{className:rt("rounded-lg border p-2 min-h-[80px] transition-colors",j.bg,j.border,W&&"ring-1 ring-accent"),onDragOver:K=>I(K,j.key),onDrop:K=>A(K,j.key),children:[h.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[h.jsx("span",{className:rt("text-[10px] font-semibold uppercase tracking-wider",j.color),children:j.label}),h.jsxs("span",{className:"text-[9px] text-muted-foreground/50",children:["(",S.length,")"]})]}),h.jsxs("div",{className:"space-y-1.5",children:[S.map(K=>h.jsx(wK,{idea:K,selected:i===K.id,onClick:u,onDragStart:U,onDragEnd:O},K.id)),S.length===0&&h.jsx("p",{className:"text-[10px] text-muted-foreground/30 text-center py-2",children:"Drop here"})]})]},j.key)})})]},D||"__unclustered__")),w==="cards"&&h.jsx(TK,{killed:e,onResurrect:c})]})]}),$&&h.jsx(SK,{idea:$,onClose:()=>u(null),onPromote:D=>y(D),onKill:l,onSetPriority:a,onAddDiscussion:p}),m&&h.jsx(dK,{ideas:t.filter(D=>!D.priority||D.priority==="—"),onClose:()=>x(!1)}),g&&h.jsx(mK,{idea:g,onClose:()=>y(null)})]})}const EK=["A","B","C","D","E","F","G","H"];function NK({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)?EK[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(ma,{style:{width:14,height:14}}):h.jsx(PM,{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 jK(){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}=qn(),[x,g]=C.useState(""),[y,b]=C.useState(null),[k,T]=C.useState(""),_=C.useRef(null);C.useEffect(()=>(qn.setState({scope:null,featureCode:null}),a(),()=>f()),[]),C.useEffect(()=>{var M;(M=_.current)==null||M.scrollIntoView({behavior:"smooth"})},[e,s]);const w=C.useCallback(()=>{x.trim()&&(c(x.trim()),g(""))},[x,c]),E=C.useCallback((M,$)=>{b({messageIndex:$,cardId:M})},[]),B=C.useCallback(()=>{y&&(u(y.cardId,k||null,y.messageIndex),b(null),T(""))},[y,k,u]),F=n==="streaming"||n==="summarizing",N=e.reduce((M,$,U)=>$.role==="assistant"&&$.content&&XT($.content).parts.some(O=>O.type==="decision")?U:M,-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(Ym,{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((M,$)=>h.jsx(J0,{messageIndex:$,message:M,onCardSelect:E,selectedCard:y,isStreaming:F,cardsDisabled:F||$!==N},$)),s&&h.jsx(J0,{message:s,onCardSelect:E,selectedCard:y,isStreaming:F}),h.jsx("div",{ref:_})]}),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:M=>T(M.target.value),onKeyDown:M=>M.key==="Enter"&&B(),placeholder:"Add a comment (optional)...",className:"flex-1 bg-muted border border-border rounded px-3 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent"}),h.jsx("button",{onClick:B,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),T("")},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:M=>g(M.target.value),onKeyDown:M=>M.key==="Enter"&&!M.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(Nf,{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(Ym,{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(Pc,{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 M=prompt("Feature code:");M&&l("feature",M)},className:"px-4 py-2 text-[11px] font-medium rounded border border-border text-foreground hover:bg-muted transition-colors",children:"Feature Design"})]})]})}function J0({message:t,messageIndex:e,onCardSelect:r,selectedCard:n,isStreaming:i,cardsDisabled:s}){var l,c;const o=t.role==="human",a=!o&&t.content?XT(t.content):null;return h.jsx("div",{className:rt("flex",o?"justify-end":"justify-start"),children:h.jsx("div",{className:rt("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(NK,{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 LK=new Set(["Read","Grep","Glob","read_file","search_files","list_directory"]),BK=new Set(["WebSearch","web_search"]);function AK({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 MK(){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 IK(){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 Lu({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(AK,{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 pl(t,e=80){return t?t.length>e?t.slice(0,e)+"…":t:""}function ty(t,e){return e?typeof e=="string"?e:e.path||e.pattern||e.query||e.file_path||JSON.stringify(e).slice(0,60):""}function FK({researchItems:t=[],topicOutline:e=[]}){const r=t.filter(o=>LK.has(o.tool)),n=t.filter(o=>BK.has(o.tool)),i=[...r].reverse(),s=[...n].reverse();return h.jsx(Un,{className:"flex-1",children:h.jsxs("div",{children:[h.jsx(Lu,{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(MK,{}):h.jsx(IK,{})}),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(Lu,{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:pl(ty(o.tool,o.input),50)})]}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:pl(o.summary,100)})]},a))})}),h.jsx(Lu,{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:pl(ty(o.tool,o.input),80)}),o.summary&&h.jsx("p",{className:"text-[10px] leading-snug mt-1",style:{color:"hsl(var(--muted-foreground))"},children:pl(o.summary,100)})]},a))})})]})})}function PK({decisions:t=[],onReviseDecision:e,sessionComplete:r=!1,widthPx:n}){const[i,s]=C.useState("decisions"),o=t.filter(c=>!c.superseded).length,a=qn(c=>c.researchItems)||[],l=qn(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(Un,{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(FK,{researchItems:a,topicOutline:l})]})}function DK(t){return[...t].sort((e,r)=>Date.parse(e.created_at)-Date.parse(r.created_at))}function OK(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 RK(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 $K=320,zK=40,WK={deferred:"Deferred",blocked:"Blocked",open_question:"Question"};function n_(t){return t?`compose:${t}:openLoopsCollapsed`:null}function ey(t){const e=n_(t);if(!e)return!1;try{return localStorage.getItem(e)==="true"}catch{return!1}}function qK(t,e){const r=n_(t);if(r)try{localStorage.setItem(r,e?"true":"false")}catch{}}function HK({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 UK({loop:t,onResolve:e,nowMs:r}){const n=RK(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:WK[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:OK(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 GK({featureCode:t,items:e=[],onAddLoop:r,onResolveLoop:n}){var g,y;const[i,s]=C.useState(()=>ey(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(ey(t))},[t]);const u=C.useCallback(()=>{s(b=>{const k=!b;return qK(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(()=>DK(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(T){console.error("[OpenLoopsPanel] resolveLoop failed:",T.message)}}},[t,n]);return t?i?h.jsxs("div",{"data-testid":"open-loops-panel-collapsed",style:{width:zK,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:$K,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(UK,{loop:b,onResolve:x,nowMs:l},b.id))})]}),o&&h.jsx(HK,{onConfirm:m,onCancel:()=>a(!1)})]}):null}const Qi={building:"building",gate_pending:"gate_pending",blocked_downstream:"blocked_downstream",error:"error"},VK=new Set(["blocks","informs"]);function ry(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 YK(t){return t.featureCode?t.featureCode:t.title&&t.title.includes(":")?t.title.split(":")[0].trim():t.title||t.id}function XK(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=ry(e,s);c&&u&&n.some(p=>p.itemId===u.id&&!p.resolvedAt)?i[s]=Qi.gate_pending:i[s]=Qi.building}const l=ry(e,s);if(l&&(i[s]===Qi.building||i[s]===Qi.gate_pending)){const c=new Set([l.id]),u=KK(c,r),d=new Map(e.map(p=>[p.id,YK(p)]));for(const p of u){const f=d.get(p);f&&!i[f]&&(i[f]=Qi.blocked_downstream)}}return i}function KK(t,e){if(!t.size||!e.length)return new Set;const r=new Map;for(const o of e)VK.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 ZK(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=S_[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 Cr extends Xt.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 QK extends Xt.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(dy,{})})]}):this.props.children}}const Jd="compose:fontSize",JK="compose:theme",Yo=13,tf=10,ef=20;function tZ(){try{const t=parseInt(localStorage.getItem(Jd),10);return t>=tf&&t<=ef?t:Yo}catch{return Yo}}const ny=new URLSearchParams(window.location.search).get("popout");function eZ(){return ny?h.jsx(YV,{path:ny}):h.jsx(QK,{children:h.jsx(nZ,{})})}function rZ({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:T,onDocsBack:_,visibleTracks:w,hiddenGroups:E,onSelect:B,onUpdate:F,onCreate:N,onDelete:M,onOpenGate:$,onCreateConnection:U,onDeleteConnection:O,onRefreshBuild:I,onSelectStep:A,onResolveGate:D,onUpdateSettings:R,onResetSettings:j,projectRoot:S,featureCode:W,focusActive:K,onToggleFocus:P,sessionState:st,agentActivity:ct,iterationStates:Q}){switch(t){case"dashboard":return h.jsx(lK,{items:n,gates:i,sessions:a,activeBuild:l,spawnedAgents:g,featureCode:W,sessionState:st,agentActivity:ct,iterationStates:Q,onSelect:B,onResolveGate:D,onOpenGate:$});case"tree":return h.jsx(g1,{items:r,connections:o,selectedItemId:f,onSelect:B,onCreate:N,featureCode:W,focusActive:K,onToggleFocus:P});case"graph":return h.jsx(y1,{items:e,connections:s,selectedItemId:f,onSelect:B,visibleTracks:w,hiddenGroups:E,buildStateMap:m,resolveGate:D,gates:u,spawnedAgents:g,agentRelays:y,agentOverlay:x,featureCode:W,focusActive:K,onToggleFocus:P});case"pipeline":return h.jsx(ZS,{activeBuild:l,pipelineDraft:c,onSelectStep:A,onRefresh:I});case"sessions":return h.jsx(nT,{sessions:a,items:e,onSelectItem:B,featureCode:W,focusActive:K,onToggleFocus:P});case"gates":return h.jsx(VS,{gates:i,items:n,onResolve:D,onSelect:B,featureCode:W,focusActive:K,onToggleFocus:P});case"docs":return h.jsx(US,{items:n,selectedFile:b,onSelectedFileChange:k,previousView:T,onBack:_,featureCode:W,focusActive:K,onToggleFocus:P});case"design":return h.jsx(jK,{},S);case"ideabox":return h.jsx(_K,{});case"settings":return h.jsx(KS,{settings:d,onSettingsChange:R,onReset:j});case"stratum":return h.jsx(rY,{});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 nZ(){const{refresh:t}=m_(),e=qn(q=>q.decisions),r=qn(q=>q.status),[n,i]=C.useState(tZ),[s,o]=C.useState(()=>document.documentElement.classList.contains("dark")),[a]=C.useState(BX),[l,c]=C.useState(()=>AX(a)),[u,d]=C.useState(pY),[p,f]=C.useState(MX),[m,x]=C.useState(FX),[g,y]=C.useState(null),[b,k]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:contextWidthPx"),10)||420}catch{return 420}}),[T,_]=C.useState(()=>{try{return parseInt(localStorage.getItem("compose:sidebarWidthPx"),10)||220}catch{return 220}}),{items:w,connections:E,connected:B,uiCommand:F,clearUICommand:N,recentChanges:M,createItem:$,updateItem:U,deleteItem:O,createConnection:I,deleteConnection:A,agentActivity:D,agentErrors:R,spawnedAgents:j,agentRelays:S,sessionState:W,registerSnapshotProvider:K,gates:P,gateEvent:st,resolveGate:ct,settings:Q,updateSettings:kt,resetSettings:wt,activeBuild:lt,setActiveBuild:Z,pipelineDraft:at,sessions:vt,iterationStates:Mt,selectedPhase:Dt,setSelectedPhase:ce,statusSnapshots:oe,setStatusSnapshot:Pe}=mr(Mi(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}))),Zt=(W==null?void 0:W.featureCode)||null;C.useEffect(()=>{Zt&&(oe&&oe[Zt]||zt(`/api/lifecycle/status?featureCode=${encodeURIComponent(Zt)}`).then(q=>q.json()).then(q=>{q!=null&&q.snapshot&&Pe&&Pe(Zt,q.snapshot)}).catch(()=>{}))},[Zt,oe,Pe]);const[Be,V]=C.useState(null),nt=C.useRef(!!localStorage.getItem("compose:activeView")),[dt,jt]=C.useState(()=>localStorage.getItem("compose:activeView")||"dashboard"),[et,bt]=C.useState(""),G=C.useCallback(q=>{k(q),localStorage.setItem("compose:contextWidthPx",String(Math.round(q)))},[]),it=C.useRef(!1),St=C.useCallback(q=>{q.preventDefault(),it.current=!0;const Et=fe=>{if(!it.current)return;const lr=fe.clientX-16,so=Math.max(160,Math.min(window.innerWidth*.4,lr));_(so),localStorage.setItem("compose:sidebarWidthPx",String(Math.round(so)))},Tt=()=>{it.current=!1,document.removeEventListener("mousemove",Et),document.removeEventListener("mouseup",Tt)};document.addEventListener("mousemove",Et),document.addEventListener("mouseup",Tt)},[]),[Ot,$t]=C.useState(null),[Te,or]=C.useState(null),[ue,_r]=C.useState(()=>localStorage.getItem("compose:selectedTrack")||null),[Oe,xe]=C.useState(()=>{try{const q=localStorage.getItem("compose:visibleTracks");if(q){const Et=JSON.parse(q);return new Set(Et)}}catch{}return null}),[ar,ye]=C.useState(new Set),[Nn,Ys]=C.useState(!1),Xs=C.useCallback(q=>{ye(Et=>{const Tt=new Set(Et);return Tt.has(q)?Tt.delete(q):Tt.add(q),Tt})},[]),[Na,Ks]=C.useState(null),[Zs,ri]=C.useState(!1),[ni,Qs]=C.useState(!1),[ph,be]=C.useState(!1),[jn,ja]=C.useState(""),[Js,Ii]=C.useState("");C.useEffect(()=>{zt("/api/project").then(q=>q.json()).then(q=>{ja(q.name||""),Ii(q.targetRoot||"")}).catch(()=>{})},[]);const La=C.useCallback(async q=>{try{const Tt=await(await zt("/api/project/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:q})})).json();return Tt.ok?(await t(),ja(Tt.name),Ii(Tt.targetRoot),!0):!1}catch{return!1}},[t]),to=u===Ge.MAXIMIZED,mh=C.useCallback(q=>{c(q),$0(q),jt(q)},[]),de=C.useCallback(q=>{jt(q),c(q),$0(q)},[]);C.useEffect(()=>{localStorage.setItem("compose:activeView",dt),dt!=="docs"&&(or(null),$t(null))},[dt]),C.useEffect(()=>{ue?localStorage.setItem("compose:selectedTrack",ue):localStorage.removeItem("compose:selectedTrack")},[ue]),C.useEffect(()=>{Be?sessionStorage.setItem("vision-selectedItemId",Be):sessionStorage.removeItem("vision-selectedItemId")},[Be]),C.useEffect(()=>{try{Oe?localStorage.setItem("compose:visibleTracks",JSON.stringify([...Oe])):localStorage.removeItem("compose:visibleTracks")}catch{}},[Oe]);const Xr=C.useRef(!1);C.useEffect(()=>{var q;Xr.current||nt.current||(q=Q==null?void 0:Q.ui)!=null&&q.defaultView&&(de(Q.ui.defaultView),Xr.current=!0)},[Q]),C.useEffect(()=>{F&&(F.view&&de(F.view),F.phase!==void 0&&ce(F.phase),F.select!==void 0&&Kr(F.select),N())},[F,N]),C.useEffect(()=>{const q=()=>{var Tt;return["INPUT","TEXTAREA","SELECT"].includes((Tt=document.activeElement)==null?void 0:Tt.tagName)},Et=Tt=>{(Tt.metaKey||Tt.ctrlKey)&&Tt.key==="k"&&(Tt.preventDefault(),ri(fe=>!fe)),(Tt.metaKey||Tt.ctrlKey)&&Tt.key==="n"&&(Tt.preventDefault(),Qs(!0)),Tt.key===","&&!Tt.metaKey&&!Tt.ctrlKey&&!q()&&be(!0)};return window.addEventListener("keydown",Et),()=>window.removeEventListener("keydown",Et)},[]);const Ln=C.useMemo(()=>{let q=w;if(Dt&&(q=q.filter(Et=>Et.phase===Dt)),ue&&(q=q.filter(Et=>{const Tt=(Et.description||"").match(/Track:\s*(\w+)/i);return Tt&&Tt[1].toLowerCase()===ue})),et){const Et=et.toLowerCase();q=q.filter(Tt=>Tt.title.toLowerCase().includes(Et)||(Tt.description||"").toLowerCase().includes(Et))}return q},[w,Dt,ue,et]),Fi=C.useMemo(()=>Dt?w.filter(q=>q.phase===Dt):w,[w,Dt]),eo=C.useMemo(()=>new Set(Fi.map(q=>q.id)),[Fi]),ro=C.useMemo(()=>Dt?P.filter(q=>eo.has(q.itemId)):P,[P,eo,Dt]),Pi=C.useMemo(()=>{if(!Dt&&!ue&&!et)return E;const q=new Set(Ln.map(Et=>Et.id));return E.filter(Et=>q.has(Et.fromId)&&q.has(Et.toId))},[E,Ln,Dt,ue,et]),Mr=C.useMemo(()=>XK(lt,w,E,P),[lt,w,E,P]),Ba=C.useMemo(()=>ZK(j,S),[j,S]),We=C.useCallback(q=>{y(q)},[]),Kr=C.useCallback(q=>{V(Et=>Et===q?(We(null),null):(We({type:"item",id:q}),q))},[We]),Aa=C.useCallback(async q=>{try{await zt(`/api/agent/${q}/stop`,{method:"POST",headers:Po({"Content-Type":"application/json"})})}catch(Et){console.error(`[App] Failed to stop agent ${q}:`,Et.message)}},[]),no=C.useRef(lt);C.useEffect(()=>{!no.current&&lt&&lt.featureItemId&&Kr(lt.featureItemId),no.current=lt},[lt]);const ii=C.useCallback(q=>{if(!q)return;const Et=w.find(Tt=>{var fe,lr;return((fe=Tt.lifecycle)==null?void 0:fe.featureCode)===q||Tt.featureCode===q||Tt.feature_code===q||((lr=Tt.title)==null?void 0:lr.includes(q))});Et&&Kr(Et.id)},[w,Kr]);C.useEffect(()=>{const q=Et=>{const{featureCode:Tt}=Et.detail||{};Tt&&ii(Tt)};return window.addEventListener("compose:select-feature",q),()=>window.removeEventListener("compose:select-feature",q)},[ii]);const fn=C.useCallback(q=>w.find(Et=>{var Tt;return((Tt=Et.lifecycle)==null?void 0:Tt.featureCode)===q})||null,[w]),_t=C.useCallback(async(q,Et)=>{const Tt=fn(q);if(!Tt)throw new Error(`No item found for feature ${q}`);const fe=await zt(`/api/vision/items/${Tt.id}/loops`,{method:"POST",headers:Po({"Content-Type":"application/json"}),body:JSON.stringify(Et)});if(!fe.ok)throw new Error(`Add loop failed: ${fe.status}`)},[fn]),z=C.useCallback(async(q,Et,{note:Tt})=>{const fe=fn(q);if(!fe)throw new Error(`No item found for feature ${q}`);const lr=await zt(`/api/vision/items/${fe.id}/loops/${Et}/resolve`,{method:"POST",headers:Po({"Content-Type":"application/json"}),body:JSON.stringify({note:Tt})});if(!lr.ok)throw new Error(`Resolve loop failed: ${lr.status}`)},[fn]);C.useEffect(()=>{K(()=>({activeView:dt,selectedPhase:Dt,searchQuery:et,selectedItemId:Be,totalItems:w.length,filteredCount:Ln.length,connected:B}))},[K,dt,Dt,et,Be,w.length,Ln.length,B]),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),z0(!0))},[g]),C.useEffect(()=>{dt==="design"?y({type:"design-doc"}):(g==null?void 0:g.type)==="design-doc"&&y(null)},[dt]);const tt=C.useCallback(()=>{const q=s?"light":"dark";document.documentElement.classList.toggle("dark",q==="dark"),localStorage.setItem(JK,q),zt("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ui:{theme:q}})}).catch(()=>{})},[s]),ut=C.useCallback(q=>{i(Et=>{const Tt=Math.min(Math.max(Et+q,tf),ef);return localStorage.setItem(Jd,Tt),Tt})},[]),Vt=C.useCallback(()=>{i(Yo),localStorage.setItem(Jd,Yo)},[]),Ce=C.useCallback(q=>{d(q),mY(q)},[]),ke=C.useCallback(()=>{f(q=>(IX(!q),!q))},[]),qe=C.useCallback(()=>{x(q=>(z0(!q),!q))},[]),Ir=C.useCallback((q,Et)=>{U(q,Et)},[U]),Fr=C.useCallback(async()=>{const Et=await $({type:"task",title:"New item",description:"",status:"planned",confidence:0,phase:Dt||"vision"});Et&&Et.id&&Kr(Et.id)},[$,Dt]),io=C.useCallback(async q=>{await O(q),Be===q&&(V(null),We(null))},[O,Be,We]),ve=C.useCallback(q=>{const Et=P.find(Tt=>Tt.id===q);Et&&(V(Et.itemId),We({type:"item",id:Et.itemId}))},[P,We]),Ma=C.useCallback(async q=>I(q),[I]),Ia=C.useCallback(async q=>A(q),[A]),i_=C.useCallback(()=>{zt("/api/build/state").then(q=>q.json()).then(q=>Z(q.state??null)).catch(()=>{})},[Z]),s_=C.useCallback(q=>{We({type:"step",id:q})},[We]),Fa=C.useCallback(q=>{const Et=w.find(lr=>lr.id===q);if(!Et)return;const Tt=(Et.description||"").match(/Track:\s*(\w+)/i),fe=Tt?Tt[1].toLowerCase():null;ue&&fe&&ue!==fe&&_r(null),fe&&Oe&&!Oe.has(fe)&&xe(lr=>{const so=new Set(lr);return so.add(fe),so})},[w,ue,Oe]),o_=C.useCallback(q=>{Fa(q),V(q),We({type:"item",id:q}),de("graph")},[de,We,Fa]),a_=C.useCallback(q=>{Fa(q),V(q),We({type:"item",id:q}),de("tree")},[de,We,Fa]),l_=C.useCallback(q=>{or(dt),$t(q),de("docs")},[dt,de]),c_=C.useCallback(()=>{Te&&(de(Te),or(null),$t(null))},[Te,de]);return h.jsx(Oc.Provider,{value:M,children:h.jsxs("div",{className:"h-screen w-screen flex flex-col bg-background overflow-hidden",style:{fontSize:`${n}px`},children:[h.jsx(Cr,{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.jsx(nY,{projectName:jn,projectRoot:Js,onSwitch:La}),h.jsx("div",{className:"flex-1 min-w-0 h-full flex items-center",children:h.jsx(sY,{tabs:a,activeTab:l,onTabChange:mh,onOpenPalette:()=>ri(q=>!q),badges:{gates:P.filter(q=>!q.resolvedAt).length}})}),h.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!B&&h.jsx("span",{className:"text-[9px] uppercase tracking-wider text-destructive animate-pulse",children:"disconnected"}),h.jsx("button",{className:"compose-btn-icon",onClick:tt,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:()=>ut(-1),disabled:n<=tf,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:()=>ut(1),disabled:n>=ef,title:"Increase font size",children:"A+"})]}),h.jsx("button",{className:"compose-btn-icon",onClick:Vt,disabled:n===Yo,title:"Reset to default size",children:"100%"})]})]})}),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(Cr,{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:ke,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:St}),p&&(dt==="design"?h.jsx(PK,{decisions:e,sessionComplete:r==="complete",onReviseDecision:q=>qn.getState().reviseDecision(q),widthPx:T}):h.jsx(p1,{items:w,gates:P,activeBuild:lt,onViewChange:de,selectedPhase:Dt,onPhaseSelect:ce,selectedTrack:ue,onTrackSelect:_r,visibleTracks:Oe,onToggleVisibleTrack:(q,Et)=>xe(Tt=>{if(!Tt){const lr=new Set(Et);return lr.delete(q),lr}const fe=new Set(Tt);return fe.has(q)?fe.delete(q):fe.add(q),Et&&fe.size>=Et.length?null:fe}),onShowAllTracks:()=>xe(null),hiddenGroups:ar,onToggleGroup:Xs,searchQuery:et,onSearchChange:bt,connected:B,agentActivity:D,agentErrors:R,spawnedAgents:j,agentRelays:S,sessionState:W,onSelectItem:Kr,onStopAgent:Aa,onThemeChange:kt,onNewItem:()=>Qs(!0),widthPx:T}))]})}),h.jsxs("main",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden",children:[h.jsx(HT,{featureCode:Zt,snapshot:Zt?(oe==null?void 0:oe[Zt])??null:null}),Zt&&h.jsx(qT,{currentFeatureCode:Zt}),h.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:h.jsx(Cr,{children:h.jsx(rZ,{activeView:dt,items:w,filteredItems:Ln,phaseFilteredItems:Fi,phaseFilteredGates:ro,connections:E,filteredConnections:Pi,sessions:vt,activeBuild:lt,pipelineDraft:at,gates:P,settings:Q,selectedPhase:Dt,selectedItemId:Be,onSelect:Kr,onUpdate:Ir,onCreate:Fr,onDelete:io,onOpenGate:ve,onCreateConnection:Ma,onDeleteConnection:Ia,onRefreshBuild:i_,onSelectStep:s_,onResolveGate:ct,onUpdateSettings:kt,onResetSettings:wt,visibleTracks:Oe,hiddenGroups:ar,buildStateMap:Mr,agentOverlay:Ba,spawnedAgents:j,agentRelays:S,docsSelectedFile:Ot,onDocsSelectedFileChange:$t,docsPreviousView:Te,onDocsBack:c_,projectRoot:Js,featureCode:Zt,focusActive:Nn,onToggleFocus:()=>Ys(q=>!q),sessionState:W,agentActivity:D,iterationStates:Mt})})})]}),dt!=="docs"&&h.jsx(Cr,{children:h.jsxs(vY,{isOpen:m,onToggle:qe,widthPx:b,onResizePx:G,activeBuild:lt,gates:P,agentErrors:R,items:w,children:[(g==null?void 0:g.type)==="item"&&h.jsx(lX,{itemId:g.id,onSelect:q=>{y({type:"item",id:q}),V(q)},onClose:()=>{y(null),V(null)},onOpenFile:l_,onViewInGraph:o_,onViewInTree:a_}),(g==null?void 0:g.type)==="step"&&h.jsx(xX,{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(bX,{})]})}),Zt&&dt!=="docs"&&h.jsx(Cr,{zone:"open loops panel",children:h.jsx(GK,{featureCode:Zt,items:w,onAddLoop:_t,onResolveLoop:z})})]}),h.jsx(Cr,{zone:"ops strip",children:h.jsx(EX,{activeView:dt,onSelectFeature:ii})}),h.jsx(Cr,{zone:"agent bar",children:h.jsx("div",{className:["shrink-0 flex flex-col overflow-hidden",to?"flex-1 min-h-0":fY(u)].join(" "),children:h.jsx(yY,{barState:u,onStateChange:Ce})})})]}),h.jsx(Cr,{zone:"notifications",children:h.jsx(kX,{})}),h.jsx(Cr,{zone:"gate notifications",children:h.jsx(WT,{onOpenGate:ve})}),h.jsx(Cr,{zone:"challenge modal",children:Na&&(()=>{const q=w.find(Et=>Et.id===Na);return q?h.jsx(XS,{item:q,items:w,connections:E,onUpdate:Ir,onClose:()=>Ks(null)}):null})()}),h.jsx(YS,{event:st,items:w,onNavigate:()=>de("gates")}),h.jsx(Cr,{zone:"command palette",children:h.jsx(iT,{open:Zs,onClose:()=>ri(!1),onSelectItem:q=>{Kr(q),ri(!1)},onSelectGate:q=>{ve(q),ri(!1)}})}),h.jsx(Cr,{zone:"item form",children:h.jsx($T,{open:ni,onClose:()=>Qs(!1)})}),h.jsx(Cr,{zone:"settings",children:h.jsx(zT,{open:ph,onClose:()=>be(!1),settings:Q,onSettingsChange:kt})})]})})}const DZ=Object.freeze(Object.defineProperty({__proto__:null,default:eZ},Symbol.toStringTag,{value:"Module"}));export{p6 as $,DZ as A,Z8 as B,sn as C,go as D,Fv as E,z1 as F,qi as G,Xf as H,mZ as I,U$ as J,_n as K,ld as L,X as M,o6 as N,e6 as O,bF as P,Ti as Q,pr as R,uZ as S,L1 as T,Rt as U,Yf as V,K$ as W,Qg as X,rC as Y,T6 as Z,CF as _,ka as a,RR as a$,m6 as a0,M6 as a1,rP as a2,tP as a3,ge as a4,ee as a5,iP as a6,wZ as a7,sr as a8,Ta as a9,Y as aA,LR as aB,ya as aC,G$ as aD,J as aE,r6 as aF,S9 as aG,gZ as aH,xZ as aI,sC as aJ,vv as aK,Tv as aL,Qc as aM,Mg as aN,Jf as aO,Yz as aP,AZ as aQ,Ms as aR,I6 as aS,J$ as aT,X8 as aU,IZ as aV,$1 as aW,JD as aX,zn as aY,Ur as aZ,Gt as a_,V$ as aa,FZ as ab,Bv as ac,vp as ad,fp as ae,u4 as af,$4 as ag,lZ as ah,Jg as ai,Qo as aj,dZ as ak,vz as al,Jz as am,Vz as an,D2 as ao,d6 as ap,f6 as aq,u6 as ar,On as as,Gg as at,oO as au,Gr as av,Pv as aw,dp as ax,Tl as ay,Wz as az,v as b,eP as b0,J4 as b1,hZ as b2,nP as b3,LZ as b4,n6 as b5,Y4 as b6,oP as b7,yZ as b8,bZ as b9,kv as ba,yt as bb,t6 as bc,CZ as bd,c6 as be,h6 as bf,a6 as bg,l6 as bh,Y8 as bi,Ct as bj,zr as bk,_R as bl,D6 as bm,fZ as c,kZ as d,k1 as e,Sv as f,ER as g,s6 as h,i6 as i,vZ as j,Ie as k,gt as l,pZ as m,wv as n,cZ as o,bp as p,Mv as q,wn as r,kp as s,Q4 as t,MZ as u,jZ as v,BZ as w,ea as x,W1 as y,ba as z};