@siteboon/claude-code-ui 1.12.0 → 1.13.0

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.
@@ -0,0 +1,1206 @@
1
+ import{j as n,S as ys,F as Di,T as Fu,P as Bu,E as Rr,V as zi,a as Hl,g as If,R as Df,D as Tn,b as hi,G as Wl,W as Ul,l as Ou,h as Zo,c as $u,C as zf,d as Lf,e as Ea,f as Pf,i as Rf,u as Ff,k as X0,s as Bf,m as Of,n as $f,o as _f,p as _u,q as qu,r as Hu,t as qf,v as Hf,w as Wf,x as Uf,y as Vf}from"./vendor-codemirror-CnTQH7Pk.js";import{b as Gf,g as vs,a as b,R as Kr,c as Kf,B as Jf,d as Yf,e as Q0,u as Xf,f as Qf}from"./vendor-react-DVSKlM5e.js";import{r as Zf,a as eg,b as tg}from"./vendor-xterm-DfaPXD3y.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&a(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function a(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var _s={},Z0;function rg(){if(Z0)return _s;Z0=1;var e=Gf();return _s.createRoot=e.createRoot,_s.hydrateRoot=e.hydrateRoot,_s}var ng=rg();const ag=vs(ng);/**
2
+ * @license lucide-react v0.515.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const sg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ig=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase()),ec=e=>{const t=ig(e);return t.charAt(0).toUpperCase()+t.slice(1)},Wu=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim(),og=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
7
+ * @license lucide-react v0.515.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */var lg={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"};/**
12
+ * @license lucide-react v0.515.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const cg=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:s="",children:i,iconNode:o,...l},c)=>b.createElement("svg",{ref:c,...lg,width:t,height:t,stroke:e,strokeWidth:a?Number(r)*24/Number(t):r,className:Wu("lucide",s),...!i&&!og(l)&&{"aria-hidden":"true"},...l},[...o.map(([d,u])=>b.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
17
+ * @license lucide-react v0.515.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Ie=(e,t)=>{const r=b.forwardRef(({className:a,...s},i)=>b.createElement(cg,{ref:i,iconNode:t,className:Wu(`lucide-${sg(ec(e))}`,`lucide-${e}`,a),...s}));return r.displayName=ec(e),r};/**
22
+ * @license lucide-react v0.515.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const dg=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Uu=Ie("arrow-down",dg);/**
27
+ * @license lucide-react v0.515.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const ug=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Vl=Ie("arrow-right",ug);/**
32
+ * @license lucide-react v0.515.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const mg=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],hg=Ie("arrow-up-down",mg);/**
37
+ * @license lucide-react v0.515.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const pg=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],fg=Ie("arrow-up",pg);/**
42
+ * @license lucide-react v0.515.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const gg=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],Vu=Ie("brain",gg);/**
47
+ * @license lucide-react v0.515.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const xg=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dr=Ie("check",xg);/**
52
+ * @license lucide-react v0.515.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const bg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pr=Ie("chevron-down",bg);/**
57
+ * @license lucide-react v0.515.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const yg=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Gl=Ie("chevron-left",yg);/**
62
+ * @license lucide-react v0.515.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const vg=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cn=Ie("chevron-right",vg);/**
67
+ * @license lucide-react v0.515.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const kg=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wg=Ie("chevron-up",kg);/**
72
+ * @license lucide-react v0.515.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const jg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Li=Ie("circle-alert",jg);/**
77
+ * @license lucide-react v0.515.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const Ng=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ks=Ie("circle-check-big",Ng);/**
82
+ * @license lucide-react v0.515.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const Sg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cg=Ie("circle-check",Sg);/**
87
+ * @license lucide-react v0.515.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const Mg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ag=Ie("circle-help",Mg);/**
92
+ * @license lucide-react v0.515.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const Tg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ca=Ie("circle",Tg);/**
97
+ * @license lucide-react v0.515.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const Eg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],cs=Ie("clock",Eg);/**
102
+ * @license lucide-react v0.515.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const Ig=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Dg=Ie("columns-2",Ig);/**
107
+ * @license lucide-react v0.515.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const zg=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Gu=Ie("copy",zg);/**
112
+ * @license lucide-react v0.515.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const Lg=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],pi=Ie("download",Lg);/**
117
+ * @license lucide-react v0.515.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const Pg=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],tc=Ie("external-link",Pg);/**
122
+ * @license lucide-react v0.515.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const Rg=[["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"}]],ws=Ie("eye",Rg);/**
127
+ * @license lucide-react v0.515.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const Fg=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Bg=Ie("eye-off",Fg);/**
132
+ * @license lucide-react v0.515.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const Og=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],$g=Ie("file-code",Og);/**
137
+ * @license lucide-react v0.515.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const _g=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],yr=Ie("file-text",_g);/**
142
+ * @license lucide-react v0.515.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const qg=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],rc=Ie("file",qg);/**
147
+ * @license lucide-react v0.515.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const Hg=[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]],Ku=Ie("flag",Hg);/**
152
+ * @license lucide-react v0.515.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const Wg=[["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"}]],ia=Ie("folder-open",Wg);/**
157
+ * @license lucide-react v0.515.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const Ug=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],fi=Ie("folder-plus",Ug);/**
162
+ * @license lucide-react v0.515.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const Vg=[["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"}]],On=Ie("folder",Vg);/**
167
+ * @license lucide-react v0.515.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const Gg=[["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"}]],Kg=Ie("funnel",Gg);/**
172
+ * @license lucide-react v0.515.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const Jg=[["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"}]],kn=Ie("git-branch",Jg);/**
177
+ * @license lucide-react v0.515.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const Yg=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],no=Ie("git-commit-horizontal",Yg);/**
182
+ * @license lucide-react v0.515.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const Xg=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Qg=Ie("github",Xg);/**
187
+ * @license lucide-react v0.515.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const Zg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],el=Ie("globe",Zg);/**
192
+ * @license lucide-react v0.515.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const ex=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],tx=Ie("grid-3x3",ex);/**
197
+ * @license lucide-react v0.515.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const rx=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],nc=Ie("history",rx);/**
202
+ * @license lucide-react v0.515.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const nx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ax=Ie("info",nx);/**
207
+ * @license lucide-react v0.515.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const sx=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Kl=Ie("key",sx);/**
212
+ * @license lucide-react v0.515.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const ix=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],ox=Ie("languages",ix);/**
217
+ * @license lucide-react v0.515.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const lx=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],gi=Ie("list",lx);/**
222
+ * @license lucide-react v0.515.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const cx=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ds=Ie("loader-circle",cx);/**
227
+ * @license lucide-react v0.515.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const dx=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Ju=Ie("log-in",dx);/**
232
+ * @license lucide-react v0.515.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const ux=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],mx=Ie("mail",ux);/**
237
+ * @license lucide-react v0.515.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const hx=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Jl=Ie("maximize-2",hx);/**
242
+ * @license lucide-react v0.515.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const px=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],us=Ie("message-square",px);/**
247
+ * @license lucide-react v0.515.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const fx=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],ci=Ie("mic",fx);/**
252
+ * @license lucide-react v0.515.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const gx=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Yu=Ie("minimize-2",gx);/**
257
+ * @license lucide-react v0.515.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const xx=[["path",{d:"M5 12h14",key:"1ays0h"}]],bx=Ie("minus",xx);/**
262
+ * @license lucide-react v0.515.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const yx=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],tl=Ie("moon",yx);/**
267
+ * @license lucide-react v0.515.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const vx=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],Xu=Ie("pause",vx);/**
272
+ * @license lucide-react v0.515.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */const kx=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],ms=Ie("pen-line",kx);/**
277
+ * @license lucide-react v0.515.0 - ISC
278
+ *
279
+ * This source code is licensed under the ISC license.
280
+ * See the LICENSE file in the root directory of this source tree.
281
+ */const wx=[["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"}]],jx=Ie("pen",wx);/**
282
+ * @license lucide-react v0.515.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */const Nx=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Sx=Ie("play",Nx);/**
287
+ * @license lucide-react v0.515.0 - ISC
288
+ *
289
+ * This source code is licensed under the ISC license.
290
+ * See the LICENSE file in the root directory of this source tree.
291
+ */const Cx=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ar=Ie("plus",Cx);/**
292
+ * @license lucide-react v0.515.0 - ISC
293
+ *
294
+ * This source code is licensed under the ISC license.
295
+ * See the LICENSE file in the root directory of this source tree.
296
+ */const Mx=[["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"}]],yn=Ie("refresh-cw",Mx);/**
297
+ * @license lucide-react v0.515.0 - ISC
298
+ *
299
+ * This source code is licensed under the ISC license.
300
+ * See the LICENSE file in the root directory of this source tree.
301
+ */const Ax=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],xi=Ie("save",Ax);/**
302
+ * @license lucide-react v0.515.0 - ISC
303
+ *
304
+ * This source code is licensed under the ISC license.
305
+ * See the LICENSE file in the root directory of this source tree.
306
+ */const Tx=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ia=Ie("search",Tx);/**
307
+ * @license lucide-react v0.515.0 - ISC
308
+ *
309
+ * This source code is licensed under the ISC license.
310
+ * See the LICENSE file in the root directory of this source tree.
311
+ */const Ex=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Pi=Ie("server",Ex);/**
312
+ * @license lucide-react v0.515.0 - ISC
313
+ *
314
+ * This source code is licensed under the ISC license.
315
+ * See the LICENSE file in the root directory of this source tree.
316
+ */const Ix=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],la=Ie("settings",Ix);/**
317
+ * @license lucide-react v0.515.0 - ISC
318
+ *
319
+ * This source code is licensed under the ISC license.
320
+ * See the LICENSE file in the root directory of this source tree.
321
+ */const Dx=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],zx=Ie("settings-2",Dx);/**
322
+ * @license lucide-react v0.515.0 - ISC
323
+ *
324
+ * This source code is licensed under the ISC license.
325
+ * See the LICENSE file in the root directory of this source tree.
326
+ */const Lx=[["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"}]],Yl=Ie("shield",Lx);/**
327
+ * @license lucide-react v0.515.0 - ISC
328
+ *
329
+ * This source code is licensed under the ISC license.
330
+ * See the LICENSE file in the root directory of this source tree.
331
+ */const Px=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],_n=Ie("sparkles",Px);/**
332
+ * @license lucide-react v0.515.0 - ISC
333
+ *
334
+ * This source code is licensed under the ISC license.
335
+ * See the LICENSE file in the root directory of this source tree.
336
+ */const Rx=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Fx=Ie("square-check-big",Rx);/**
337
+ * @license lucide-react v0.515.0 - ISC
338
+ *
339
+ * This source code is licensed under the ISC license.
340
+ * See the LICENSE file in the root directory of this source tree.
341
+ */const Bx=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ox=Ie("square-pen",Bx);/**
342
+ * @license lucide-react v0.515.0 - ISC
343
+ *
344
+ * This source code is licensed under the ISC license.
345
+ * See the LICENSE file in the root directory of this source tree.
346
+ */const $x=[["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"}]],ac=Ie("star",$x);/**
347
+ * @license lucide-react v0.515.0 - ISC
348
+ *
349
+ * This source code is licensed under the ISC license.
350
+ * See the LICENSE file in the root directory of this source tree.
351
+ */const _x=[["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"}]],rl=Ie("sun",_x);/**
352
+ * @license lucide-react v0.515.0 - ISC
353
+ *
354
+ * This source code is licensed under the ISC license.
355
+ * See the LICENSE file in the root directory of this source tree.
356
+ */const qx=[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],Hx=Ie("table-properties",qx);/**
357
+ * @license lucide-react v0.515.0 - ISC
358
+ *
359
+ * This source code is licensed under the ISC license.
360
+ * See the LICENSE file in the root directory of this source tree.
361
+ */const Wx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ux=Ie("target",Wx);/**
362
+ * @license lucide-react v0.515.0 - ISC
363
+ *
364
+ * This source code is licensed under the ISC license.
365
+ * See the LICENSE file in the root directory of this source tree.
366
+ */const Vx=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],qn=Ie("terminal",Vx);/**
367
+ * @license lucide-react v0.515.0 - ISC
368
+ *
369
+ * This source code is licensed under the ISC license.
370
+ * See the LICENSE file in the root directory of this source tree.
371
+ */const Gx=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Tr=Ie("trash-2",Gx);/**
372
+ * @license lucide-react v0.515.0 - ISC
373
+ *
374
+ * This source code is licensed under the ISC license.
375
+ * See the LICENSE file in the root directory of this source tree.
376
+ */const Kx=[["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"}]],ca=Ie("triangle-alert",Kx);/**
377
+ * @license lucide-react v0.515.0 - ISC
378
+ *
379
+ * This source code is licensed under the ISC license.
380
+ * See the LICENSE file in the root directory of this source tree.
381
+ */const Jx=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],qs=Ie("upload",Jx);/**
382
+ * @license lucide-react v0.515.0 - ISC
383
+ *
384
+ * This source code is licensed under the ISC license.
385
+ * See the LICENSE file in the root directory of this source tree.
386
+ */const Yx=[["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"}]],Xx=Ie("user",Yx);/**
387
+ * @license lucide-react v0.515.0 - ISC
388
+ *
389
+ * This source code is licensed under the ISC license.
390
+ * See the LICENSE file in the root directory of this source tree.
391
+ */const Qx=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Mt=Ie("x",Qx);/**
392
+ * @license lucide-react v0.515.0 - ISC
393
+ *
394
+ * This source code is licensed under the ISC license.
395
+ * See the LICENSE file in the root directory of this source tree.
396
+ */const Zx=[["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"}]],Qu=Ie("zap",Zx);function Zu(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Zu(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function em(){for(var e,t,r=0,a="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Zu(e))&&(a&&(a+=" "),a+=t);return a}const Xl="-",e1=e=>{const t=r1(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:o=>{const l=o.split(Xl);return l[0]===""&&l.length!==1&&l.shift(),tm(l,t)||t1(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&a[o]?[...c,...a[o]]:c}}},tm=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],a=t.nextPart.get(r),s=a?tm(e.slice(1),a):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(Xl);return t.validators.find(({validator:o})=>o(i))?.classGroupId},sc=/^\[(.+)\]$/,t1=e=>{if(sc.test(e)){const t=sc.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},r1=e=>{const{theme:t,classGroups:r}=e,a={nextPart:new Map,validators:[]};for(const s in r)nl(r[s],a,s,t);return a},nl=(e,t,r,a)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:ic(t,s);i.classGroupId=r;return}if(typeof s=="function"){if(n1(s)){nl(s(a),t,r,a);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{nl(o,ic(t,i),r,a)})})},ic=(e,t)=>{let r=e;return t.split(Xl).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},n1=e=>e.isThemeGetter,a1=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,a=new Map;const s=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,a=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=a.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},al="!",sl=":",s1=sl.length,i1=e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=s=>{const i=[];let o=0,l=0,c=0,d;for(let g=0;g<s.length;g++){let y=s[g];if(o===0&&l===0){if(y===sl){i.push(s.slice(c,g)),c=g+s1;continue}if(y==="/"){d=g;continue}}y==="["?o++:y==="]"?o--:y==="("?l++:y===")"&&l--}const u=i.length===0?s:s.substring(c),m=o1(u),h=m!==u,p=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:p}};if(t){const s=t+sl,i=a;a=o=>o.startsWith(s)?i(o.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(r){const s=a;a=i=>r({className:i,parseClassName:s})}return a},o1=e=>e.endsWith(al)?e.substring(0,e.length-1):e.startsWith(al)?e.substring(1):e,l1=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const s=[];let i=[];return a.forEach(o=>{o[0]==="["||t[o]?(s.push(...i.sort(),o),i=[]):i.push(o)}),s.push(...i.sort()),s}},c1=e=>({cache:a1(e.cacheSize),parseClassName:i1(e),sortModifiers:l1(e),...e1(e)}),d1=/\s+/,u1=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:i}=t,o=[],l=e.trim().split(d1);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:h,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:y}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let v=!!y,w=a(v?g.substring(0,y):g);if(!w){if(!v){c=u+(c.length>0?" "+c:c);continue}if(w=a(g),!w){c=u+(c.length>0?" "+c:c);continue}v=!1}const S=i(h).join(":"),N=p?S+al:S,I=N+w;if(o.includes(I))continue;o.push(I);const F=s(w,v);for(let E=0;E<F.length;++E){const R=F[E];o.push(N+R)}c=u+(c.length>0?" "+c:c)}return c};function m1(){let e=0,t,r,a="";for(;e<arguments.length;)(t=arguments[e++])&&(r=rm(t))&&(a&&(a+=" "),a+=r);return a}const rm=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=rm(e[a]))&&(r&&(r+=" "),r+=t);return r};function h1(e,...t){let r,a,s,i=o;function o(c){const d=t.reduce((u,m)=>m(u),e());return r=c1(d),a=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const d=a(c);if(d)return d;const u=u1(c,r);return s(c,u),u}return function(){return i(m1.apply(null,arguments))}}const Xt=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},nm=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,am=/^\((?:(\w[\w-]*):)?(.+)\)$/i,p1=/^\d+\/\d+$/,f1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,g1=/\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$/,x1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,b1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,y1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ba=e=>p1.test(e),ht=e=>!!e&&!Number.isNaN(Number(e)),Ln=e=>!!e&&Number.isInteger(Number(e)),ao=e=>e.endsWith("%")&&ht(e.slice(0,-1)),xn=e=>f1.test(e),v1=()=>!0,k1=e=>g1.test(e)&&!x1.test(e),sm=()=>!1,w1=e=>b1.test(e),j1=e=>y1.test(e),N1=e=>!Be(e)&&!Oe(e),S1=e=>Ba(e,lm,sm),Be=e=>nm.test(e),ea=e=>Ba(e,cm,k1),so=e=>Ba(e,E1,ht),oc=e=>Ba(e,im,sm),C1=e=>Ba(e,om,j1),Hs=e=>Ba(e,dm,w1),Oe=e=>am.test(e),Ya=e=>Oa(e,cm),M1=e=>Oa(e,I1),lc=e=>Oa(e,im),A1=e=>Oa(e,lm),T1=e=>Oa(e,om),Ws=e=>Oa(e,dm,!0),Ba=(e,t,r)=>{const a=nm.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},Oa=(e,t,r=!1)=>{const a=am.exec(e);return a?a[1]?t(a[1]):r:!1},im=e=>e==="position"||e==="percentage",om=e=>e==="image"||e==="url",lm=e=>e==="length"||e==="size"||e==="bg-size",cm=e=>e==="length",E1=e=>e==="number",I1=e=>e==="family-name",dm=e=>e==="shadow",D1=()=>{const e=Xt("color"),t=Xt("font"),r=Xt("text"),a=Xt("font-weight"),s=Xt("tracking"),i=Xt("leading"),o=Xt("breakpoint"),l=Xt("container"),c=Xt("spacing"),d=Xt("radius"),u=Xt("shadow"),m=Xt("inset-shadow"),h=Xt("text-shadow"),p=Xt("drop-shadow"),g=Xt("blur"),y=Xt("perspective"),v=Xt("aspect"),w=Xt("ease"),S=Xt("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...I(),Oe,Be],E=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],H=()=>[Oe,Be,c],$=()=>[ba,"full","auto",...H()],A=()=>[Ln,"none","subgrid",Oe,Be],V=()=>["auto",{span:["full",Ln,Oe,Be]},Ln,Oe,Be],T=()=>[Ln,"auto",Oe,Be],U=()=>["auto","min","max","fr",Oe,Be],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...H()],de=()=>[ba,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],J=()=>[e,Oe,Be],X=()=>[...I(),lc,oc,{position:[Oe,Be]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ne=()=>["auto","cover","contain",A1,S1,{size:[Oe,Be]}],ue=()=>[ao,Ya,ea],M=()=>["","none","full",d,Oe,Be],ie=()=>["",ht,Ya,ea],Me=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[ht,ao,lc,oc],_e=()=>["","none",g,Oe,Be],ce=()=>["none",ht,Oe,Be],ve=()=>["none",ht,Oe,Be],He=()=>[ht,Oe,Be],Le=()=>[ba,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xn],breakpoint:[xn],color:[v1],container:[xn],"drop-shadow":[xn],ease:["in","out","in-out"],font:[N1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xn],shadow:[xn],spacing:["px",ht],text:[xn],"text-shadow":[xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ba,Be,Oe,v]}],container:["container"],columns:[{columns:[ht,Be,Oe,l]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:F()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{start:$()}],end:[{end:$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[Ln,"auto",Oe,Be]}],basis:[{basis:[ba,"full","auto",l,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ht,ba,"auto","initial","none",Be]}],grow:[{grow:["",ht,Oe,Be]}],shrink:[{shrink:["",ht,Oe,Be]}],order:[{order:[Ln,"first","last","none",Oe,Be]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[..._(),"normal"]}],"justify-self":[{"justify-self":["auto",..._()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[..._(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[..._(),"baseline"]}],"place-self":[{"place-self":["auto",..._()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:de()}],w:[{w:[l,"screen",...de()]}],"min-w":[{"min-w":[l,"screen","none",...de()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...de()]}],h:[{h:["screen","lh",...de()]}],"min-h":[{"min-h":["screen","lh","none",...de()]}],"max-h":[{"max-h":["screen","lh",...de()]}],"font-size":[{text:["base",r,Ya,ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Oe,so]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ao,Be]}],"font-family":[{font:[M1,Be,t]}],"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:[s,Oe,Be]}],"line-clamp":[{"line-clamp":[ht,"none",Oe,so]}],leading:[{leading:[i,...H()]}],"list-image":[{"list-image":["none",Oe,Be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,Be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:J()}],"text-color":[{text:J()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Me(),"wavy"]}],"text-decoration-thickness":[{decoration:[ht,"from-font","auto",Oe,ea]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[ht,"auto",Oe,Be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe,Be]}],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",Oe,Be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ln,Oe,Be],radial:["",Oe,Be],conic:[Ln,Oe,Be]},T1,C1]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Me(),"hidden","none"]}],"divide-style":[{divide:[...Me(),"hidden","none"]}],"border-color":[{border:J()}],"border-color-x":[{"border-x":J()}],"border-color-y":[{"border-y":J()}],"border-color-s":[{"border-s":J()}],"border-color-e":[{"border-e":J()}],"border-color-t":[{"border-t":J()}],"border-color-r":[{"border-r":J()}],"border-color-b":[{"border-b":J()}],"border-color-l":[{"border-l":J()}],"divide-color":[{divide:J()}],"outline-style":[{outline:[...Me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ht,Oe,Be]}],"outline-w":[{outline:["",ht,Ya,ea]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",u,Ws,Hs]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Ws,Hs]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[ht,ea]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",h,Ws,Hs]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[ht,Oe,Be]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"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":[ht]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":J()}],"mask-image-linear-to-color":[{"mask-linear-to":J()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":J()}],"mask-image-t-to-color":[{"mask-t-to":J()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":J()}],"mask-image-r-to-color":[{"mask-r-to":J()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":J()}],"mask-image-b-to-color":[{"mask-b-to":J()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":J()}],"mask-image-l-to-color":[{"mask-l-to":J()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":J()}],"mask-image-x-to-color":[{"mask-x-to":J()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[Oe,Be]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":J()}],"mask-image-radial-to-color":[{"mask-radial-to":J()}],"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":I()}],"mask-image-conic-pos":[{"mask-conic":[ht]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":J()}],"mask-image-conic-to-color":[{"mask-conic-to":J()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,Be]}],filter:[{filter:["","none",Oe,Be]}],blur:[{blur:_e()}],brightness:[{brightness:[ht,Oe,Be]}],contrast:[{contrast:[ht,Oe,Be]}],"drop-shadow":[{"drop-shadow":["","none",p,Ws,Hs]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",ht,Oe,Be]}],"hue-rotate":[{"hue-rotate":[ht,Oe,Be]}],invert:[{invert:["",ht,Oe,Be]}],saturate:[{saturate:[ht,Oe,Be]}],sepia:[{sepia:["",ht,Oe,Be]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,Be]}],"backdrop-blur":[{"backdrop-blur":_e()}],"backdrop-brightness":[{"backdrop-brightness":[ht,Oe,Be]}],"backdrop-contrast":[{"backdrop-contrast":[ht,Oe,Be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ht,Oe,Be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ht,Oe,Be]}],"backdrop-invert":[{"backdrop-invert":["",ht,Oe,Be]}],"backdrop-opacity":[{"backdrop-opacity":[ht,Oe,Be]}],"backdrop-saturate":[{"backdrop-saturate":[ht,Oe,Be]}],"backdrop-sepia":[{"backdrop-sepia":["",ht,Oe,Be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oe,Be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ht,"initial",Oe,Be]}],ease:[{ease:["linear","initial",w,Oe,Be]}],delay:[{delay:[ht,Oe,Be]}],animate:[{animate:["none",S,Oe,Be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Oe,Be]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:He()}],"skew-x":[{"skew-x":He()}],"skew-y":[{"skew-y":He()}],transform:[{transform:[Oe,Be,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Le()}],"translate-x":[{"translate-x":Le()}],"translate-y":[{"translate-y":Le()}],"translate-z":[{"translate-z":Le()}],"translate-none":["translate-none"],accent:[{accent:J()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:J()}],"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",Oe,Be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",Oe,Be]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[ht,Ya,ea,so]}],stroke:[{stroke:["none",...J()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-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-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-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-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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},z1=h1(D1);function Ke(...e){return z1(em(e))}const Ql=b.forwardRef(({className:e,children:t,...r},a)=>n.jsx("div",{ref:a,className:Ke("relative overflow-hidden",e),...r,children:n.jsx("div",{className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:t})}));Ql.displayName="ScrollArea";const cc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,dc=em,um=(e,t)=>r=>{var a;if(t?.variants==null)return dc(e,r?.class,r?.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const u=r?.[d],m=i?.[d];if(u===null)return null;const h=cc(u)||cc(m);return s[d][h]}),l=r&&Object.entries(r).reduce((d,u)=>{let[m,h]=u;return h===void 0||(d[m]=h),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,u)=>{let{class:m,className:h,...p}=u;return Object.entries(p).every(g=>{let[y,v]=g;return Array.isArray(v)?v.includes({...i,...l}[y]):{...i,...l}[y]===v})?[...d,m,h]:d},[]);return dc(e,o,c,r?.class,r?.className)},L1=um("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"}}),qe=b.forwardRef(({className:e,variant:t,size:r,...a},s)=>n.jsx("button",{className:Ke(L1({variant:t,size:r,className:e})),ref:s,...a}));qe.displayName="Button";const P1=um("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 Jr({className:e,variant:t,...r}){return n.jsx("div",{className:Ke(P1({variant:t}),e),...r})}const Ht=b.forwardRef(({className:e,type:t,...r},a)=>n.jsx("input",{type:t,className:Ke("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm 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",e),ref:a,...r}));Ht.displayName="Input";const Fr=({className:e="w-5 h-5"})=>n.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),mm=b.createContext(),js=()=>{const e=b.useContext(mm);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},R1=({children:e})=>{const[t,r]=b.useState(()=>{const i=localStorage.getItem("theme");return i?i==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});b.useEffect(()=>{if(t){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","black-translucent");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const i=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');i&&i.setAttribute("content","default");const o=document.querySelector('meta[name="theme-color"]');o&&o.setAttribute("content","#ffffff")}},[t]),b.useEffect(()=>{if(!window.matchMedia)return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=l=>{localStorage.getItem("theme")||r(l.matches)};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]);const s={isDarkMode:t,toggleDarkMode:()=>{r(i=>!i)}};return n.jsx(mm.Provider,{value:s,children:e})},Gr=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=js();return n.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},an=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=js();return n.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},F1=({status:e="not-configured",size:t="sm",className:r="",showLabel:a=!1})=>{const i=(()=>{switch(e){case"fully-configured":return{icon:ks,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:la,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:Li,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:Mt,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),o=i.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},c={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return a?n.jsxs("div",{className:Ke("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",i.bgColor,i.color,r),title:i.title,children:[n.jsx(o,{className:l[t]}),n.jsx("span",{className:"font-medium",children:i.label})]}):n.jsx("div",{className:Ke("inline-flex items-center justify-center rounded-full transition-colors",i.bgColor,c[t],r),title:i.title,children:n.jsx(o,{className:Ke(l[t],i.color)})})},je=(e,t={})=>{const r=localStorage.getItem("auth-token"),a={};return t.body instanceof FormData||(a["Content-Type"]="application/json"),r&&(a.Authorization=`Bearer ${r}`),fetch(e,{...t,headers:{...a,...t.headers}})},lt={auth:{status:()=>fetch("/api/auth/status"),login:(e,t)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})}),register:(e,t)=>fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})}),user:()=>je("/api/auth/user"),logout:()=>je("/api/auth/logout",{method:"POST"})},projects:()=>je("/api/projects"),sessions:(e,t=5,r=0)=>je(`/api/projects/${e}/sessions?limit=${t}&offset=${r}`),sessionMessages:(e,t,r=null,a=0,s="claude")=>{const i=new URLSearchParams;r!==null&&(i.append("limit",r),i.append("offset",a));const o=i.toString();let l;return s==="codex"?l=`/api/codex/sessions/${t}/messages${o?`?${o}`:""}`:s==="cursor"?l=`/api/cursor/sessions/${t}/messages${o?`?${o}`:""}`:l=`/api/projects/${e}/sessions/${t}/messages${o?`?${o}`:""}`,je(l)},renameProject:(e,t)=>je(`/api/projects/${e}/rename`,{method:"PUT",body:JSON.stringify({displayName:t})}),deleteSession:(e,t)=>je(`/api/projects/${e}/sessions/${t}`,{method:"DELETE"}),deleteCodexSession:e=>je(`/api/codex/sessions/${e}`,{method:"DELETE"}),deleteProject:e=>je(`/api/projects/${e}`,{method:"DELETE"}),createProject:e=>je("/api/projects/create",{method:"POST",body:JSON.stringify({path:e})}),createWorkspace:e=>je("/api/projects/create-workspace",{method:"POST",body:JSON.stringify(e)}),readFile:(e,t)=>je(`/api/projects/${e}/file?filePath=${encodeURIComponent(t)}`),saveFile:(e,t,r)=>je(`/api/projects/${e}/file`,{method:"PUT",body:JSON.stringify({filePath:t,content:r})}),getFiles:e=>je(`/api/projects/${e}/files`),transcribe:e=>je("/api/transcribe",{method:"POST",body:e,headers:{}}),taskmaster:{init:e=>je(`/api/taskmaster/init/${e}`,{method:"POST"}),addTask:(e,{prompt:t,title:r,description:a,priority:s,dependencies:i})=>je(`/api/taskmaster/add-task/${e}`,{method:"POST",body:JSON.stringify({prompt:t,title:r,description:a,priority:s,dependencies:i})}),parsePRD:(e,{fileName:t,numTasks:r,append:a})=>je(`/api/taskmaster/parse-prd/${e}`,{method:"POST",body:JSON.stringify({fileName:t,numTasks:r,append:a})}),getTemplates:()=>je("/api/taskmaster/prd-templates"),applyTemplate:(e,{templateId:t,fileName:r,customizations:a})=>je(`/api/taskmaster/apply-template/${e}`,{method:"POST",body:JSON.stringify({templateId:t,fileName:r,customizations:a})}),updateTask:(e,t,r)=>je(`/api/taskmaster/update-task/${e}/${t}`,{method:"PUT",body:JSON.stringify(r)})},browseFilesystem:(e=null)=>{const t=new URLSearchParams;return e&&t.append("path",e),je(`/api/browse-filesystem?${t}`)},user:{gitConfig:()=>je("/api/user/git-config"),updateGitConfig:(e,t)=>je("/api/user/git-config",{method:"POST",body:JSON.stringify({gitName:e,gitEmail:t})}),onboardingStatus:()=>je("/api/user/onboarding-status"),completeOnboarding:()=>je("/api/user/complete-onboarding",{method:"POST"})},get:e=>je(`/api${e}`)},B1=({onClose:e,onProjectCreated:t})=>{const[r,a]=b.useState(1),[s,i]=b.useState(null),[o,l]=b.useState(""),[c,d]=b.useState(""),[u,m]=b.useState(""),[h,p]=b.useState("stored"),[g,y]=b.useState(""),[v,w]=b.useState(!1),[S,N]=b.useState(null),[I,F]=b.useState([]),[E,R]=b.useState(!1),[H,$]=b.useState([]),[A,V]=b.useState(!1);b.useEffect(()=>{r===2&&s==="new"&&c&&T()},[r,s,c]),b.useEffect(()=>{o.length>2?U(o):($([]),V(!1))},[o]);const T=async()=>{try{R(!0);const j=((await(await lt.get("/settings/credentials?type=github_token")).json()).credentials||[]).filter(ne=>ne.is_active);F(j),j.length>0&&!u&&m(j[0].id.toString())}catch(J){console.error("Error loading GitHub tokens:",J)}finally{R(!1)}},U=async J=>{try{const X=J.lastIndexOf("/"),j=X>0?J.substring(0,X):"~",ue=await(await lt.browseFilesystem(j)).json();if(ue.suggestions){const M=ue.suggestions.filter(ie=>ie.path.toLowerCase().startsWith(J.toLowerCase()));$(M.slice(0,5)),V(M.length>0)}}catch(X){console.error("Error loading path suggestions:",X)}},P=()=>{if(N(null),r===1){if(!s){N("Please select whether you have an existing workspace or want to create a new one");return}a(2)}else if(r===2){if(!o.trim()){N("Please provide a workspace path");return}a(3)}},_=()=>{N(null),a(r-1)},se=async()=>{w(!0),N(null);try{const J={workspaceType:s,path:o.trim()};s==="new"&&c&&(J.githubUrl=c.trim(),h==="stored"&&u?J.githubTokenId=parseInt(u):h==="new"&&g&&(J.newGithubToken=g.trim()));const X=await lt.createWorkspace(J),j=await X.json();if(!X.ok)throw new Error(j.error||"Failed to create workspace");t&&t(j.project),e()}catch(J){console.error("Error creating workspace:",J),N(J.message||"Failed to create workspace")}finally{w(!1)}},de=J=>{l(J.path),V(!1)};return n.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[60] p-0 sm:p-4",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-none sm:rounded-lg shadow-xl w-full h-full sm:h-auto sm:max-w-2xl border-0 sm:border border-gray-200 dark:border-gray-700 overflow-y-auto",children:[n.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:n.jsx(fi,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create New Project"})]}),n.jsx("button",{onClick:e,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",disabled:v,children:n.jsx(Mt,{className:"w-5 h-5"})})]}),n.jsx("div",{className:"px-6 pt-4 pb-2",children:n.jsx("div",{className:"flex items-center justify-between",children:[1,2,3].map(J=>n.jsxs(Kr.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center font-medium text-sm ${J<r?"bg-green-500 text-white":J===r?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-500"}`,children:J<r?n.jsx(dr,{className:"w-4 h-4"}):J}),n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 hidden sm:inline",children:J===1?"Type":J===2?"Configure":"Confirm"})]}),J<3&&n.jsx("div",{className:`flex-1 h-1 mx-2 rounded ${J<r?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},J))})}),n.jsxs("div",{className:"p-6 space-y-6 min-h-[300px]",children:[S&&n.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 flex items-start gap-3",children:[n.jsx(Li,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),n.jsx("div",{className:"flex-1",children:n.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:S})})]}),r===1&&n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"Do you already have a workspace, or would you like to create a new one?"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsx("button",{onClick:()=>i("existing"),className:`p-4 border-2 rounded-lg text-left transition-all ${s==="existing"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:n.jsx(fi,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:"Existing Workspace"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"I already have a workspace on my server and just need to add it to the project list"})]})]})}),n.jsx("button",{onClick:()=>i("new"),className:`p-4 border-2 rounded-lg text-left transition-all ${s==="new"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:n.jsx(kn,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:"New Workspace"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Create a new workspace, optionally clone from a GitHub repository"})]})]})})]})]})}),r===2&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s==="existing"?"Workspace Path":"Where should the workspace be created?"}),n.jsxs("div",{className:"relative",children:[n.jsx(Ht,{type:"text",value:o,onChange:J=>l(J.target.value),placeholder:s==="existing"?"/path/to/existing/workspace":"/path/to/new/workspace",className:"w-full"}),A&&H.length>0&&n.jsx("div",{className:"absolute z-10 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:H.map((J,X)=>n.jsxs("button",{onClick:()=>de(J),className:"w-full px-4 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-700 text-sm",children:[n.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:J.name}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:J.path})]},X))})]}),n.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s==="existing"?"Full path to your existing workspace directory":"Full path where the new workspace will be created"})]}),s==="new"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"GitHub URL (Optional)"}),n.jsx(Ht,{type:"text",value:c,onChange:J=>d(J.target.value),placeholder:"https://github.com/username/repository",className:"w-full"}),n.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Leave empty to create an empty workspace, or provide a GitHub URL to clone"})]}),c&&n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[n.jsx(Kl,{className:"w-5 h-5 text-gray-600 dark:text-gray-400 flex-shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h5",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"GitHub Authentication (Optional)"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Only required for private repositories. Public repos can be cloned without authentication."})]})]}),E?n.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[n.jsx(ds,{className:"w-4 h-4 animate-spin"}),"Loading stored tokens..."]}):I.length>0?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[n.jsx("button",{onClick:()=>p("stored"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${h==="stored"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:"Stored Token"}),n.jsx("button",{onClick:()=>p("new"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${h==="new"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:"New Token"}),n.jsx("button",{onClick:()=>{p("none"),m(""),y("")},className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${h==="none"?"bg-green-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:"None (Public)"})]}),h==="stored"?n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Select Token"}),n.jsxs("select",{value:u,onChange:J=>m(J.target.value),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-sm",children:[n.jsx("option",{value:"",children:"-- Select a token --"}),I.map(J=>n.jsx("option",{value:J.id,children:J.credential_name},J.id))]})]}):h==="new"?n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"GitHub Token"}),n.jsx(Ht,{type:"password",value:g,onChange:J=>y(J.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),n.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"This token will be used only for this operation"})]}):null]}):n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 border border-blue-200 dark:border-blue-800",children:n.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["💡 ",n.jsx("strong",{children:"Public repositories"})," don't require authentication. You can skip providing a token if cloning a public repo."]})}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"GitHub Token (Optional for Public Repos)"}),n.jsx(Ht,{type:"password",value:g,onChange:J=>y(J.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (leave empty for public repos)",className:"w-full"}),n.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"No stored tokens available. You can add tokens in Settings → API Keys for easier reuse."})]})]})]})]})]}),r===3&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[n.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3",children:"Review Your Configuration"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Workspace Type:"}),n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:s==="existing"?"Existing Workspace":"New Workspace"})]}),n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Path:"}),n.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:o})]}),s==="new"&&c&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Clone From:"}),n.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:c})]}),n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Authentication:"}),n.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:h==="stored"&&u?`Using stored token: ${I.find(J=>J.id.toString()===u)?.credential_name||"Unknown"}`:h==="new"&&g?"Using provided token":"No authentication"})]})]})]})]}),n.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:n.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:s==="existing"?"The workspace will be added to your project list and will be available for Claude/Cursor sessions.":c?"A new workspace will be created and the repository will be cloned from GitHub.":"An empty workspace directory will be created at the specified path."})})]})]}),n.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200 dark:border-gray-700",children:[n.jsx(qe,{variant:"outline",onClick:r===1?e:_,disabled:v,children:r===1?"Cancel":n.jsxs(n.Fragment,{children:[n.jsx(Gl,{className:"w-4 h-4 mr-1"}),"Back"]})}),n.jsx(qe,{onClick:r===3?se:P,disabled:v||r===1&&!s,children:v?n.jsxs(n.Fragment,{children:[n.jsx(ds,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):r===3?n.jsxs(n.Fragment,{children:[n.jsx(dr,{className:"w-4 h-4 mr-1"}),"Create Project"]}):n.jsxs(n.Fragment,{children:["Next",n.jsx(cn,{className:"w-4 h-4 ml-1"})]})})]})]})})},hm=b.createContext({user:null,token:null,login:()=>{},register:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,hasCompletedOnboarding:!0,refreshOnboardingStatus:()=>{},error:null}),Ns=()=>{const e=b.useContext(hm);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},O1=({children:e})=>{const[t,r]=b.useState(null),[a,s]=b.useState(localStorage.getItem("auth-token")),[i,o]=b.useState(!0),[l,c]=b.useState(!1),[d,u]=b.useState(!0),[m,h]=b.useState(null);b.useEffect(()=>{y()},[]);const p=async()=>{try{const I=await lt.user.onboardingStatus();if(I.ok){const F=await I.json();u(F.hasCompletedOnboarding)}}catch(I){console.error("Error checking onboarding status:",I),u(!0)}},g=async()=>{await p()},y=async()=>{try{if(o(!0),h(null),(await(await lt.auth.status()).json()).needsSetup){c(!0),o(!1);return}if(a)try{const E=await lt.auth.user();if(E.ok){const R=await E.json();r(R.user),c(!1),await p()}else localStorage.removeItem("auth-token"),s(null),r(null)}catch(E){console.error("Token verification failed:",E),localStorage.removeItem("auth-token"),s(null),r(null)}}catch(I){console.error("[AuthContext] Auth status check failed:",I),h("Failed to check authentication status")}finally{o(!1)}},N={user:t,token:a,login:async(I,F)=>{try{h(null);const E=await lt.auth.login(I,F),R=await E.json();return E.ok?(s(R.token),r(R.user),localStorage.setItem("auth-token",R.token),{success:!0}):(h(R.error||"Login failed"),{success:!1,error:R.error||"Login failed"})}catch(E){console.error("Login error:",E);const R="Network error. Please try again.";return h(R),{success:!1,error:R}}},register:async(I,F)=>{try{h(null);const E=await lt.auth.register(I,F),R=await E.json();return E.ok?(s(R.token),r(R.user),c(!1),localStorage.setItem("auth-token",R.token),{success:!0}):(h(R.error||"Registration failed"),{success:!1,error:R.error||"Registration failed"})}catch(E){console.error("Registration error:",E);const R="Network error. Please try again.";return h(R),{success:!1,error:R}}},logout:()=>{s(null),r(null),localStorage.removeItem("auth-token"),a&&lt.auth.logout().catch(I=>{console.error("Logout endpoint error:",I)})},isLoading:i,needsSetup:l,hasCompletedOnboarding:d,refreshOnboardingStatus:g,error:m};return n.jsx(hm.Provider,{value:N,children:e})};function $1(){const[e,t]=b.useState(null),[r,a]=b.useState([]),[s,i]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>(l(),()=>{o.current&&clearTimeout(o.current),e&&e.close()}),[]);const l=async()=>{try{let u;{const h=localStorage.getItem("auth-token");if(!h){console.warn("No authentication token found for WebSocket connection");return}u=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws?token=${encodeURIComponent(h)}`}const m=new WebSocket(u);m.onopen=()=>{i(!0),t(m)},m.onmessage=h=>{try{const p=JSON.parse(h.data);a(g=>[...g,p])}catch(p){console.error("Error parsing WebSocket message:",p)}},m.onclose=()=>{i(!1),t(null),o.current=setTimeout(()=>{l()},3e3)},m.onerror=h=>{console.error("WebSocket error:",h)}}catch(d){console.error("Error creating WebSocket connection:",d)}};return{ws:e,sendMessage:d=>{e&&s?e.send(JSON.stringify(d)):console.warn("WebSocket not connected")},messages:r,isConnected:s}}const pm=b.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),fm=()=>{const e=b.useContext(pm);if(!e)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return e},_1=({children:e})=>{const t=$1();return n.jsx(pm.Provider,{value:t,children:e})},gm=b.createContext({projects:[],currentProject:null,projectTaskMaster:null,mcpServerStatus:null,tasks:[],nextTask:null,isLoading:!1,isLoadingTasks:!1,isLoadingMCP:!1,error:null,refreshProjects:()=>{},setCurrentProject:()=>{},refreshTasks:()=>{},refreshMCPStatus:()=>{},clearError:()=>{}}),Ss=()=>{const e=b.useContext(gm);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e},q1=({children:e})=>{const{messages:t}=fm(),{user:r,token:a,isLoading:s}=Ns(),[i,o]=b.useState([]),[l,c]=b.useState(null),[d,u]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState([]),[y,v]=b.useState(null),[w,S]=b.useState(!1),[N,I]=b.useState(!1),[F,E]=b.useState(!1),[R,H]=b.useState(null),$=(se,de)=>{console.error(`TaskMaster ${de} error:`,se),H({message:se.message||`Failed to ${de}`,context:de,timestamp:new Date().toISOString()})},A=b.useCallback(()=>{H(null)},[]),V=b.useCallback(async()=>{if(!r||!a){o([]),c(null);return}try{S(!0),A();const se=await lt.get("/projects");if(!se.ok)throw new Error(`Failed to fetch projects: ${se.status}`);const de=await se.json();if(!Array.isArray(de)){console.error("Projects API returned non-array data:",de),o([]);return}const J=de.map(X=>({...X,taskMasterConfigured:X.taskmaster?.hasTaskmaster||!1,taskMasterStatus:X.taskmaster?.status||"not-configured",taskCount:X.taskmaster?.metadata?.taskCount||0,completedCount:X.taskmaster?.metadata?.completed||0}));if(o(J),l){const X=J.find(j=>j.name===l.name);X&&(c(X),u(X.taskmaster))}}catch(se){$(se,"load projects")}finally{S(!1)}},[r,a]),T=b.useCallback(async se=>{try{c(se),g([]),v(null),u(se?.taskmaster||null)}catch(de){console.error("Error in setCurrentProject:",de),$(de,"set current project"),u(se?.taskmaster||null)}},[]),U=b.useCallback(async()=>{if(!r||!a){h(null);return}try{E(!0),A();const se=await lt.get("/mcp-utils/taskmaster-server");h(se)}catch(se){$(se,"check MCP server status")}finally{E(!1)}},[r,a]),P=b.useCallback(async()=>{if(!l){g([]),v(null);return}if(!r||!a){g([]),v(null);return}try{I(!0),A();const se=await lt.get(`/taskmaster/tasks/${encodeURIComponent(l.name)}`);if(!se.ok){const X=await se.json();throw new Error(X.message||"Failed to load tasks")}const de=await se.json();g(de.tasks||[]);const J=de.tasks?.find(X=>X.status==="pending"||X.status==="in-progress")||null;v(J)}catch(se){console.error("Error loading tasks:",se),$(se,"load tasks"),g([]),v(null)}finally{I(!1)}},[l,r,a]);b.useEffect(()=>{!s&&r&&a?(V(),U()):console.log("Auth not ready or no user, skipping project load:",{authLoading:s,user:!!r,token:!!a})},[V,U,s,r,a]),b.useEffect(()=>{r&&a&&A()},[r,a,A]),b.useEffect(()=>{l?.name&&r&&a&&P()},[l?.name,r,a,P]),b.useEffect(()=>{const se=t[t.length-1];if(se)switch(se.type){case"taskmaster-project-updated":se.projectName&&V();break;case"taskmaster-tasks-updated":se.projectName===l?.name&&P();break;case"taskmaster-mcp-status-changed":U();break}},[t,V,P,U,l]);const _={projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:m,tasks:p,nextTask:y,isLoading:w,isLoadingTasks:N,isLoadingMCP:F,error:R,refreshProjects:V,setCurrentProject:T,refreshTasks:P,refreshMCPStatus:U,clearError:A};return n.jsx(gm.Provider,{value:_,children:e})},xm=b.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Cs=()=>{const e=b.useContext(xm);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},H1=({children:e})=>{const[t,r]=b.useState(()=>{const p=localStorage.getItem("tasks-enabled");return p!==null?JSON.parse(p):!0}),[a,s]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(null),[d,u]=b.useState(!0);b.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),b.useEffect(()=>{setTimeout(async()=>{try{const g=await lt.get("/taskmaster/installation-status");if(g.ok){const y=await g.json();c(y),s(y.installation?.isInstalled||!1),o(y.isReady||!1);const v=localStorage.getItem("tasks-enabled");!y.installation?.isInstalled&&!v&&r(!1)}else console.error("Failed to check TaskMaster installation status"),s(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),s(!1),o(!1)}finally{u(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:r,toggleTasksEnabled:()=>{r(p=>!p)},isTaskMasterInstalled:a,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:d};return n.jsx(xm.Provider,{value:h,children:e})},uc=(e,t)=>{const r=new Date(e),a=t;if(isNaN(r.getTime()))return"Unknown";const s=a-r,i=Math.floor(s/1e3),o=Math.floor(s/(1e3*60)),l=Math.floor(s/(1e3*60*60)),c=Math.floor(s/(1e3*60*60*24));return i<60?"Just now":o===1?"1 min ago":o<60?`${o} mins ago`:l===1?"1 hour ago":l<24?`${l} hours ago`:c===1?"1 day ago":c<7?`${c} days ago`:r.toLocaleDateString()};function mc({projects:e,selectedProject:t,selectedSession:r,onProjectSelect:a,onSessionSelect:s,onNewSession:i,onSessionDelete:o,onProjectDelete:l,isLoading:c,onRefresh:d,onShowSettings:u,updateAvailable:m,latestVersion:h,currentVersion:p,releaseInfo:g,onShowVersionModal:y,isPWA:v,isMobile:w,onToggleSidebar:S}){const[N,I]=b.useState(new Set),[F,E]=b.useState(null),[R,H]=b.useState(!1),[$,A]=b.useState(""),[V,T]=b.useState({}),[U,P]=b.useState({}),[_,se]=b.useState(new Set),[de,J]=b.useState(new Date),[X,j]=b.useState("name"),[ne,ue]=b.useState(!1),[M,ie]=b.useState(null),[Me,Se]=b.useState(""),[me,_e]=b.useState({}),[ce,ve]=b.useState(""),{setCurrentProject:He,mcpServerStatus:Le}=Ss(),{tasksEnabled:rt}=Cs(),[Ye,yt]=b.useState(()=>{try{const B=localStorage.getItem("starredProjects");return B?new Set(JSON.parse(B)):new Set}catch(B){return console.error("Error loading starred projects:",B),new Set}}),mt=B=>ee=>{ee.target.closest(".overflow-y-auto")||ee.target.closest("[data-scroll-container]")||(ee.preventDefault(),ee.stopPropagation(),B())};b.useEffect(()=>{const B=setInterval(()=>{J(new Date)},6e4);return()=>clearInterval(B)},[]),b.useEffect(()=>{P({}),se(new Set)},[e]),b.useEffect(()=>{r&&t&&I(B=>new Set([...B,t.name]))},[r,t]),b.useEffect(()=>{if(e.length>0&&!c){const B=new Set;e.forEach(ee=>{ee.sessions&&ee.sessions.length>=0&&B.add(ee.name)}),se(B)}},[e,c]),b.useEffect(()=>{const B=()=>{try{const Ne=localStorage.getItem("claude-settings");if(Ne){const Z=JSON.parse(Ne);j(Z.projectSortOrder||"name")}}catch(Ne){console.error("Error loading sort order:",Ne)}};B();const ee=Ne=>{Ne.key==="claude-settings"&&B()};window.addEventListener("storage",ee);const ge=setInterval(()=>{document.hasFocus()&&B()},1e3);return()=>{window.removeEventListener("storage",ee),clearInterval(ge)}},[]);const vt=B=>{const ee=new Set;N.has(B)||ee.add(B),I(ee)},ft=(B,ee)=>{s({...B,__projectName:ee})},Ue=B=>{const ee=new Set(Ye);ee.has(B)?ee.delete(B):ee.add(B),yt(ee);try{localStorage.setItem("starredProjects",JSON.stringify([...ee]))}catch(ge){console.error("Error saving starred projects:",ge)}},bt=B=>Ye.has(B),kt=B=>{const ee=[...B.sessions||[],...U[B.name]||[]].map(Ce=>({...Ce,__provider:"claude"})),ge=(B.cursorSessions||[]).map(Ce=>({...Ce,__provider:"cursor"})),Ne=(B.codexSessions||[]).map(Ce=>({...Ce,__provider:"codex"})),Z=Ce=>Ce.__provider==="cursor"?new Date(Ce.createdAt):Ce.__provider==="codex"?new Date(Ce.createdAt||Ce.lastActivity):new Date(Ce.lastActivity);return[...ee,...ge,...Ne].sort((Ce,Ze)=>Z(Ze)-Z(Ce))},Vt=B=>{const ee=kt(B);return ee.length===0?new Date(0):ee.reduce((Ne,Z)=>{const Ce=new Date(Z.lastActivity);return Ce>Ne?Ce:Ne},new Date(0))},Ve=[...e].sort((B,ee)=>{const ge=bt(B.name),Ne=bt(ee.name);if(ge&&!Ne)return-1;if(!ge&&Ne)return 1;if(X==="date")return Vt(ee)-Vt(B);{const Z=B.displayName||B.name,Ce=ee.displayName||ee.name;return Z.localeCompare(Ce)}}),we=B=>{E(B.name),A(B.displayName)},Ae=()=>{E(null),A("")},q=async B=>{try{(await lt.renameProject(B,$)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(ee){console.error("Error renaming project:",ee)}E(null),A("")},G=async(B,ee,ge="claude")=>{if(confirm("Are you sure you want to delete this session? This action cannot be undone."))try{console.log("[Sidebar] Deleting session:",{projectName:B,sessionId:ee,provider:ge});let Ne;if(ge==="codex"?Ne=await lt.deleteCodexSession(ee):Ne=await lt.deleteSession(B,ee),console.log("[Sidebar] Delete response:",{ok:Ne.ok,status:Ne.status}),Ne.ok)console.log("[Sidebar] Session deleted successfully, calling callback"),o?o(ee):console.warn("[Sidebar] No onSessionDelete callback provided");else{const Z=await Ne.text();console.error("[Sidebar] Failed to delete session:",{status:Ne.status,error:Z}),alert("Failed to delete session. Please try again.")}}catch(Ne){console.error("[Sidebar] Error deleting session:",Ne),alert("Error deleting session. Please try again.")}},be=async B=>{if(confirm("Are you sure you want to delete this empty project? This action cannot be undone."))try{const ee=await lt.deleteProject(B);if(ee.ok)l&&l(B);else{const ge=await ee.json();console.error("Failed to delete project"),alert(ge.error||"Failed to delete project. Please try again.")}}catch(ee){console.error("Error deleting project:",ee),alert("Error deleting project. Please try again.")}},Pe=async B=>{if(!(!(B.sessionMeta?.hasMore!==!1)||V[B.name])){T(ge=>({...ge,[B.name]:!0}));try{const ge=(B.sessions?.length||0)+(U[B.name]?.length||0),Ne=await lt.sessions(B.name,5,ge);if(Ne.ok){const Z=await Ne.json();P(Ce=>({...Ce,[B.name]:[...Ce[B.name]||[],...Z.sessions]})),Z.hasMore===!1&&(B.sessionMeta={...B.sessionMeta,hasMore:!1})}}catch(ge){console.error("Error loading more sessions:",ge)}finally{T(ge=>({...ge,[B.name]:!1}))}}},st=Ve.filter(B=>{if(!ce.trim())return!0;const ee=ce.toLowerCase(),ge=(B.displayName||B.name).toLowerCase(),Ne=B.name.toLowerCase();return ge.includes(ee)||Ne.includes(ee)}),he=B=>{a(B),He(B)};return n.jsxs(n.Fragment,{children:[R&&Kf.createPortal(n.jsx(B1,{onClose:()=>H(!1),onProjectCreated:B=>{window.refreshProjects?window.refreshProjects():window.location.reload()}}),document.body),n.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:v&&w?{paddingTop:"44px"}:{},children:[n.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[n.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:n.jsx(us,{className:"w-4 h-4 text-primary-foreground"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Claude Code UI"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"AI coding assistant interface"})]})]}),S&&n.jsx(qe,{variant:"ghost",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200",onClick:S,title:"Hide sidebar",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),n.jsx("div",{className:"md:hidden p-3 border-b border-border",style:v&&w?{paddingTop:"16px"}:{},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-primary rounded-lg flex items-center justify-center",children:n.jsx(us,{className:"w-4 h-4 text-primary-foreground"})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Claude Code UI"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Projects"})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{ue(!0);try{await d()}finally{ue(!1)}},disabled:ne,children:n.jsx(yn,{className:`w-4 h-4 text-foreground ${ne?"animate-spin":""}`})}),n.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>H(!0),children:n.jsx(fi,{className:"w-4 h-4"})})]})]})})]}),e.length>0&&!c&&n.jsxs("div",{className:"px-3 md:px-4 py-2 border-b border-border space-y-2",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Ia,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),n.jsx(Ht,{type:"text",placeholder:"Search projects...",value:ce,onChange:B=>ve(B.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),ce&&n.jsx("button",{onClick:()=>ve(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:n.jsx(Mt,{className:"w-3 h-3 text-muted-foreground"})})]}),!w&&n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(qe,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>H(!0),title:"Create new project (Ctrl+N)",children:[n.jsx(fi,{className:"w-3.5 h-3.5 mr-1.5"}),"New Project"]}),n.jsx(qe,{variant:"outline",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{ue(!0);try{await d()}finally{ue(!1)}},disabled:ne,title:"Refresh projects and sessions (Ctrl+R)",children:n.jsx(yn,{className:`w-3.5 h-3.5 ${ne?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})})]})]}),n.jsx(Ql,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:n.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:c?n.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[n.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:n.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),n.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"Loading projects..."}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Fetching your Claude projects and sessions"})]}):e.length===0?n.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[n.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:n.jsx(On,{className:"w-6 h-6 text-muted-foreground"})}),n.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No projects found"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Run Claude CLI in a project directory to get started"})]}):st.length===0?n.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[n.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:n.jsx(Ia,{className:"w-6 h-6 text-muted-foreground"})}),n.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No matching projects"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Try adjusting your search term"})]}):st.map(B=>{const ee=N.has(B.name),ge=t?.name===B.name,Ne=bt(B.name);return n.jsxs("div",{className:"md:space-y-1",children:[n.jsxs("div",{className:"group md:group",children:[n.jsx("div",{className:"md:hidden",children:n.jsx("div",{className:Ke("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",ge&&"bg-primary/5 border-primary/20",Ne&&!ge&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{vt(B.name)},onTouchEnd:mt(()=>vt(B.name)),children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[n.jsx("div",{className:Ke("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",ee?"bg-primary/10":"bg-muted"),children:ee?n.jsx(ia,{className:"w-4 h-4 text-primary"}):n.jsx(On,{className:"w-4 h-4 text-muted-foreground"})}),n.jsx("div",{className:"min-w-0 flex-1",children:F===B.name?n.jsx("input",{type:"text",value:$,onChange:Z=>A(Z.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:"Project name",autoFocus:!0,autoComplete:"off",onClick:Z=>Z.stopPropagation(),onKeyDown:Z=>{Z.key==="Enter"&&q(B.name),Z.key==="Escape"&&Ae()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[n.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:B.displayName}),rt&&n.jsx(F1,{status:(()=>{const Z=B.taskmaster?.hasTaskmaster,Ce=Le?.hasMCPServer&&Le?.isConfigured;return Z&&Ce?"fully-configured":Z?"taskmaster-only":Ce?"mcp-only":"not-configured"})(),size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const Z=kt(B).length,Ze=B.sessionMeta?.hasMore!==!1&&Z>=5?`${Z}+`:Z;return`${Ze} session${Ze===1?"":"s"}`})()})]})})]}),n.jsx("div",{className:"flex items-center gap-1",children:F===B.name?n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:Z=>{Z.stopPropagation(),q(B.name)},children:n.jsx(dr,{className:"w-4 h-4 text-white"})}),n.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:Z=>{Z.stopPropagation(),Ae()},children:n.jsx(Mt,{className:"w-4 h-4 text-white"})})]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{className:Ke("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",Ne?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:Z=>{Z.stopPropagation(),Ue(B.name)},onTouchEnd:mt(()=>Ue(B.name)),title:Ne?"Remove from favorites":"Add to favorites",children:n.jsx(ac,{className:Ke("w-4 h-4 transition-colors",Ne?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),kt(B).length===0&&n.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:Z=>{Z.stopPropagation(),be(B.name)},onTouchEnd:mt(()=>be(B.name)),children:n.jsx(Tr,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),n.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:Z=>{Z.stopPropagation(),we(B)},onTouchEnd:mt(()=>we(B)),children:n.jsx(ms,{className:"w-4 h-4 text-primary"})}),n.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:ee?n.jsx(Pr,{className:"w-3 h-3 text-muted-foreground"}):n.jsx(cn,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),n.jsxs(qe,{variant:"ghost",className:Ke("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",ge&&"bg-accent text-accent-foreground",Ne&&!ge&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{t?.name!==B.name&&he(B),vt(B.name)},onTouchEnd:mt(()=>{t?.name!==B.name&&he(B),vt(B.name)}),children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[ee?n.jsx(ia,{className:"w-4 h-4 text-primary flex-shrink-0"}):n.jsx(On,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),n.jsx("div",{className:"min-w-0 flex-1 text-left",children:F===B.name?n.jsxs("div",{className:"space-y-1",children:[n.jsx("input",{type:"text",value:$,onChange:Z=>A(Z.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:"Project name",autoFocus:!0,onKeyDown:Z=>{Z.key==="Enter"&&q(B.name),Z.key==="Escape"&&Ae()}}),n.jsx("div",{className:"text-xs text-muted-foreground truncate",title:B.fullPath,children:B.fullPath})]}):n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:B.displayName,children:B.displayName}),n.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const Z=kt(B).length;return B.sessionMeta?.hasMore!==!1&&Z>=5?`${Z}+`:Z})(),B.fullPath!==B.displayName&&n.jsxs("span",{className:"ml-1 opacity-60",title:B.fullPath,children:["• ",B.fullPath.length>25?"..."+B.fullPath.slice(-22):B.fullPath]})]})]})})]}),n.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:F===B.name?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:Z=>{Z.stopPropagation(),q(B.name)},children:n.jsx(dr,{className:"w-3 h-3"})}),n.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:Z=>{Z.stopPropagation(),Ae()},children:n.jsx(Mt,{className:"w-3 h-3"})})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:Ke("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",Ne?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:Z=>{Z.stopPropagation(),Ue(B.name)},title:Ne?"Remove from favorites":"Add to favorites",children:n.jsx(ac,{className:Ke("w-3 h-3 transition-colors",Ne?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),n.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),we(B)},title:"Rename project (F2)",children:n.jsx(ms,{className:"w-3 h-3"})}),kt(B).length===0&&n.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),be(B.name)},title:"Delete empty project (Delete)",children:n.jsx(Tr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),ee?n.jsx(Pr,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):n.jsx(cn,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),ee&&n.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[_.has(B.name)?kt(B).length===0&&!V[B.name]?n.jsx("div",{className:"py-2 px-3 text-left",children:n.jsx("p",{className:"text-xs text-muted-foreground",children:"No sessions yet"})}):kt(B).map(Z=>{const Ce=Z.__provider==="cursor",Ze=Z.__provider==="codex",At=Ce?new Date(Z.createdAt):Ze?new Date(Z.createdAt||Z.lastActivity):new Date(Z.lastActivity),Xr=Math.floor((de-At)/(1e3*60))<10,Dn=Ce?Z.name||"Untitled Session":Ze?Z.summary||Z.name||"Codex Session":Z.summary||"New Session",fr=Ce?Z.createdAt:Ze&&Z.createdAt||Z.lastActivity,sr=Z.messageCount||0;return n.jsxs("div",{className:"group relative",children:[Xr&&n.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:n.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),n.jsx("div",{className:"md:hidden",children:n.jsx("div",{className:Ke("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",r?.id===Z.id?"bg-primary/5 border-primary/20":Xr?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{he(B),ft(Z,B.name)},onTouchEnd:mt(()=>{he(B),ft(Z,B.name)}),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:Ke("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",r?.id===Z.id?"bg-primary/10":"bg-muted/50"),children:Ce?n.jsx(Gr,{className:"w-3 h-3"}):Ze?n.jsx(an,{className:"w-3 h-3"}):n.jsx(Fr,{className:"w-3 h-3"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:Dn}),n.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[n.jsx(cs,{className:"w-2.5 h-2.5 text-muted-foreground"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:uc(fr,de)}),sr>0&&n.jsx(Jr,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:sr}),n.jsx("span",{className:"ml-1 opacity-70",children:Ce?n.jsx(Gr,{className:"w-3 h-3"}):Ze?n.jsx(an,{className:"w-3 h-3"}):n.jsx(Fr,{className:"w-3 h-3"})})]})]}),!Ce&&n.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:Pt=>{Pt.stopPropagation(),G(B.name,Z.id,Z.__provider)},onTouchEnd:mt(()=>G(B.name,Z.id,Z.__provider)),children:n.jsx(Tr,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),n.jsxs("div",{className:"hidden md:block",children:[n.jsx(qe,{variant:"ghost",className:Ke("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",r?.id===Z.id&&"bg-accent text-accent-foreground"),onClick:()=>ft(Z,B.name),onTouchEnd:mt(()=>ft(Z,B.name)),children:n.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[Ce?n.jsx(Gr,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):Ze?n.jsx(an,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}):n.jsx(Fr,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:Dn}),n.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[n.jsx(cs,{className:"w-2.5 h-2.5 text-muted-foreground"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:uc(fr,de)}),sr>0&&n.jsx(Jr,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:sr}),n.jsx("span",{className:"ml-1 opacity-70",children:Ce?n.jsx(Gr,{className:"w-3 h-3"}):Ze?n.jsx(an,{className:"w-3 h-3"}):n.jsx(Fr,{className:"w-3 h-3"})})]})]})]})}),!Ce&&n.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:M===Z.id&&!Ze?n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"text",value:Me,onChange:Pt=>Se(Pt.target.value),onKeyDown:Pt=>{Pt.stopPropagation(),Pt.key==="Enter"?updateSessionSummary(B.name,Z.id,Me):Pt.key==="Escape"&&(ie(null),Se(""))},onClick:Pt=>Pt.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),n.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:Pt=>{Pt.stopPropagation(),updateSessionSummary(B.name,Z.id,Me)},title:"Save",children:n.jsx(dr,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),n.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:Pt=>{Pt.stopPropagation(),ie(null),Se("")},title:"Cancel",children:n.jsx(Mt,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):n.jsxs(n.Fragment,{children:[!Ze&&n.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:Pt=>{Pt.stopPropagation(),ie(Z.id),Se(Z.summary||"New Session")},title:"Manually edit session name",children:n.jsx(jx,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),n.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:Pt=>{Pt.stopPropagation(),G(B.name,Z.id,Z.__provider)},title:"Delete this session permanently",children:n.jsx(Tr,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},Z.id)}):Array.from({length:3}).map((Z,Ce)=>n.jsx("div",{className:"p-2 rounded-md",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),n.jsxs("div",{className:"flex-1 space-y-1",children:[n.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+Ce*15}%`}}),n.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},Ce)),kt(B).length>0&&B.sessionMeta?.hasMore!==!1&&n.jsx(qe,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>Pe(B),disabled:V[B.name],children:V[B.name]?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"Loading..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Pr,{className:"w-3 h-3"}),"Show more sessions"]})}),n.jsx("div",{className:"md:hidden px-3 pb-2",children:n.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{he(B),i(B)},children:[n.jsx(ar,{className:"w-3 h-3"}),"New Session"]})}),n.jsxs(qe,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>i(B),children:[n.jsx(ar,{className:"w-3 h-3"}),"New Session"]})]})]},B.name)})})}),m&&n.jsxs("div",{className:"md:p-2 border-t border-border/50 flex-shrink-0",children:[n.jsx("div",{className:"hidden md:block",children:n.jsxs(qe,{variant:"ghost",className:"w-full justify-start gap-3 p-3 h-auto font-normal text-left hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors duration-200 border border-blue-200 dark:border-blue-700 rounded-lg mb-2",onClick:y,children:[n.jsxs("div",{className:"relative",children:[n.jsx("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),n.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:g?.title||`Version ${h}`}),n.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Update available"})]})]})}),n.jsx("div",{className:"md:hidden p-3 pb-2",children:n.jsxs("button",{className:"w-full h-12 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700 rounded-xl flex items-center justify-start gap-3 px-4 active:scale-[0.98] transition-all duration-150",onClick:y,children:[n.jsxs("div",{className:"relative",children:[n.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})}),n.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]}),n.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[n.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:g?.title||`Version ${h}`}),n.jsx("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:"Update available"})]})]})})]}),n.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[n.jsx("div",{className:"md:hidden p-4 pb-20 border-t border-border/50",children:n.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:u,children:[n.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:n.jsx(la,{className:"w-5 h-5 text-muted-foreground"})}),n.jsx("span",{className:"text-lg font-medium text-foreground",children:"Settings"})]})}),n.jsxs(qe,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:u,children:[n.jsx(la,{className:"w-3 h-3"}),n.jsx("span",{className:"text-xs",children:"Settings"})]})]})]})]})}function hc(e){const t=[],r=String(e||"");let a=r.indexOf(","),s=0,i=!1;for(;!i;){a===-1&&(a=r.length,i=!0);const o=r.slice(s,a).trim();(o||!i)&&t.push(o),s=a+1,a=r.indexOf(",",s)}return t}function W1(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const U1=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,V1=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,G1={};function pc(e,t){return(G1.jsx?V1:U1).test(e)}const K1=/[ \t\n\f\r]/g;function J1(e){return typeof e=="object"?e.type==="text"?fc(e.value):!1:fc(e)}function fc(e){return e.replace(K1,"")===""}class Ms{constructor(t,r,a){this.normal=r,this.property=t,a&&(this.space=a)}}Ms.prototype.normal={};Ms.prototype.property={};Ms.prototype.space=void 0;function bm(e,t){const r={},a={};for(const s of e)Object.assign(r,s.property),Object.assign(a,s.normal);return new Ms(r,a,t)}function hs(e){return e.toLowerCase()}class wr{constructor(t,r){this.attribute=r,this.property=t}}wr.prototype.attribute="";wr.prototype.booleanish=!1;wr.prototype.boolean=!1;wr.prototype.commaOrSpaceSeparated=!1;wr.prototype.commaSeparated=!1;wr.prototype.defined=!1;wr.prototype.mustUseProperty=!1;wr.prototype.number=!1;wr.prototype.overloadedBoolean=!1;wr.prototype.property="";wr.prototype.spaceSeparated=!1;wr.prototype.space=void 0;let Y1=0;const ct=ma(),Kt=ma(),il=ma(),ke=ma(),zt=ma(),Ma=ma(),Sr=ma();function ma(){return 2**++Y1}const ol=Object.freeze(Object.defineProperty({__proto__:null,boolean:ct,booleanish:Kt,commaOrSpaceSeparated:Sr,commaSeparated:Ma,number:ke,overloadedBoolean:il,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),io=Object.keys(ol);class Zl extends wr{constructor(t,r,a,s){let i=-1;if(super(t,r),gc(this,"space",s),typeof a=="number")for(;++i<io.length;){const o=io[i];gc(this,io[i],(a&ol[o])===ol[o])}}}Zl.prototype.defined=!0;function gc(e,t,r){r&&(e[t]=r)}function $a(e){const t={},r={};for(const[a,s]of Object.entries(e.properties)){const i=new Zl(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(i.mustUseProperty=!0),t[a]=i,r[hs(a)]=a,r[hs(i.attribute)]=a}return new Ms(t,r,e.space)}const ym=$a({properties:{ariaActiveDescendant:null,ariaAtomic:Kt,ariaAutoComplete:null,ariaBusy:Kt,ariaChecked:Kt,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:Kt,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:Kt,ariaFlowTo:zt,ariaGrabbed:Kt,ariaHasPopup:null,ariaHidden:Kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:ke,ariaLive:null,ariaModal:Kt,ariaMultiLine:Kt,ariaMultiSelectable:Kt,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:Kt,ariaReadOnly:Kt,ariaRelevant:null,ariaRequired:Kt,ariaRoleDescription:zt,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:Kt,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function vm(e,t){return t in e?e[t]:t}function km(e,t){return vm(e,t.toLowerCase())}const X1=$a({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ma,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:ct,allowPaymentRequest:ct,allowUserMedia:ct,alt:null,as:null,async:ct,autoCapitalize:null,autoComplete:zt,autoFocus:ct,autoPlay:ct,blocking:zt,capture:null,charSet:null,checked:ct,cite:null,className:zt,cols:ke,colSpan:null,content:null,contentEditable:Kt,controls:ct,controlsList:zt,coords:ke|Ma,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ct,defer:ct,dir:null,dirName:null,disabled:ct,download:il,draggable:Kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ct,formTarget:null,headers:zt,height:ke,hidden:il,high:ke,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:ct,inputMode:null,integrity:null,is:null,isMap:ct,itemId:null,itemProp:zt,itemRef:zt,itemScope:ct,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ct,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:ct,muted:ct,name:null,nonce:null,noModule:ct,noValidate:ct,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:ct,optimum:ke,pattern:null,ping:zt,placeholder:null,playsInline:ct,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ct,referrerPolicy:null,rel:zt,required:ct,reversed:ct,rows:ke,rowSpan:ke,sandbox:zt,scope:null,scoped:ct,seamless:ct,selected:ct,shadowRootClonable:ct,shadowRootDelegatesFocus:ct,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:Kt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:ct,useMap:null,value:Kt,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ct,declare:ct,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:ct,noHref:ct,noShade:ct,noWrap:ct,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:Kt,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ct,disableRemotePlayback:ct,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:km}),Q1=$a({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:Sr,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:zt,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:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:ct,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,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:Ma,g2:Ma,glyphName:Ma,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:Sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,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:ke,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:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sr,rev:Sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sr,requiredFeatures:Sr,requiredFonts:Sr,requiredFormats:Sr,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:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:Sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Sr,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vm}),wm=$a({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),jm=$a({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:km}),Nm=$a({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Z1={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"},eb=/[A-Z]/g,xc=/-[a-z]/g,tb=/^data[-\w.:]+$/i;function Sm(e,t){const r=hs(t);let a=t,s=wr;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&tb.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(xc,nb);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!xc.test(i)){let o=i.replace(eb,rb);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Zl}return new s(a,t)}function rb(e){return"-"+e.toLowerCase()}function nb(e){return e.charAt(1).toUpperCase()}const Cm=bm([ym,X1,wm,jm,Nm],"html"),Ri=bm([ym,Q1,wm,jm,Nm],"svg");function bc(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function ab(e){return e.join(" ").trim()}var ya={},oo,yc;function sb(){if(yc)return oo;yc=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
397
+ `,d="/",u="*",m="",h="comment",p="declaration";oo=function(y,v){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];v=v||{};var w=1,S=1;function N(U){var P=U.match(t);P&&(w+=P.length);var _=U.lastIndexOf(c);S=~_?U.length-_:S+U.length}function I(){var U={line:w,column:S};return function(P){return P.position=new F(U),H(),P}}function F(U){this.start=U,this.end={line:w,column:S},this.source=v.source}F.prototype.content=y;function E(U){var P=new Error(v.source+":"+w+":"+S+": "+U);if(P.reason=U,P.filename=v.source,P.line=w,P.column=S,P.source=y,!v.silent)throw P}function R(U){var P=U.exec(y);if(P){var _=P[0];return N(_),y=y.slice(_.length),P}}function H(){R(r)}function $(U){var P;for(U=U||[];P=A();)P!==!1&&U.push(P);return U}function A(){var U=I();if(!(d!=y.charAt(0)||u!=y.charAt(1))){for(var P=2;m!=y.charAt(P)&&(u!=y.charAt(P)||d!=y.charAt(P+1));)++P;if(P+=2,m===y.charAt(P-1))return E("End of comment missing");var _=y.slice(2,P-2);return S+=2,N(_),y=y.slice(P),S+=2,U({type:h,comment:_})}}function V(){var U=I(),P=R(a);if(P){if(A(),!R(s))return E("property missing ':'");var _=R(i),se=U({type:p,property:g(P[0].replace(e,m)),value:_?g(_[0].replace(e,m)):m});return R(o),se}}function T(){var U=[];$(U);for(var P;P=V();)P!==!1&&(U.push(P),$(U));return U}return H(),T()};function g(y){return y?y.replace(l,m):m}return oo}var vc;function ib(){if(vc)return ya;vc=1;var e=ya&&ya.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(ya,"__esModule",{value:!0}),ya.default=r;var t=e(sb());function r(a,s){var i=null;if(!a||typeof a!="string")return i;var o=(0,t.default)(a),l=typeof s=="function";return o.forEach(function(c){if(c.type==="declaration"){var d=c.property,u=c.value;l?s(d,u,c):u&&(i=i||{},i[d]=u)}}),i}return ya}var Xa={},kc;function ob(){if(kc)return Xa;kc=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(d){return!d||r.test(d)||e.test(d)},o=function(d,u){return u.toUpperCase()},l=function(d,u){return"".concat(u,"-")},c=function(d,u){return u===void 0&&(u={}),i(d)?d:(d=d.toLowerCase(),u.reactCompat?d=d.replace(s,l):d=d.replace(a,l),d.replace(t,o))};return Xa.camelCase=c,Xa}var Qa,wc;function lb(){if(wc)return Qa;wc=1;var e=Qa&&Qa.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(ib()),r=ob();function a(s,i){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(l,c){l&&c&&(o[(0,r.camelCase)(l,i)]=c)}),o}return a.default=a,Qa=a,Qa}var cb=lb();const db=vs(cb),Mm=Am("end"),e0=Am("start");function Am(e){return t;function t(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function ub(e){const t=e0(e),r=Mm(e);if(t&&r)return{start:t,end:r}}function ss(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?jc(e.position):"start"in e||"end"in e?jc(e):"line"in e||"column"in e?ll(e):""}function ll(e){return Nc(e&&e.line)+":"+Nc(e&&e.column)}function jc(e){return ll(e&&e.start)+"-"+ll(e&&e.end)}function Nc(e){return e&&typeof e=="number"?e:1}class or extends Error{constructor(t,r,a){super(),typeof r=="string"&&(a=r,r=void 0);let s="",i={},o=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof a=="string"){const c=a.indexOf(":");c===-1?i.ruleId=a:(i.source=a.slice(0,c),i.ruleId=a.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=l?l.line:void 0,this.name=ss(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}or.prototype.file="";or.prototype.name="";or.prototype.reason="";or.prototype.message="";or.prototype.stack="";or.prototype.column=void 0;or.prototype.line=void 0;or.prototype.ancestors=void 0;or.prototype.cause=void 0;or.prototype.fatal=void 0;or.prototype.place=void 0;or.prototype.ruleId=void 0;or.prototype.source=void 0;const t0={}.hasOwnProperty,mb=new Map,hb=/[A-Z]/g,pb=new Set(["table","tbody","thead","tfoot","tr"]),fb=new Set(["td","th"]),Tm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gb(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=Nb(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=jb(r,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ri:Cm,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Em(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function Em(e,t,r){if(t.type==="element")return xb(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return bb(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return vb(e,t,r);if(t.type==="mdxjsEsm")return yb(e,t);if(t.type==="root")return kb(e,t,r);if(t.type==="text")return wb(e,t)}function xb(e,t,r){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=Ri,e.schema=s),e.ancestors.push(t);const i=Dm(e,t.tagName,!1),o=Sb(e,t);let l=n0(e,t);return pb.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!J1(c):!0})),Im(e,o,i,t),r0(o,l),e.ancestors.pop(),e.schema=a,e.create(t,i,o,r)}function bb(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}ps(e,t.position)}function yb(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ps(e,t.position)}function vb(e,t,r){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=Ri,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:Dm(e,t.name,!0),o=Cb(e,t),l=n0(e,t);return Im(e,o,i,t),r0(o,l),e.ancestors.pop(),e.schema=a,e.create(t,i,o,r)}function kb(e,t,r){const a={};return r0(a,n0(e,t)),e.create(t,e.Fragment,a,r)}function wb(e,t){return t.value}function Im(e,t,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=a)}function r0(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function jb(e,t,r){return a;function a(s,i,o,l){const d=Array.isArray(o.children)?r:t;return l?d(i,o,l):d(i,o)}}function Nb(e,t){return r;function r(a,s,i,o){const l=Array.isArray(i.children),c=e0(a);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Sb(e,t){const r={};let a,s;for(s in t.properties)if(s!=="children"&&t0.call(t.properties,s)){const i=Mb(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&fb.has(t.tagName)?a=l:r[o]=l}}if(a){const i=r.style||(r.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function Cb(e,t){const r={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const i=a.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else ps(e,t.position);else{const s=a.name;let i;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const l=a.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else ps(e,t.position);else i=a.value===null?!0:a.value;r[s]=i}return r}function n0(e,t){const r=[];let a=-1;const s=e.passKeys?new Map:mb;for(;++a<t.children.length;){const i=t.children[a];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;o=c+"-"+d,s.set(c,d+1)}}const l=Em(e,i,o);l!==void 0&&r.push(l)}return r}function Mb(e,t,r){const a=Sm(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?W1(r):ab(r)),a.property==="style"){let s=typeof r=="object"?r:Ab(e,String(r));return e.stylePropertyNameCase==="css"&&(s=Tb(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?Z1[a.property]||a.property:a.attribute,r]}}function Ab(e,t){try{return db(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,s=new or("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=Tm+"#cannot-parse-style-attribute",s}}function Dm(e,t,r){let a;if(!r)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=pc(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}a=o}else a=pc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return t0.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);ps(e)}function ps(e,t){const r=new or("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Tm+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Tb(e){const t={};let r;for(r in e)t0.call(e,r)&&(t[Eb(r)]=e[r]);return t}function Eb(e){let t=e.replace(hb,Ib);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Ib(e){return"-"+e.toLowerCase()}const lo={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"]},Db={};function a0(e,t){const r=Db,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return zm(e,a,s)}function zm(e,t,r){if(zb(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Sc(e.children,t,r)}return Array.isArray(e)?Sc(e,t,r):""}function Sc(e,t,r){const a=[];let s=-1;for(;++s<e.length;)a[s]=zm(e[s],t,r);return a.join("")}function zb(e){return!!(e&&typeof e=="object")}const Cc=document.createElement("i");function s0(e){const t="&"+e+";";Cc.innerHTML=t;const r=Cc.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Er(e,t,r,a){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,r=r>0?r:0,a.length<1e4)o=Array.from(a),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);i<a.length;)o=a.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Lr(e,t){return e.length>0?(Er(e,e.length,0,t),e):t}const Mc={}.hasOwnProperty;function Lm(e){const t={};let r=-1;for(;++r<e.length;)Lb(t,e[r]);return t}function Lb(e,t){let r;for(r in t){const s=(Mc.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];let o;if(i)for(o in i){Mc.call(s,o)||(s[o]=[]);const l=i[o];Pb(s[o],Array.isArray(l)?l:l?[l]:[])}}}function Pb(e,t){let r=-1;const a=[];for(;++r<t.length;)(t[r].add==="after"?e:a).push(t[r]);Er(e,0,0,a)}function Pm(e,t){const r=Number.parseInt(e,t);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 Yr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ur=Vn(/[A-Za-z]/),ir=Vn(/[\dA-Za-z]/),Rb=Vn(/[#-'*+\--9=?A-Z^-~]/);function bi(e){return e!==null&&(e<32||e===127)}const cl=Vn(/\d/),Fb=Vn(/[\dA-Fa-f]/),Bb=Vn(/[!-/:-@[-`{-~]/);function We(e){return e!==null&&e<-2}function Et(e){return e!==null&&(e<0||e===32)}function xt(e){return e===-2||e===-1||e===32}const Fi=Vn(new RegExp("\\p{P}|\\p{S}","u")),da=Vn(/\s/);function Vn(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function _a(e){const t=[];let r=-1,a=0,s=0;for(;++r<e.length;){const i=e.charCodeAt(r);let o="";if(i===37&&ir(e.charCodeAt(r+1))&&ir(e.charCodeAt(r+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(r+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(a,r),encodeURIComponent(o)),a=r+s+1,o=""),s&&(r+=s,s=0)}return t.join("")+e.slice(a)}function pt(e,t,r,a){const s=a?a-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return xt(c)?(e.enter(r),l(c)):t(c)}function l(c){return xt(c)&&i++<s?(e.consume(c),l):(e.exit(r),t(c))}}const Ob={tokenize:$b};function $b(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let r;return t;function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),pt(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return We(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const _b={tokenize:qb},Ac={tokenize:Hb};function qb(e){const t=this,r=[];let a=0,s,i,o;return l;function l(N){if(a<r.length){const I=r[a];return t.containerState=I[1],e.attempt(I[0].continuation,c,d)(N)}return d(N)}function c(N){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&S();const I=t.events.length;let F=I,E;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){E=t.events[F][1].end;break}w(a);let R=I;for(;R<t.events.length;)t.events[R][1].end={...E},R++;return Er(t.events,F+1,0,t.events.slice(I)),t.events.length=R,d(N)}return l(N)}function d(N){if(a===r.length){if(!s)return h(N);if(s.currentConstruct&&s.currentConstruct.concrete)return g(N);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ac,u,m)(N)}function u(N){return s&&S(),w(a),h(N)}function m(N){return t.parser.lazy[t.now().line]=a!==r.length,o=t.now().offset,g(N)}function h(N){return t.containerState={},e.attempt(Ac,p,g)(N)}function p(N){return a++,r.push([t.currentConstruct,t.containerState]),h(N)}function g(N){if(N===null){s&&S(),w(0),e.consume(N);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(N)}function y(N){if(N===null){v(e.exit("chunkFlow"),!0),w(0),e.consume(N);return}return We(N)?(e.consume(N),v(e.exit("chunkFlow")),a=0,t.interrupt=void 0,l):(e.consume(N),y)}function v(N,I){const F=t.sliceStream(N);if(I&&F.push(null),N.previous=i,i&&(i.next=N),i=N,s.defineSkip(N.start),s.write(F),t.parser.lazy[N.start.line]){let E=s.events.length;for(;E--;)if(s.events[E][1].start.offset<o&&(!s.events[E][1].end||s.events[E][1].end.offset>o))return;const R=t.events.length;let H=R,$,A;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if($){A=t.events[H][1].end;break}$=!0}for(w(a),E=R;E<t.events.length;)t.events[E][1].end={...A},E++;Er(t.events,H+1,0,t.events.slice(R)),t.events.length=E}}function w(N){let I=r.length;for(;I-- >N;){const F=r[I];t.containerState=F[1],F[0].exit.call(t,e)}r.length=N}function S(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Hb(e,t,r){return pt(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Da(e){if(e===null||Et(e)||da(e))return 1;if(Fi(e))return 2}function Bi(e,t,r){const a=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!a.includes(i)&&(t=i(t,r),a.push(i))}return t}const dl={name:"attention",resolveAll:Wb,tokenize:Ub};function Wb(e,t){let r=-1,a,s,i,o,l,c,d,u;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;c=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const m={...e[a][1].end},h={...e[r][1].start};Tc(m,-c),Tc(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...e[a][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[a][1].end={...o.start},e[r][1].start={...l.end},d=[],e[a][1].end.offset-e[a][1].start.offset&&(d=Lr(d,[["enter",e[a][1],t],["exit",e[a][1],t]])),d=Lr(d,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),d=Lr(d,Bi(t.parser.constructs.insideSpan.null,e.slice(a+1,r),t)),d=Lr(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[r][1].end.offset-e[r][1].start.offset?(u=2,d=Lr(d,[["enter",e[r][1],t],["exit",e[r][1],t]])):u=0,Er(e,a-1,r-a+3,d),r=a+d.length-u-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Ub(e,t){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,s=Da(a);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),u=Da(c),m=!u||u===2&&s||r.includes(c),h=!s||s===2&&u||r.includes(a);return d._open=!!(i===42?m:m&&(s||!h)),d._close=!!(i===42?h:h&&(u||!m)),t(c)}}function Tc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Vb={name:"autolink",tokenize:Gb};function Gb(e,t,r){let a=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return ur(p)?(e.consume(p),o):p===64?r(p):d(p)}function o(p){return p===43||p===45||p===46||ir(p)?(a=1,l(p)):d(p)}function l(p){return p===58?(e.consume(p),a=0,c):(p===43||p===45||p===46||ir(p))&&a++<32?(e.consume(p),l):(a=0,d(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||bi(p)?r(p):(e.consume(p),c)}function d(p){return p===64?(e.consume(p),u):Rb(p)?(e.consume(p),d):r(p)}function u(p){return ir(p)?m(p):r(p)}function m(p){return p===46?(e.consume(p),a=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||ir(p))&&a++<63){const g=p===45?h:m;return e.consume(p),g}return r(p)}}const As={partial:!0,tokenize:Kb};function Kb(e,t,r){return a;function a(i){return xt(i)?pt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||We(i)?t(i):r(i)}}const Rm={continuation:{tokenize:Yb},exit:Xb,name:"blockQuote",tokenize:Jb};function Jb(e,t,r){const a=this;return s;function s(o){if(o===62){const l=a.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return r(o)}function i(o){return xt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Yb(e,t,r){const a=this;return s;function s(o){return xt(o)?pt(e,i,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Rm,t,r)(o)}}function Xb(e){e.exit("blockQuote")}const Fm={name:"characterEscape",tokenize:Qb};function Qb(e,t,r){return a;function a(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return Bb(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(i)}}const Bm={name:"characterReference",tokenize:Zb};function Zb(e,t,r){const a=this;let s=0,i,o;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),c}function c(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,o=ir,u(m))}function d(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Fb,u):(e.enter("characterReferenceValue"),i=7,o=cl,u(m))}function u(m){if(m===59&&s){const h=e.exit("characterReferenceValue");return o===ir&&!s0(a.sliceSerialize(h))?r(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&s++<i?(e.consume(m),u):r(m)}}const Ec={partial:!0,tokenize:t2},Ic={concrete:!0,name:"codeFenced",tokenize:e2};function e2(e,t,r){const a=this,s={partial:!0,tokenize:F};let i=0,o=0,l;return c;function c(E){return d(E)}function d(E){const R=a.events[a.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===l?(o++,e.consume(E),u):o<3?r(E):(e.exit("codeFencedFenceSequence"),xt(E)?pt(e,m,"whitespace")(E):m(E))}function m(E){return E===null||We(E)?(e.exit("codeFencedFence"),a.interrupt?t(E):e.check(Ec,y,I)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||We(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(E)):xt(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pt(e,p,"whitespace")(E)):E===96&&E===l?r(E):(e.consume(E),h)}function p(E){return E===null||We(E)?m(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||We(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(E)):E===96&&E===l?r(E):(e.consume(E),g)}function y(E){return e.attempt(s,I,v)(E)}function v(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),w}function w(E){return i>0&&xt(E)?pt(e,S,"linePrefix",i+1)(E):S(E)}function S(E){return E===null||We(E)?e.check(Ec,y,I)(E):(e.enter("codeFlowValue"),N(E))}function N(E){return E===null||We(E)?(e.exit("codeFlowValue"),S(E)):(e.consume(E),N)}function I(E){return e.exit("codeFenced"),t(E)}function F(E,R,H){let $=0;return A;function A(_){return E.enter("lineEnding"),E.consume(_),E.exit("lineEnding"),V}function V(_){return E.enter("codeFencedFence"),xt(_)?pt(E,T,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):T(_)}function T(_){return _===l?(E.enter("codeFencedFenceSequence"),U(_)):H(_)}function U(_){return _===l?($++,E.consume(_),U):$>=o?(E.exit("codeFencedFenceSequence"),xt(_)?pt(E,P,"whitespace")(_):P(_)):H(_)}function P(_){return _===null||We(_)?(E.exit("codeFencedFence"),R(_)):H(_)}}}function t2(e,t,r){const a=this;return s;function s(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return a.parser.lazy[a.now().line]?r(o):t(o)}}const co={name:"codeIndented",tokenize:n2},r2={partial:!0,tokenize:a2};function n2(e,t,r){const a=this;return s;function s(d){return e.enter("codeIndented"),pt(e,i,"linePrefix",5)(d)}function i(d){const u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(d):r(d)}function o(d){return d===null?c(d):We(d)?e.attempt(r2,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||We(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function a2(e,t,r){const a=this;return s;function s(o){return a.parser.lazy[a.now().line]?r(o):We(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):pt(e,i,"linePrefix",5)(o)}function i(o){const l=a.events[a.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):We(o)?s(o):r(o)}}const s2={name:"codeText",previous:o2,resolve:i2,tokenize:l2};function i2(e){let t=e.length-4,r=3,a,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=r;++a<t;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(a=r-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function o2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function l2(e,t,r){let a=0,s,i;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),a++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?r(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(i=e.enter("codeTextSequence"),s=0,u(m)):We(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||We(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),d)}function u(m){return m===96?(e.consume(m),s++,u):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",d(m))}}class c2{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,r,a){const s=r||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&Za(this.left,a),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Za(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Za(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Za(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Za(this.left,r.reverse())}}}function Za(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function Om(e){const t={};let r=-1,a,s,i,o,l,c,d;const u=new c2(e);for(;++r<u.length;){for(;r in t;)r=t[r];if(a=u.get(r),r&&a[1].type==="chunkFlow"&&u.get(r-1)[1].type==="listItemPrefix"&&(c=a[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,d2(u,r)),r=t[r],d=!0);else if(a[1]._container){for(i=r,s=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(a[1].end={...u.get(s)[1].start},l=u.slice(s,r),l.unshift(a),u.splice(s,r-s+1,l))}}return Er(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function d2(e,t){const r=e.get(t)[1],a=e.get(t)[2];let s=t-1;const i=[];let o=r._tokenizer;o||(o=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let u,m,h=-1,p=r,g=0,y=0;const v=[y];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(u=a.sliceStream(p),p.next||u.push(null),m&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=r;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(y=h+1,v.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):v.pop(),h=v.length;h--;){const w=l.slice(v[h],v[h+1]),S=i.pop();c.push([S,S+w.length-1]),e.splice(S,2,w)}for(c.reverse(),h=-1;++h<c.length;)d[g+c[h][0]]=g+c[h][1],g+=c[h][1]-c[h][0]-1;return d}const u2={resolve:h2,tokenize:p2},m2={partial:!0,tokenize:f2};function h2(e){return Om(e),e}function p2(e,t){let r;return a;function a(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):We(l)?e.check(m2,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function f2(e,t,r){const a=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),pt(e,i,"linePrefix")}function i(o){if(o===null||We(o))return r(o);const l=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(a.parser.constructs.flow,r,t)(o)}}function $m(e,t,r,a,s,i,o,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return m;function m(w){return w===60?(e.enter(a),e.enter(s),e.enter(i),e.consume(w),e.exit(i),h):w===null||w===32||w===41||bi(w)?r(w):(e.enter(a),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),y(w))}function h(w){return w===62?(e.enter(i),e.consume(w),e.exit(i),e.exit(s),e.exit(a),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===62?(e.exit("chunkString"),e.exit(l),h(w)):w===null||w===60||We(w)?r(w):(e.consume(w),w===92?g:p)}function g(w){return w===60||w===62||w===92?(e.consume(w),p):p(w)}function y(w){return!u&&(w===null||w===41||Et(w))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(a),t(w)):u<d&&w===40?(e.consume(w),u++,y):w===41?(e.consume(w),u--,y):w===null||w===32||w===40||bi(w)?r(w):(e.consume(w),w===92?v:y)}function v(w){return w===40||w===41||w===92?(e.consume(w),y):y(w)}}function _m(e,t,r,a,s,i){const o=this;let l=0,c;return d;function d(p){return e.enter(a),e.enter(s),e.consume(p),e.exit(s),e.enter(i),u}function u(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(a),t):We(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||We(p)||l++>999?(e.exit("chunkString"),u(p)):(e.consume(p),c||(c=!xt(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,m):m(p)}}function qm(e,t,r,a,s,i){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(a),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,c):r(h)}function c(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(a),t):(e.enter(i),d(h))}function d(h){return h===o?(e.exit(i),c(o)):h===null?r(h):We(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),pt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||We(h)?(e.exit("chunkString"),d(h)):(e.consume(h),h===92?m:u)}function m(h){return h===o||h===92?(e.consume(h),u):u(h)}}function is(e,t){let r;return a;function a(s){return We(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,a):xt(s)?pt(e,a,r?"linePrefix":"lineSuffix")(s):t(s)}}const g2={name:"definition",tokenize:b2},x2={partial:!0,tokenize:y2};function b2(e,t,r){const a=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return _m.call(a,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=Yr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):r(p)}function c(p){return Et(p)?is(e,d)(p):d(p)}function d(p){return $m(e,u,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(x2,m,m)(p)}function m(p){return xt(p)?pt(e,h,"whitespace")(p):h(p)}function h(p){return p===null||We(p)?(e.exit("definition"),a.parser.defined.push(s),t(p)):r(p)}}function y2(e,t,r){return a;function a(l){return Et(l)?is(e,s)(l):r(l)}function s(l){return qm(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return xt(l)?pt(e,o,"whitespace")(l):o(l)}function o(l){return l===null||We(l)?t(l):r(l)}}const v2={name:"hardBreakEscape",tokenize:k2};function k2(e,t,r){return a;function a(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return We(i)?(e.exit("hardBreakEscape"),t(i)):r(i)}}const w2={name:"headingAtx",resolve:j2,tokenize:N2};function j2(e,t){let r=e.length-2,a=3,s,i;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},i={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},Er(e,a,r-a+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function N2(e,t,r){let a=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&a++<6?(e.consume(u),o):u===null||Et(u)?(e.exit("atxHeadingSequence"),l(u)):r(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||We(u)?(e.exit("atxHeading"),t(u)):xt(u)?pt(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||Et(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const S2=["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"],Dc=["pre","script","style","textarea"],C2={concrete:!0,name:"htmlFlow",resolveTo:T2,tokenize:E2},M2={partial:!0,tokenize:D2},A2={partial:!0,tokenize:I2};function T2(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function E2(e,t,r){const a=this;let s,i,o,l,c;return d;function d(M){return u(M)}function u(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),i=!0,y):M===63?(e.consume(M),s=3,a.interrupt?t:j):ur(M)?(e.consume(M),o=String.fromCharCode(M),v):r(M)}function h(M){return M===45?(e.consume(M),s=2,p):M===91?(e.consume(M),s=5,l=0,g):ur(M)?(e.consume(M),s=4,a.interrupt?t:j):r(M)}function p(M){return M===45?(e.consume(M),a.interrupt?t:j):r(M)}function g(M){const ie="CDATA[";return M===ie.charCodeAt(l++)?(e.consume(M),l===ie.length?a.interrupt?t:T:g):r(M)}function y(M){return ur(M)?(e.consume(M),o=String.fromCharCode(M),v):r(M)}function v(M){if(M===null||M===47||M===62||Et(M)){const ie=M===47,Me=o.toLowerCase();return!ie&&!i&&Dc.includes(Me)?(s=1,a.interrupt?t(M):T(M)):S2.includes(o.toLowerCase())?(s=6,ie?(e.consume(M),w):a.interrupt?t(M):T(M)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(M):i?S(M):N(M))}return M===45||ir(M)?(e.consume(M),o+=String.fromCharCode(M),v):r(M)}function w(M){return M===62?(e.consume(M),a.interrupt?t:T):r(M)}function S(M){return xt(M)?(e.consume(M),S):A(M)}function N(M){return M===47?(e.consume(M),A):M===58||M===95||ur(M)?(e.consume(M),I):xt(M)?(e.consume(M),N):A(M)}function I(M){return M===45||M===46||M===58||M===95||ir(M)?(e.consume(M),I):F(M)}function F(M){return M===61?(e.consume(M),E):xt(M)?(e.consume(M),F):N(M)}function E(M){return M===null||M===60||M===61||M===62||M===96?r(M):M===34||M===39?(e.consume(M),c=M,R):xt(M)?(e.consume(M),E):H(M)}function R(M){return M===c?(e.consume(M),c=null,$):M===null||We(M)?r(M):(e.consume(M),R)}function H(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Et(M)?F(M):(e.consume(M),H)}function $(M){return M===47||M===62||xt(M)?N(M):r(M)}function A(M){return M===62?(e.consume(M),V):r(M)}function V(M){return M===null||We(M)?T(M):xt(M)?(e.consume(M),V):r(M)}function T(M){return M===45&&s===2?(e.consume(M),se):M===60&&s===1?(e.consume(M),de):M===62&&s===4?(e.consume(M),ne):M===63&&s===3?(e.consume(M),j):M===93&&s===5?(e.consume(M),X):We(M)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(M2,ue,U)(M)):M===null||We(M)?(e.exit("htmlFlowData"),U(M)):(e.consume(M),T)}function U(M){return e.check(A2,P,ue)(M)}function P(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),_}function _(M){return M===null||We(M)?U(M):(e.enter("htmlFlowData"),T(M))}function se(M){return M===45?(e.consume(M),j):T(M)}function de(M){return M===47?(e.consume(M),o="",J):T(M)}function J(M){if(M===62){const ie=o.toLowerCase();return Dc.includes(ie)?(e.consume(M),ne):T(M)}return ur(M)&&o.length<8?(e.consume(M),o+=String.fromCharCode(M),J):T(M)}function X(M){return M===93?(e.consume(M),j):T(M)}function j(M){return M===62?(e.consume(M),ne):M===45&&s===2?(e.consume(M),j):T(M)}function ne(M){return M===null||We(M)?(e.exit("htmlFlowData"),ue(M)):(e.consume(M),ne)}function ue(M){return e.exit("htmlFlow"),t(M)}}function I2(e,t,r){const a=this;return s;function s(o){return We(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):r(o)}function i(o){return a.parser.lazy[a.now().line]?r(o):t(o)}}function D2(e,t,r){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(As,t,r)}}const z2={name:"htmlText",tokenize:L2};function L2(e,t,r){const a=this;let s,i,o;return l;function l(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),c}function c(j){return j===33?(e.consume(j),d):j===47?(e.consume(j),F):j===63?(e.consume(j),N):ur(j)?(e.consume(j),H):r(j)}function d(j){return j===45?(e.consume(j),u):j===91?(e.consume(j),i=0,g):ur(j)?(e.consume(j),S):r(j)}function u(j){return j===45?(e.consume(j),p):r(j)}function m(j){return j===null?r(j):j===45?(e.consume(j),h):We(j)?(o=m,de(j)):(e.consume(j),m)}function h(j){return j===45?(e.consume(j),p):m(j)}function p(j){return j===62?se(j):j===45?h(j):m(j)}function g(j){const ne="CDATA[";return j===ne.charCodeAt(i++)?(e.consume(j),i===ne.length?y:g):r(j)}function y(j){return j===null?r(j):j===93?(e.consume(j),v):We(j)?(o=y,de(j)):(e.consume(j),y)}function v(j){return j===93?(e.consume(j),w):y(j)}function w(j){return j===62?se(j):j===93?(e.consume(j),w):y(j)}function S(j){return j===null||j===62?se(j):We(j)?(o=S,de(j)):(e.consume(j),S)}function N(j){return j===null?r(j):j===63?(e.consume(j),I):We(j)?(o=N,de(j)):(e.consume(j),N)}function I(j){return j===62?se(j):N(j)}function F(j){return ur(j)?(e.consume(j),E):r(j)}function E(j){return j===45||ir(j)?(e.consume(j),E):R(j)}function R(j){return We(j)?(o=R,de(j)):xt(j)?(e.consume(j),R):se(j)}function H(j){return j===45||ir(j)?(e.consume(j),H):j===47||j===62||Et(j)?$(j):r(j)}function $(j){return j===47?(e.consume(j),se):j===58||j===95||ur(j)?(e.consume(j),A):We(j)?(o=$,de(j)):xt(j)?(e.consume(j),$):se(j)}function A(j){return j===45||j===46||j===58||j===95||ir(j)?(e.consume(j),A):V(j)}function V(j){return j===61?(e.consume(j),T):We(j)?(o=V,de(j)):xt(j)?(e.consume(j),V):$(j)}function T(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),s=j,U):We(j)?(o=T,de(j)):xt(j)?(e.consume(j),T):(e.consume(j),P)}function U(j){return j===s?(e.consume(j),s=void 0,_):j===null?r(j):We(j)?(o=U,de(j)):(e.consume(j),U)}function P(j){return j===null||j===34||j===39||j===60||j===61||j===96?r(j):j===47||j===62||Et(j)?$(j):(e.consume(j),P)}function _(j){return j===47||j===62||Et(j)?$(j):r(j)}function se(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),t):r(j)}function de(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),J}function J(j){return xt(j)?pt(e,X,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):X(j)}function X(j){return e.enter("htmlTextData"),o(j)}}const i0={name:"labelEnd",resolveAll:B2,resolveTo:O2,tokenize:$2},P2={tokenize:_2},R2={tokenize:q2},F2={tokenize:H2};function B2(e){let t=-1;const r=[];for(;++t<e.length;){const a=e[t][1];if(r.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==r.length&&Er(e,0,e.length,r),e}function O2(e,t){let r=e.length,a=0,s,i,o,l;for(;r--;)if(s=e[r][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=r,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(o=r);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+a+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=Lr(l,e.slice(i+1,i+a+3)),l=Lr(l,[["enter",u,t]]),l=Lr(l,Bi(t.parser.constructs.insideSpan.null,e.slice(i+a+4,o-3),t)),l=Lr(l,[["exit",u,t],e[o-2],e[o-1],["exit",d,t]]),l=Lr(l,e.slice(o+1)),l=Lr(l,[["exit",c,t]]),Er(e,i,e.length,l),e}function $2(e,t,r){const a=this;let s=a.events.length,i,o;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){i=a.events[s][1];break}return l;function l(h){return i?i._inactive?m(h):(o=a.parser.defined.includes(Yr(a.sliceSerialize({start:i.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):r(h)}function c(h){return h===40?e.attempt(P2,u,o?u:m)(h):h===91?e.attempt(R2,u,o?d:m)(h):o?u(h):m(h)}function d(h){return e.attempt(F2,u,m)(h)}function u(h){return t(h)}function m(h){return i._balanced=!0,r(h)}}function _2(e,t,r){return a;function a(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return Et(m)?is(e,i)(m):i(m)}function i(m){return m===41?u(m):$m(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return Et(m)?is(e,c)(m):u(m)}function l(m){return r(m)}function c(m){return m===34||m===39||m===40?qm(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):u(m)}function d(m){return Et(m)?is(e,u)(m):u(m)}function u(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):r(m)}}function q2(e,t,r){const a=this;return s;function s(l){return _m.call(a,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return a.parser.defined.includes(Yr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function H2(e,t,r){return a;function a(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):r(i)}}const W2={name:"labelStartImage",resolveAll:i0.resolveAll,tokenize:U2};function U2(e,t,r){const a=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(l):t(l)}}const V2={name:"labelStartLink",resolveAll:i0.resolveAll,tokenize:G2};function G2(e,t,r){const a=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(o):t(o)}}const uo={name:"lineEnding",tokenize:K2};function K2(e,t){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),pt(e,t,"linePrefix")}}const di={name:"thematicBreak",tokenize:J2};function J2(e,t,r){let a=0,s;return i;function i(d){return e.enter("thematicBreak"),o(d)}function o(d){return s=d,l(d)}function l(d){return d===s?(e.enter("thematicBreakSequence"),c(d)):a>=3&&(d===null||We(d))?(e.exit("thematicBreak"),t(d)):r(d)}function c(d){return d===s?(e.consume(d),a++,c):(e.exit("thematicBreakSequence"),xt(d)?pt(e,l,"whitespace")(d):l(d))}}const xr={continuation:{tokenize:Z2},exit:t4,name:"list",tokenize:Q2},Y2={partial:!0,tokenize:r4},X2={partial:!0,tokenize:e4};function Q2(e,t,r){const a=this,s=a.events[a.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const g=a.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!a.containerState.marker||p===a.containerState.marker:cl(p)){if(a.containerState.type||(a.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(di,r,d)(p):d(p);if(!a.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return r(p)}function c(p){return cl(p)&&++o<10?(e.consume(p),c):(!a.interrupt||o<2)&&(a.containerState.marker?p===a.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),d(p)):r(p)}function d(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||p,e.check(As,a.interrupt?r:u,e.attempt(Y2,h,m))}function u(p){return a.containerState.initialBlankLine=!0,i++,h(p)}function m(p){return xt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):r(p)}function h(p){return a.containerState.size=i+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Z2(e,t,r){const a=this;return a.containerState._closeFlow=void 0,e.check(As,s,i);function s(l){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,pt(e,t,"listItemIndent",a.containerState.size+1)(l)}function i(l){return a.containerState.furtherBlankLines||!xt(l)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,o(l)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(X2,t,o)(l))}function o(l){return a.containerState._closeFlow=!0,a.interrupt=void 0,pt(e,e.attempt(xr,t,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function e4(e,t,r){const a=this;return pt(e,s,"listItemIndent",a.containerState.size+1);function s(i){const o=a.events[a.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===a.containerState.size?t(i):r(i)}}function t4(e){e.exit(this.containerState.type)}function r4(e,t,r){const a=this;return pt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=a.events[a.events.length-1];return!xt(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):r(i)}}const zc={name:"setextUnderline",resolveTo:n4,tokenize:a4};function n4(e,t){let r=e.length,a,s,i;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!i&&e[r][1].type==="definition"&&(i=r);const o={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[a][1],t]),e[a][1].end={...e[i][1].end}):e[a][1]=o,e.push(["exit",o,t]),e}function a4(e,t,r){const a=this;let s;return i;function i(d){let u=a.events.length,m;for(;u--;)if(a.events[u][1].type!=="lineEnding"&&a.events[u][1].type!=="linePrefix"&&a.events[u][1].type!=="content"){m=a.events[u][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||m)?(e.enter("setextHeadingLine"),s=d,o(d)):r(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),xt(d)?pt(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||We(d)?(e.exit("setextHeadingLine"),t(d)):r(d)}}const s4={tokenize:i4};function i4(e){const t=this,r=e.attempt(As,a,e.attempt(this.parser.constructs.flowInitial,s,pt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(u2,s)),"linePrefix")));return r;function a(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const o4={resolveAll:Wm()},l4=Hm("string"),c4=Hm("text");function Hm(e){return{resolveAll:Wm(e==="text"?d4:void 0),tokenize:t};function t(r){const a=this,s=this.parser.constructs[e],i=r.attempt(s,o,l);return o;function o(u){return d(u)?i(u):l(u)}function l(u){if(u===null){r.consume(u);return}return r.enter("data"),r.consume(u),c}function c(u){return d(u)?(r.exit("data"),i(u)):(r.consume(u),c)}function d(u){if(u===null)return!0;const m=s[u];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(a,a.previous))return!0}return!1}}}function Wm(e){return t;function t(r,a){let s=-1,i;for(;++s<=r.length;)i===void 0?r[s]&&r[s][1].type==="data"&&(i=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==i+2&&(r[i][1].end=r[s-1][1].end,r.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(r,a):r}}function d4(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],s=t.sliceStream(a);let i=s.length,o=-1,l=0,c;for(;i--;){const d=s[i];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const d={type:r===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:a.start._bufferIndex+o,_index:a.start._index+i,line:a.end.line,column:a.end.column-l,offset:a.end.offset-l},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(e.splice(r,0,["enter",d,t],["exit",d,t]),r+=2)}r++}return e}const u4={42:xr,43:xr,45:xr,48:xr,49:xr,50:xr,51:xr,52:xr,53:xr,54:xr,55:xr,56:xr,57:xr,62:Rm},m4={91:g2},h4={[-2]:co,[-1]:co,32:co},p4={35:w2,42:di,45:[zc,di],60:C2,61:zc,95:di,96:Ic,126:Ic},f4={38:Bm,92:Fm},g4={[-5]:uo,[-4]:uo,[-3]:uo,33:W2,38:Bm,42:dl,60:[Vb,z2],91:V2,92:[v2,Fm],93:i0,95:dl,96:s2},x4={null:[dl,o4]},b4={null:[42,95]},y4={null:[]},v4=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:b4,contentInitial:m4,disable:y4,document:u4,flow:p4,flowInitial:h4,insideSpan:x4,string:f4,text:g4},Symbol.toStringTag,{value:"Module"}));function k4(e,t,r){let a={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:R(F),check:R(E),consume:S,enter:N,exit:I,interrupt:R(E,{interrupt:!0})},d={code:null,containerState:{},defineSkip:y,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:m};let u=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function m(V){return o=Lr(o,V),v(),o[o.length-1]!==null?[]:(H(t,0),d.events=Bi(i,d.events,d),d.events)}function h(V,T){return j4(p(V),T)}function p(V){return w4(o,V)}function g(){const{_bufferIndex:V,_index:T,line:U,column:P,offset:_}=a;return{_bufferIndex:V,_index:T,line:U,column:P,offset:_}}function y(V){s[V.line]=V.column,A()}function v(){let V;for(;a._index<o.length;){const T=o[a._index];if(typeof T=="string")for(V=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===V&&a._bufferIndex<T.length;)w(T.charCodeAt(a._bufferIndex));else w(T)}}function w(V){u=u(V)}function S(V){We(V)?(a.line++,a.column=1,a.offset+=V===-3?2:1,A()):V!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===o[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=V}function N(V,T){const U=T||{};return U.type=V,U.start=g(),d.events.push(["enter",U,d]),l.push(U),U}function I(V){const T=l.pop();return T.end=g(),d.events.push(["exit",T,d]),T}function F(V,T){H(V,T.from)}function E(V,T){T.restore()}function R(V,T){return U;function U(P,_,se){let de,J,X,j;return Array.isArray(P)?ue(P):"tokenize"in P?ue([P]):ne(P);function ne(Se){return me;function me(_e){const ce=_e!==null&&Se[_e],ve=_e!==null&&Se.null,He=[...Array.isArray(ce)?ce:ce?[ce]:[],...Array.isArray(ve)?ve:ve?[ve]:[]];return ue(He)(_e)}}function ue(Se){return de=Se,J=0,Se.length===0?se:M(Se[J])}function M(Se){return me;function me(_e){return j=$(),X=Se,Se.partial||(d.currentConstruct=Se),Se.name&&d.parser.constructs.disable.null.includes(Se.name)?Me():Se.tokenize.call(T?Object.assign(Object.create(d),T):d,c,ie,Me)(_e)}}function ie(Se){return V(X,j),_}function Me(Se){return j.restore(),++J<de.length?M(de[J]):se}}}function H(V,T){V.resolveAll&&!i.includes(V)&&i.push(V),V.resolve&&Er(d.events,T,d.events.length-T,V.resolve(d.events.slice(T),d)),V.resolveTo&&(d.events=V.resolveTo(d.events,d))}function $(){const V=g(),T=d.previous,U=d.currentConstruct,P=d.events.length,_=Array.from(l);return{from:P,restore:se};function se(){a=V,d.previous=T,d.currentConstruct=U,d.events.length=P,l=_,A()}}function A(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function w4(e,t){const r=t.start._index,a=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(r===s)o=[e[r].slice(a,i)];else{if(o=e.slice(r,s),a>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(a):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function j4(e,t){let r=-1;const a=[];let s;for(;++r<e.length;){const i=e[r];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
398
+ `;break}case-3:{o=`\r
399
+ `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,a.push(o)}return a.join("")}function N4(e){const a={constructs:Lm([v4,...(e||{}).extensions||[]]),content:s(Ob),defined:[],document:s(_b),flow:s(s4),lazy:{},string:s(l4),text:s(c4)};return a;function s(i){return o;function o(l){return k4(a,i,l)}}}function S4(e){for(;!Om(e););return e}const Lc=/[\0\t\n\r]/g;function C4(){let e=1,t="",r=!0,a;return s;function s(i,o,l){const c=[];let d,u,m,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),m=0,t="",r&&(i.charCodeAt(0)===65279&&m++,r=void 0);m<i.length;){if(Lc.lastIndex=m,d=Lc.exec(i),h=d&&d.index!==void 0?d.index:i.length,p=i.charCodeAt(h),!d){t=i.slice(m);break}if(p===10&&m===h&&a)c.push(-3),a=void 0;else switch(a&&(c.push(-5),a=void 0),m<h&&(c.push(i.slice(m,h)),e+=h-m),p){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:a=!0,e=1}m=h+1}return l&&(a&&c.push(-5),t&&c.push(t),c.push(null)),c}}const M4=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function A4(e){return e.replace(M4,T4)}function T4(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),i=s===120||s===88;return Pm(r.slice(i?2:1),i?16:10)}return s0(r)||e}const Um={}.hasOwnProperty;function E4(e,t,r){return typeof t!="string"&&(r=t,t=void 0),I4(r)(S4(N4(r).document().write(C4()(e,t,!0))))}function I4(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ue),autolinkProtocol:$,autolinkEmail:$,atxHeading:i(yt),blockQuote:i(ve),characterEscape:$,characterReference:$,codeFenced:i(He),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(He,o),codeText:i(Le,o),codeTextData:$,data:$,codeFlowValue:$,definition:i(rt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ye),hardBreakEscape:i(mt),hardBreakTrailing:i(mt),htmlFlow:i(vt,o),htmlFlowData:$,htmlText:i(vt,o),htmlTextData:$,image:i(ft),label:o,link:i(Ue),listItem:i(kt),listItemValue:h,listOrdered:i(bt,m),listUnordered:i(bt),paragraph:i(Vt),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(yt),strong:i(Ve),thematicBreak:i(Ae)},exit:{atxHeading:c(),atxHeadingSequence:F,autolink:c(),autolinkEmail:ce,autolinkProtocol:_e,blockQuote:c(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:Me,characterReferenceMarkerNumeric:Me,characterReferenceValue:Se,characterReference:me,codeFenced:c(v),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:A,codeIndented:c(w),codeText:c(_),codeTextData:A,data:A,definition:c(),definitionDestinationString:I,definitionLabelString:S,definitionTitleString:N,emphasis:c(),hardBreakEscape:c(T),hardBreakTrailing:c(T),htmlFlow:c(U),htmlFlowData:A,htmlText:c(P),htmlTextData:A,image:c(de),label:X,labelText:J,lineEnding:V,link:c(se),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ie,resourceDestinationString:j,resourceTitleString:ne,resource:ue,setextHeading:c(H),setextHeadingLineSequence:R,setextHeadingText:E,strong:c(),thematicBreak:c()}};Vm(t,(e||{}).mdastExtensions||[]);const r={};return a;function a(q){let G={type:"root",children:[]};const be={stack:[G],tokenStack:[],config:t,enter:l,exit:d,buffer:o,resume:u,data:r},Pe=[];let st=-1;for(;++st<q.length;)if(q[st][1].type==="listOrdered"||q[st][1].type==="listUnordered")if(q[st][0]==="enter")Pe.push(st);else{const he=Pe.pop();st=s(q,he,st)}for(st=-1;++st<q.length;){const he=t[q[st][0]];Um.call(he,q[st][1].type)&&he[q[st][1].type].call(Object.assign({sliceSerialize:q[st][2].sliceSerialize},be),q[st][1])}if(be.tokenStack.length>0){const he=be.tokenStack[be.tokenStack.length-1];(he[1]||Pc).call(be,void 0,he[0])}for(G.position={start:Pn(q.length>0?q[0][1].start:{line:1,column:1,offset:0}),end:Pn(q.length>0?q[q.length-2][1].end:{line:1,column:1,offset:0})},st=-1;++st<t.transforms.length;)G=t.transforms[st](G)||G;return G}function s(q,G,be){let Pe=G-1,st=-1,he=!1,B,ee,ge,Ne;for(;++Pe<=be;){const Z=q[Pe];switch(Z[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Z[0]==="enter"?st++:st--,Ne=void 0;break}case"lineEndingBlank":{Z[0]==="enter"&&(B&&!Ne&&!st&&!ge&&(ge=Pe),Ne=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ne=void 0}if(!st&&Z[0]==="enter"&&Z[1].type==="listItemPrefix"||st===-1&&Z[0]==="exit"&&(Z[1].type==="listUnordered"||Z[1].type==="listOrdered")){if(B){let Ce=Pe;for(ee=void 0;Ce--;){const Ze=q[Ce];if(Ze[1].type==="lineEnding"||Ze[1].type==="lineEndingBlank"){if(Ze[0]==="exit")continue;ee&&(q[ee][1].type="lineEndingBlank",he=!0),Ze[1].type="lineEnding",ee=Ce}else if(!(Ze[1].type==="linePrefix"||Ze[1].type==="blockQuotePrefix"||Ze[1].type==="blockQuotePrefixWhitespace"||Ze[1].type==="blockQuoteMarker"||Ze[1].type==="listItemIndent"))break}ge&&(!ee||ge<ee)&&(B._spread=!0),B.end=Object.assign({},ee?q[ee][1].start:Z[1].end),q.splice(ee||Pe,0,["exit",B,Z[2]]),Pe++,be++}if(Z[1].type==="listItemPrefix"){const Ce={type:"listItem",_spread:!1,start:Object.assign({},Z[1].start),end:void 0};B=Ce,q.splice(Pe,0,["enter",Ce,Z[2]]),Pe++,be++,ge=void 0,Ne=!0}}}return q[G][1]._spread=he,be}function i(q,G){return be;function be(Pe){l.call(this,q(Pe),Pe),G&&G.call(this,Pe)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(q,G,be){this.stack[this.stack.length-1].children.push(q),this.stack.push(q),this.tokenStack.push([G,be||void 0]),q.position={start:Pn(G.start),end:void 0}}function c(q){return G;function G(be){q&&q.call(this,be),d.call(this,be)}}function d(q,G){const be=this.stack.pop(),Pe=this.tokenStack.pop();if(Pe)Pe[0].type!==q.type&&(G?G.call(this,q,Pe[0]):(Pe[1]||Pc).call(this,q,Pe[0]));else throw new Error("Cannot close `"+q.type+"` ("+ss({start:q.start,end:q.end})+"): it’s not open");be.position.end=Pn(q.end)}function u(){return a0(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(q){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(q),10),this.data.expectingFirstListItemValue=void 0}}function p(){const q=this.resume(),G=this.stack[this.stack.length-1];G.lang=q}function g(){const q=this.resume(),G=this.stack[this.stack.length-1];G.meta=q}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const q=this.resume(),G=this.stack[this.stack.length-1];G.value=q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const q=this.resume(),G=this.stack[this.stack.length-1];G.value=q.replace(/(\r?\n|\r)$/g,"")}function S(q){const G=this.resume(),be=this.stack[this.stack.length-1];be.label=G,be.identifier=Yr(this.sliceSerialize(q)).toLowerCase()}function N(){const q=this.resume(),G=this.stack[this.stack.length-1];G.title=q}function I(){const q=this.resume(),G=this.stack[this.stack.length-1];G.url=q}function F(q){const G=this.stack[this.stack.length-1];if(!G.depth){const be=this.sliceSerialize(q).length;G.depth=be}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function R(q){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(q).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function $(q){const be=this.stack[this.stack.length-1].children;let Pe=be[be.length-1];(!Pe||Pe.type!=="text")&&(Pe=we(),Pe.position={start:Pn(q.start),end:void 0},be.push(Pe)),this.stack.push(Pe)}function A(q){const G=this.stack.pop();G.value+=this.sliceSerialize(q),G.position.end=Pn(q.end)}function V(q){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=G.children[G.children.length-1];be.position.end=Pn(q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&($.call(this,q),A.call(this,q))}function T(){this.data.atHardBreak=!0}function U(){const q=this.resume(),G=this.stack[this.stack.length-1];G.value=q}function P(){const q=this.resume(),G=this.stack[this.stack.length-1];G.value=q}function _(){const q=this.resume(),G=this.stack[this.stack.length-1];G.value=q}function se(){const q=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";q.type+="Reference",q.referenceType=G,delete q.url,delete q.title}else delete q.identifier,delete q.label;this.data.referenceType=void 0}function de(){const q=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";q.type+="Reference",q.referenceType=G,delete q.url,delete q.title}else delete q.identifier,delete q.label;this.data.referenceType=void 0}function J(q){const G=this.sliceSerialize(q),be=this.stack[this.stack.length-2];be.label=A4(G),be.identifier=Yr(G).toLowerCase()}function X(){const q=this.stack[this.stack.length-1],G=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Pe=q.children;be.children=Pe}else be.alt=G}function j(){const q=this.resume(),G=this.stack[this.stack.length-1];G.url=q}function ne(){const q=this.resume(),G=this.stack[this.stack.length-1];G.title=q}function ue(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function ie(q){const G=this.resume(),be=this.stack[this.stack.length-1];be.label=G,be.identifier=Yr(this.sliceSerialize(q)).toLowerCase(),this.data.referenceType="full"}function Me(q){this.data.characterReferenceType=q.type}function Se(q){const G=this.sliceSerialize(q),be=this.data.characterReferenceType;let Pe;be?(Pe=Pm(G,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Pe=s0(G);const st=this.stack[this.stack.length-1];st.value+=Pe}function me(q){const G=this.stack.pop();G.position.end=Pn(q.end)}function _e(q){A.call(this,q);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(q)}function ce(q){A.call(this,q);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(q)}function ve(){return{type:"blockquote",children:[]}}function He(){return{type:"code",lang:null,meta:null,value:""}}function Le(){return{type:"inlineCode",value:""}}function rt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ye(){return{type:"emphasis",children:[]}}function yt(){return{type:"heading",depth:0,children:[]}}function mt(){return{type:"break"}}function vt(){return{type:"html",value:""}}function ft(){return{type:"image",title:null,url:"",alt:null}}function Ue(){return{type:"link",title:null,url:"",children:[]}}function bt(q){return{type:"list",ordered:q.type==="listOrdered",start:null,spread:q._spread,children:[]}}function kt(q){return{type:"listItem",spread:q._spread,checked:null,children:[]}}function Vt(){return{type:"paragraph",children:[]}}function Ve(){return{type:"strong",children:[]}}function we(){return{type:"text",value:""}}function Ae(){return{type:"thematicBreak"}}}function Pn(e){return{line:e.line,column:e.column,offset:e.offset}}function Vm(e,t){let r=-1;for(;++r<t.length;){const a=t[r];Array.isArray(a)?Vm(e,a):D4(e,a)}}function D4(e,t){let r;for(r in t)if(Um.call(t,r))switch(r){case"canContainEols":{const a=t[r];a&&e[r].push(...a);break}case"transforms":{const a=t[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=t[r];a&&Object.assign(e[r],a);break}}}function Pc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ss({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ss({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ss({start:t.start,end:t.end})+") is still open")}function z4(e){const t=this;t.parser=r;function r(a){return E4(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function L4(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function P4(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
400
+ `}]}function R4(e,t){const r=t.value?t.value+`
401
+ `:"",a={};t.lang&&(a.className=["language-"+t.lang]);let s={type:"element",tagName:"code",properties:a,children:[{type:"text",value:r}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function F4(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function B4(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function O4(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=_a(a.toLowerCase()),i=e.footnoteOrder.indexOf(a);let o,l=e.footnoteCounts.get(a);l===void 0?(l=0,e.footnoteOrder.push(a),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(a,l);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function $4(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _4(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Gm(e,t){const r=t.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=a:s.push({type:"text",value:a}),s}function q4(e,t){const r=String(t.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return Gm(e,t);const s={src:_a(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function H4(e,t){const r={src:_a(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,a),e.applyData(t,a)}function W4(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,a),e.applyData(t,a)}function U4(e,t){const r=String(t.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return Gm(e,t);const s={href:_a(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function V4(e,t){const r={href:_a(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const a={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function G4(e,t,r){const a=e.all(t),s=r?K4(r):Km(t),i={},o=[];if(typeof t.checked=="boolean"){const u=a[0];let m;u&&u.type==="element"&&u.tagName==="p"?m=u:(m={type:"element",tagName:"p",properties:{},children:[]},a.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<a.length;){const u=a[l];(s||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
402
+ `}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const c=a[a.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
403
+ `});const d={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,d),e.applyData(t,d)}function K4(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let a=-1;for(;!t&&++a<r.length;)t=Km(r[a])}return t}function Km(e){const t=e.spread;return t??e.children.length>1}function J4(e,t){const r={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++s<a.length;){const o=a[s];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 i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function Y4(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function X4(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function Q4(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Z4(e,t){const r=e.all(t),a=r.shift(),s=[];if(a){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],o),s.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=e0(t.children[1]),c=Mm(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function ey(e,t,r){const a=r?r.children:void 0,i=(a?a.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const m=t.children[c],h={},p=o?o[c]:void 0;p&&(h.align=p);let g={type:"element",tagName:i,properties:h,children:[]};m&&(g.children=e.all(m),e.patch(m,g),g=e.applyData(m,g)),d.push(g)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,u),e.applyData(t,u)}function ty(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Rc=9,Fc=32;function ry(e){const t=String(e),r=/\r?\n|\r/g;let a=r.exec(t),s=0;const i=[];for(;a;)i.push(Bc(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=r.exec(t);return i.push(Bc(t.slice(s),s>0,!1)),i.join("")}function Bc(e,t,r){let a=0,s=e.length;if(t){let i=e.codePointAt(a);for(;i===Rc||i===Fc;)a++,i=e.codePointAt(a)}if(r){let i=e.codePointAt(s-1);for(;i===Rc||i===Fc;)s--,i=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function ny(e,t){const r={type:"text",value:ry(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function ay(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const sy={blockquote:L4,break:P4,code:R4,delete:F4,emphasis:B4,footnoteReference:O4,heading:$4,html:_4,imageReference:q4,image:H4,inlineCode:W4,linkReference:U4,link:V4,listItem:G4,list:J4,paragraph:Y4,root:X4,strong:Q4,table:Z4,tableCell:ty,tableRow:ey,text:ny,thematicBreak:ay,toml:Us,yaml:Us,definition:Us,footnoteDefinition:Us};function Us(){}const Jm=-1,Oi=0,os=1,yi=2,o0=3,l0=4,c0=5,d0=6,Ym=7,Xm=8,Oc=typeof self=="object"?self:globalThis,iy=(e,t)=>{const r=(s,i)=>(e.set(i,s),s),a=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Oi:case Jm:return r(o,s);case os:{const l=r([],s);for(const c of o)l.push(a(c));return l}case yi:{const l=r({},s);for(const[c,d]of o)l[a(c)]=a(d);return l}case o0:return r(new Date(o),s);case l0:{const{source:l,flags:c}=o;return r(new RegExp(l,c),s)}case c0:{const l=r(new Map,s);for(const[c,d]of o)l.set(a(c),a(d));return l}case d0:{const l=r(new Set,s);for(const c of o)l.add(a(c));return l}case Ym:{const{name:l,message:c}=o;return r(new Oc[l](c),s)}case Xm:return r(BigInt(o),s);case"BigInt":return r(Object(BigInt(o)),s);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new Oc[i](o),s)};return a},$c=e=>iy(new Map,e)(0),va="",{toString:oy}={},{keys:ly}=Object,es=e=>{const t=typeof e;if(t!=="object"||!e)return[Oi,t];const r=oy.call(e).slice(8,-1);switch(r){case"Array":return[os,va];case"Object":return[yi,va];case"Date":return[o0,va];case"RegExp":return[l0,va];case"Map":return[c0,va];case"Set":return[d0,va];case"DataView":return[os,r]}return r.includes("Array")?[os,r]:r.includes("Error")?[Ym,r]:[yi,r]},Vs=([e,t])=>e===Oi&&(t==="function"||t==="symbol"),cy=(e,t,r,a)=>{const s=(o,l)=>{const c=a.push(o)-1;return r.set(l,c),c},i=o=>{if(r.has(o))return r.get(o);let[l,c]=es(o);switch(l){case Oi:{let u=o;switch(c){case"bigint":l=Xm,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return s([Jm],o)}return s([l,u],o)}case os:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),s([c,[...h]],o)}const u=[],m=s([l,u],o);for(const h of o)u.push(i(h));return m}case yi:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const u=[],m=s([l,u],o);for(const h of ly(o))(e||!Vs(es(o[h])))&&u.push([i(h),i(o[h])]);return m}case o0:return s([l,o.toISOString()],o);case l0:{const{source:u,flags:m}=o;return s([l,{source:u,flags:m}],o)}case c0:{const u=[],m=s([l,u],o);for(const[h,p]of o)(e||!(Vs(es(h))||Vs(es(p))))&&u.push([i(h),i(p)]);return m}case d0:{const u=[],m=s([l,u],o);for(const h of o)(e||!Vs(es(h)))&&u.push(i(h));return m}}const{message:d}=o;return s([l,{name:c,message:d}],o)};return i},_c=(e,{json:t,lossy:r}={})=>{const a=[];return cy(!(t||r),!!t,new Map,a)(e),a},vi=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?$c(_c(e,t)):structuredClone(e):(e,t)=>$c(_c(e,t));function dy(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function uy(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function my(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||dy,a=e.options.footnoteBackLabel||uy,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const u=e.all(d),m=String(d.identifier).toUpperCase(),h=_a(m.toLowerCase());let p=0;const g=[],y=e.footnoteCounts.get(m);for(;y!==void 0&&++p<=y;){g.length>0&&g.push({type:"text",value:" "});let S=typeof r=="string"?r:r(c,p);typeof S=="string"&&(S={type:"text",value:S}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(c,p),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const v=u[u.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const S=v.children[v.children.length-1];S&&S.type==="text"?S.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else u.push(...g);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(u,!0)};e.patch(d,w),l.push(w)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...vi(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
404
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
405
+ `}]}}const Ts=function(e){if(e==null)return gy;if(typeof e=="function")return $i(e);if(typeof e=="object")return Array.isArray(e)?hy(e):py(e);if(typeof e=="string")return fy(e);throw new Error("Expected function, string, or object as test")};function hy(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Ts(e[r]);return $i(a);function a(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function py(e){const t=e;return $i(r);function r(a){const s=a;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function fy(e){return $i(t);function t(r){return r&&r.type===e}}function $i(e){return t;function t(r,a,s){return!!(xy(r)&&e.call(this,r,typeof a=="number"?a:void 0,s||void 0))}}function gy(){return!0}function xy(e){return e!==null&&typeof e=="object"&&"type"in e}const Qm=[],by=!0,ul=!1,Zm="skip";function u0(e,t,r,a){let s;typeof t=="function"&&typeof r!="function"?(a=r,r=t):s=t;const i=Ts(s),o=a?-1:1;l(e,void 0,[])();function l(c,d,u){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const p=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=Qm,g,y,v;if((!t||i(c,d,u[u.length-1]||void 0))&&(p=yy(r(c,u)),p[0]===ul))return p;if("children"in c&&c.children){const w=c;if(w.children&&p[0]!==Zm)for(y=(a?w.children.length:-1)+o,v=u.concat(w);y>-1&&y<w.children.length;){const S=w.children[y];if(g=l(S,y,v)(),g[0]===ul)return g;y=typeof g[1]=="number"?g[1]:y+o}}return p}}}function yy(e){return Array.isArray(e)?e:typeof e=="number"?[by,e]:e==null?Qm:[e]}function m0(e,t,r,a){let s,i,o;typeof t=="function"&&typeof r!="function"?(i=void 0,o=t,s=r):(i=t,o=r,s=a),u0(e,i,l,s);function l(c,d){const u=d[d.length-1],m=u?u.children.indexOf(c):void 0;return o(c,m,u)}}const ml={}.hasOwnProperty,vy={};function ky(e,t){const r=t||vy,a=new Map,s=new Map,i=new Map,o={...sy,...r.handlers},l={all:d,applyData:jy,definitionById:a,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:r,patch:wy,wrap:Sy};return m0(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const m=u.type==="definition"?a:s,h=String(u.identifier).toUpperCase();m.has(h)||m.set(h,u)}}),l;function c(u,m){const h=u.type,p=l.handlers[h];if(ml.call(l.handlers,h)&&p)return p(l,u,m);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in u){const{children:y,...v}=u,w=vi(v);return w.children=l.all(u),w}return vi(u)}return(l.options.unknownHandler||Ny)(l,u,m)}function d(u){const m=[];if("children"in u){const h=u.children;let p=-1;for(;++p<h.length;){const g=l.one(h[p],u);if(g){if(p&&h[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=qc(g.value)),!Array.isArray(g)&&g.type==="element")){const y=g.children[0];y&&y.type==="text"&&(y.value=qc(y.value))}Array.isArray(g)?m.push(...g):m.push(g)}}}return m}}function wy(e,t){e.position&&(t.position=ub(e))}function jy(e,t){let r=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const o="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:o}}r.type==="element"&&i&&Object.assign(r.properties,vi(i)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function Ny(e,t){const r=t.data||{},a="value"in t&&!(ml.call(r,"hProperties")||ml.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Sy(e,t){const r=[];let a=-1;for(t&&r.push({type:"text",value:`
406
+ `});++a<e.length;)a&&r.push({type:"text",value:`
407
+ `}),r.push(e[a]);return t&&e.length>0&&r.push({type:"text",value:`
408
+ `}),r}function qc(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Hc(e,t){const r=ky(e,t),a=r.one(e,void 0),s=my(r),i=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
409
+ `},s),i}function Cy(e,t){return e&&"run"in e?async function(r,a){const s=Hc(r,{file:a,...t});await e.run(s,a)}:function(r,a){return Hc(r,{file:a,...e||t})}}function Wc(e){if(e)throw e}var mo,Uc;function My(){if(Uc)return mo;Uc=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},i=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var u=e.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!u&&!m)return!1;var h;for(h in d);return typeof h>"u"||e.call(d,h)},o=function(d,u){r&&u.name==="__proto__"?r(d,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):d[u.name]=u.newValue},l=function(d,u){if(u==="__proto__")if(e.call(d,u)){if(a)return a(d,u).value}else return;return d[u]};return mo=function c(){var d,u,m,h,p,g,y=arguments[0],v=1,w=arguments.length,S=!1;for(typeof y=="boolean"&&(S=y,y=arguments[1]||{},v=2),(y==null||typeof y!="object"&&typeof y!="function")&&(y={});v<w;++v)if(d=arguments[v],d!=null)for(u in d)m=l(y,u),h=l(d,u),y!==h&&(S&&h&&(i(h)||(p=s(h)))?(p?(p=!1,g=m&&s(m)?m:[]):g=m&&i(m)?m:{},o(y,{name:u,newValue:c(S,g,h)})):typeof h<"u"&&o(y,{name:u,newValue:h}));return y},mo}var Ay=My();const ho=vs(Ay);function hl(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Ty(){const e=[],t={run:r,use:a};return t;function r(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...d){const u=e[++i];let m=-1;if(c){o(c);return}for(;++m<s.length;)(d[m]===null||d[m]===void 0)&&(d[m]=s[m]);s=d,u?Ey(u,l)(...d):o(null,...d)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function Ey(e,t){let r;return a;function a(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(d){const u=d;if(l&&r)throw u;return s(u)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){r||(r=!0,t(o,...l))}function i(o){s(null,o)}}const rn={basename:Iy,dirname:Dy,extname:zy,join:Ly,sep:"/"};function Iy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Es(e);let r=0,a=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){r=s+1;break}}else a<0&&(i=!0,a=s+1);return a<0?"":e.slice(r,a)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){r=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(a=s):(l=-1,a=o));return r===a?a=o:a<0&&(a=e.length),e.slice(r,a)}function Dy(e){if(Es(e),e.length===0)return".";let t=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){t=r;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function zy(e){Es(e);let t=e.length,r=-1,a=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){a=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||r<0||i===0||i===1&&s===r-1&&s===a+1?"":e.slice(s,r)}function Ly(...e){let t=-1,r;for(;++t<e.length;)Es(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":Py(r)}function Py(e){Es(e);const t=e.codePointAt(0)===47;let r=Ry(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Ry(e,t){let r="",a=0,s=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(r.length<2||a!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",a=0):(r=r.slice(0,c),a=r.length-1-r.lastIndexOf("/")),s=o,i=0;continue}}else if(r.length>0){r="",a=0,s=o,i=0;continue}}t&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(s+1,o):r=e.slice(s+1,o),a=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return r}function Es(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Fy={cwd:By};function By(){return"/"}function pl(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Oy(e){if(typeof e=="string")e=new URL(e);else if(!pl(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return $y(e)}function $y(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const a=t.codePointAt(r+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const po=["history","path","basename","stem","extname","dirname"];class eh{constructor(t){let r;t?pl(t)?r={path:t}:typeof t=="string"||_y(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":Fy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<po.length;){const i=po[a];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let s;for(s in r)po.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?rn.basename(this.path):void 0}set basename(t){go(t,"basename"),fo(t,"basename"),this.path=rn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?rn.dirname(this.path):void 0}set dirname(t){Vc(this.basename,"dirname"),this.path=rn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?rn.extname(this.path):void 0}set extname(t){if(fo(t,"extname"),Vc(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=rn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){pl(t)&&(t=Oy(t)),go(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?rn.basename(this.path,this.extname):void 0}set stem(t){go(t,"stem"),fo(t,"stem"),this.path=rn.join(this.dirname||"",t+(this.extname||""))}fail(t,r,a){const s=this.message(t,r,a);throw s.fatal=!0,s}info(t,r,a){const s=this.message(t,r,a);return s.fatal=void 0,s}message(t,r,a){const s=new or(t,r,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function fo(e,t){if(e&&e.includes(rn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+rn.sep+"`")}function go(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Vc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function _y(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qy=function(e){const a=this.constructor.prototype,s=a[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,a),i},Hy={}.hasOwnProperty;class h0 extends qy{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=Ty()}copy(){const t=new h0;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];t.use(...a)}return t.data(ho(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(yo("data",this.frozen),this.namespace[t]=r,this):Hy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yo("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=r.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Gs(t),a=this.parser||this.Parser;return xo("parse",a),a(String(r),r)}process(t,r){const a=this;return this.freeze(),xo("process",this.parser||this.Parser),bo("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(i,o){const l=Gs(t),c=a.parse(l);a.run(c,l,function(u,m,h){if(u||!m||!h)return d(u);const p=m,g=a.stringify(p,h);Vy(g)?h.value=g:h.result=g,d(u,h)});function d(u,m){u||!m?o(u):i?i(m):r(void 0,m)}}}processSync(t){let r=!1,a;return this.freeze(),xo("processSync",this.parser||this.Parser),bo("processSync",this.compiler||this.Compiler),this.process(t,s),Kc("processSync","process",r),a;function s(i,o){r=!0,Wc(i),a=o}}run(t,r,a){Gc(t),this.freeze();const s=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?i(void 0,a):new Promise(i);function i(o,l){const c=Gs(r);s.run(t,c,d);function d(u,m,h){const p=m||t;u?l(u):o?o(p):a(void 0,p,h)}}}runSync(t,r){let a=!1,s;return this.run(t,r,i),Kc("runSync","run",a),s;function i(o,l){Wc(o),s=l,a=!0}}stringify(t,r){this.freeze();const a=Gs(r),s=this.compiler||this.Compiler;return bo("stringify",s),Gc(t),s(t,a)}use(t,...r){const a=this.attachers,s=this.namespace;if(yo("use",this.frozen),t!=null)if(typeof t=="function")c(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[u,...m]=d;c(u,m)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))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");l(d.plugins),d.settings&&(s.settings=ho(!0,s.settings,d.settings))}function l(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const m=d[u];i(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let m=-1,h=-1;for(;++m<a.length;)if(a[m][0]===d){h=m;break}if(h===-1)a.push([d,...u]);else if(u.length>0){let[p,...g]=u;const y=a[h][1];hl(y)&&hl(p)&&(p=ho(!0,y,p)),a[h]=[d,p,...g]}}}}const Wy=new h0().freeze();function xo(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function bo(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yo(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Gc(e){if(!hl(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Kc(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gs(e){return Uy(e)?e:new eh(e)}function Uy(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Vy(e){return typeof e=="string"||Gy(e)}function Gy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ky="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Jc=[],Yc={allowDangerousHtml:!0},Jy=/^(https?|ircs?|mailto|xmpp)$/i,Yy=[{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 Xy(e){const t=Qy(e),r=Zy(e);return ev(t.runSync(t.parse(r),r),e)}function Qy(e){const t=e.rehypePlugins||Jc,r=e.remarkPlugins||Jc,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yc}:Yc;return Wy().use(z4).use(r).use(Cy,a).use(t)}function Zy(e){const t=e.children||"",r=new eh;return typeof t=="string"&&(r.value=t),r}function ev(e,t){const r=t.allowedElements,a=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||tv;for(const u of Yy)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+Ky+u.id,void 0);return m0(e,d),gb(e,{Fragment:n.Fragment,components:s,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function d(u,m,h){if(u.type==="raw"&&h&&typeof m=="number")return o?h.children.splice(m,1):h.children[m]={type:"text",value:u.value},m;if(u.type==="element"){let p;for(p in lo)if(Object.hasOwn(lo,p)&&Object.hasOwn(u.properties,p)){const g=u.properties[p],y=lo[p];(y===null||y.includes(u.tagName))&&(u.properties[p]=c(String(g||""),p,u))}}if(u.type==="element"){let p=r?!r.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&a&&typeof m=="number"&&(p=!a(u,m,h)),p&&h&&typeof m=="number")return l&&u.children?h.children.splice(m,1,...u.children):h.children.splice(m,1),m}}}function tv(e){const t=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||r!==-1&&t>r||a!==-1&&t>a||Jy.test(e.slice(0,t))?e:""}function Xc(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=r.indexOf(t);for(;s!==-1;)a++,s=r.indexOf(t,s+t.length);return a}function rv(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nv(e,t,r){const s=Ts((r||{}).ignore||[]),i=av(t);let o=-1;for(;++o<i.length;)u0(e,"text",l);function l(d,u){let m=-1,h;for(;++m<u.length;){const p=u[m],g=h?h.children:void 0;if(s(p,g?g.indexOf(p):void 0,h))return;h=p}if(h)return c(d,u)}function c(d,u){const m=u[u.length-1],h=i[o][0],p=i[o][1];let g=0;const v=m.children.indexOf(d);let w=!1,S=[];h.lastIndex=0;let N=h.exec(d.value);for(;N;){const I=N.index,F={index:N.index,input:N.input,stack:[...u,d]};let E=p(...N,F);if(typeof E=="string"&&(E=E.length>0?{type:"text",value:E}:void 0),E===!1?h.lastIndex=I+1:(g!==I&&S.push({type:"text",value:d.value.slice(g,I)}),Array.isArray(E)?S.push(...E):E&&S.push(E),g=I+N[0].length,w=!0),!h.global)break;N=h.exec(d.value)}return w?(g<d.value.length&&S.push({type:"text",value:d.value.slice(g)}),m.children.splice(v,1,...S)):S=[d],v+S.length}}function av(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<r.length;){const s=r[a];t.push([sv(s[0]),iv(s[1])])}return t}function sv(e){return typeof e=="string"?new RegExp(rv(e),"g"):e}function iv(e){return typeof e=="function"?e:function(){return e}}const vo="phrasing",ko=["autolink","link","image","label"];function ov(){return{transforms:[pv],enter:{literalAutolink:cv,literalAutolinkEmail:wo,literalAutolinkHttp:wo,literalAutolinkWww:wo},exit:{literalAutolink:hv,literalAutolinkEmail:mv,literalAutolinkHttp:dv,literalAutolinkWww:uv}}}function lv(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:vo,notInConstruct:ko},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:vo,notInConstruct:ko},{character:":",before:"[ps]",after:"\\/",inConstruct:vo,notInConstruct:ko}]}}function cv(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function wo(e){this.config.enter.autolinkProtocol.call(this,e)}function dv(e){this.config.exit.autolinkProtocol.call(this,e)}function uv(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function mv(e){this.config.exit.autolinkEmail.call(this,e)}function hv(e){this.exit(e)}function pv(e){nv(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fv],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),gv]],{ignore:["link","linkReference"]})}function fv(e,t,r,a,s){let i="";if(!th(s)||(/^w/i.test(t)&&(r=t+r,t="",i="http://"),!xv(r)))return!1;const o=bv(r+a);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function gv(e,t,r,a){return!th(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function xv(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function bv(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],a=r.indexOf(")");const s=Xc(e,"(");let i=Xc(e,")");for(;a!==-1&&s>i;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),i++;return[e,r]}function th(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||da(r)||Fi(r))&&(!t||r!==47)}rh.peek=Mv;function yv(){this.buffer()}function vv(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function kv(){this.buffer()}function wv(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function jv(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function Nv(e){this.exit(e)}function Sv(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Yr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function Cv(e){this.exit(e)}function Mv(){return"["}function rh(e,t,r,a){const s=r.createTracker(a);let i=s.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return i+=s.move(r.safe(r.associationId(e),{after:"]",before:i})),l(),o(),i+=s.move("]"),i}function Av(){return{enter:{gfmFootnoteCallString:yv,gfmFootnoteCall:vv,gfmFootnoteDefinitionLabelString:kv,gfmFootnoteDefinition:wv},exit:{gfmFootnoteCallString:jv,gfmFootnoteCall:Nv,gfmFootnoteDefinitionLabelString:Sv,gfmFootnoteDefinition:Cv}}}function Tv(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:rh},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,s,i,o){const l=i.createTracker(o);let c=l.move("[^");const d=i.enter("footnoteDefinition"),u=i.enter("label");return c+=l.move(i.safe(i.associationId(a),{before:c,after:"]"})),u(),c+=l.move("]:"),a.children&&a.children.length>0&&(l.shift(4),c+=l.move((t?`
410
+ `:" ")+i.indentLines(i.containerFlow(a,l.current()),t?nh:Ev))),d(),c}}function Ev(e,t,r){return t===0?e:nh(e,t,r)}function nh(e,t,r){return(r?"":" ")+e}const Iv=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ah.peek=Rv;function Dv(){return{canContainEols:["delete"],enter:{strikethrough:Lv},exit:{strikethrough:Pv}}}function zv(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Iv}],handlers:{delete:ah}}}function Lv(e){this.enter({type:"delete",children:[]},e)}function Pv(e){this.exit(e)}function ah(e,t,r,a){const s=r.createTracker(a),i=r.enter("strikethrough");let o=s.move("~~");return o+=r.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function Rv(){return"~"}function Fv(e){return e.length}function Bv(e,t){const r=t||{},a=(r.align||[]).concat(),s=r.stringLength||Fv,i=[],o=[],l=[],c=[];let d=0,u=-1;for(;++u<e.length;){const y=[],v=[];let w=-1;for(e[u].length>d&&(d=e[u].length);++w<e[u].length;){const S=Ov(e[u][w]);if(r.alignDelimiters!==!1){const N=s(S);v[w]=N,(c[w]===void 0||N>c[w])&&(c[w]=N)}y.push(S)}o[u]=y,l[u]=v}let m=-1;if(typeof a=="object"&&"length"in a)for(;++m<d;)i[m]=Qc(a[m]);else{const y=Qc(a);for(;++m<d;)i[m]=y}m=-1;const h=[],p=[];for(;++m<d;){const y=i[m];let v="",w="";y===99?(v=":",w=":"):y===108?v=":":y===114&&(w=":");let S=r.alignDelimiters===!1?1:Math.max(1,c[m]-v.length-w.length);const N=v+"-".repeat(S)+w;r.alignDelimiters!==!1&&(S=v.length+S+w.length,S>c[m]&&(c[m]=S),p[m]=S),h[m]=N}o.splice(1,0,h),l.splice(1,0,p),u=-1;const g=[];for(;++u<o.length;){const y=o[u],v=l[u];m=-1;const w=[];for(;++m<d;){const S=y[m]||"";let N="",I="";if(r.alignDelimiters!==!1){const F=c[m]-(v[m]||0),E=i[m];E===114?N=" ".repeat(F):E===99?F%2?(N=" ".repeat(F/2+.5),I=" ".repeat(F/2-.5)):(N=" ".repeat(F/2),I=N):I=" ".repeat(F)}r.delimiterStart!==!1&&!m&&w.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&S==="")&&(r.delimiterStart!==!1||m)&&w.push(" "),r.alignDelimiters!==!1&&w.push(N),w.push(S),r.alignDelimiters!==!1&&w.push(I),r.padding!==!1&&w.push(" "),(r.delimiterEnd!==!1||m!==d-1)&&w.push("|")}g.push(r.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return g.join(`
411
+ `)}function Ov(e){return e==null?"":String(e)}function Qc(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function $v(e,t,r,a){const s=r.enter("blockquote"),i=r.createTracker(a);i.move("> "),i.shift(2);const o=r.indentLines(r.containerFlow(e,i.current()),_v);return s(),o}function _v(e,t,r){return">"+(r?"":" ")+e}function qv(e,t){return Zc(e,t.inConstruct,!0)&&!Zc(e,t.notInConstruct,!1)}function Zc(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function ed(e,t,r,a){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===`
412
+ `&&qv(r.stack,r.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
413
+ `}function sh(e,t){const r=String(e);let a=r.indexOf(t),s=a,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++i>o&&(o=i):i=1,s=a+t.length,a=r.indexOf(t,s);return o}function Hv(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Wv(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Uv(e,t,r,a){const s=Wv(r),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(Hv(e,r)){const m=r.enter("codeIndented"),h=r.indentLines(i,Vv);return m(),h}const l=r.createTracker(a),c=s.repeat(Math.max(sh(i,s)+1,3)),d=r.enter("codeFenced");let u=l.move(c);if(e.lang){const m=r.enter(`codeFencedLang${o}`);u+=l.move(r.safe(e.lang,{before:u,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=r.enter(`codeFencedMeta${o}`);u+=l.move(" "),u+=l.move(r.safe(e.meta,{before:u,after:`
414
+ `,encode:["`"],...l.current()})),m()}return u+=l.move(`
415
+ `),i&&(u+=l.move(i+`
416
+ `)),u+=l.move(c),d(),u}function Vv(e,t,r){return(r?"":" ")+e}function p0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Gv(e,t,r,a){const s=p0(r),i=s==='"'?"Quote":"Apostrophe",o=r.enter("definition");let l=r.enter("label");const c=r.createTracker(a);let d=c.move("[");return d+=c.move(r.safe(r.associationId(e),{before:d,after:"]",...c.current()})),d+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=r.enter("destinationRaw"),d+=c.move(r.safe(e.url,{before:d,after:e.title?" ":`
417
+ `,...c.current()}))),l(),e.title&&(l=r.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(r.safe(e.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),o(),d}function Kv(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function fs(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ki(e,t,r){const a=Da(e),s=Da(t);return a===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ih.peek=Jv;function ih(e,t,r,a){const s=Kv(r),i=r.enter("emphasis"),o=r.createTracker(a),l=o.move(s);let c=o.move(r.containerPhrasing(e,{after:s,before:l,...o.current()}));const d=c.charCodeAt(0),u=ki(a.before.charCodeAt(a.before.length-1),d,s);u.inside&&(c=fs(d)+c.slice(1));const m=c.charCodeAt(c.length-1),h=ki(a.after.charCodeAt(0),m,s);h.inside&&(c=c.slice(0,-1)+fs(m));const p=o.move(s);return i(),r.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+c+p}function Jv(e,t,r){return r.options.emphasis||"*"}function Yv(e,t){let r=!1;return m0(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,ul}),!!((!e.depth||e.depth<3)&&a0(e)&&(t.options.setext||r))}function Xv(e,t,r,a){const s=Math.max(Math.min(6,e.depth||1),1),i=r.createTracker(a);if(Yv(e,r)){const u=r.enter("headingSetext"),m=r.enter("phrasing"),h=r.containerPhrasing(e,{...i.current(),before:`
418
+ `,after:`
419
+ `});return m(),u(),h+`
420
+ `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
421
+ `))+1))}const o="#".repeat(s),l=r.enter("headingAtx"),c=r.enter("phrasing");i.move(o+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
422
+ `,...i.current()});return/^[\t ]/.test(d)&&(d=fs(d.charCodeAt(0))+d.slice(1)),d=d?o+" "+d:o,r.options.closeAtx&&(d+=" "+o),c(),l(),d}oh.peek=Qv;function oh(e){return e.value||""}function Qv(){return"<"}lh.peek=Zv;function lh(e,t,r,a){const s=p0(r),i=s==='"'?"Quote":"Apostrophe",o=r.enter("image");let l=r.enter("label");const c=r.createTracker(a);let d=c.move("![");return d+=c.move(r.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=r.enter("destinationRaw"),d+=c.move(r.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=r.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(r.safe(e.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),d+=c.move(")"),o(),d}function Zv(){return"!"}ch.peek=e5;function ch(e,t,r,a){const s=e.referenceType,i=r.enter("imageReference");let o=r.enter("label");const l=r.createTracker(a);let c=l.move("![");const d=r.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const m=r.safe(r.associationId(e),{before:c,after:"]",...l.current()});return o(),r.stack=u,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function e5(){return"!"}dh.peek=t5;function dh(e,t,r){let a=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++i<r.unsafe.length;){const o=r.unsafe[i],l=r.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(a);){let d=c.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(c.index+1)}}return s+a+s}function t5(){return"`"}function uh(e,t){const r=a0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}mh.peek=r5;function mh(e,t,r,a){const s=p0(r),i=s==='"'?"Quote":"Apostrophe",o=r.createTracker(a);let l,c;if(uh(e,r)){const u=r.stack;r.stack=[],l=r.enter("autolink");let m=o.move("<");return m+=o.move(r.containerPhrasing(e,{before:m,after:">",...o.current()})),m+=o.move(">"),l(),r.stack=u,m}l=r.enter("link"),c=r.enter("label");let d=o.move("[");return d+=o.move(r.containerPhrasing(e,{before:d,after:"](",...o.current()})),d+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=r.enter("destinationLiteral"),d+=o.move("<"),d+=o.move(r.safe(e.url,{before:d,after:">",...o.current()})),d+=o.move(">")):(c=r.enter("destinationRaw"),d+=o.move(r.safe(e.url,{before:d,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=r.enter(`title${i}`),d+=o.move(" "+s),d+=o.move(r.safe(e.title,{before:d,after:s,...o.current()})),d+=o.move(s),c()),d+=o.move(")"),l(),d}function r5(e,t,r){return uh(e,r)?"<":"["}hh.peek=n5;function hh(e,t,r,a){const s=e.referenceType,i=r.enter("linkReference");let o=r.enter("label");const l=r.createTracker(a);let c=l.move("[");const d=r.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),o();const u=r.stack;r.stack=[],o=r.enter("reference");const m=r.safe(r.associationId(e),{before:c,after:"]",...l.current()});return o(),r.stack=u,i(),s==="full"||!d||d!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function n5(){return"["}function f0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function a5(e){const t=f0(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function s5(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ph(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function i5(e,t,r,a){const s=r.enter("list"),i=r.bulletCurrent;let o=e.ordered?s5(r):f0(r);const l=e.ordered?o==="."?")":".":a5(r);let c=t&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(c=!0),ph(r)===o&&u){let m=-1;for(;++m<e.children.length;){const h=e.children[m];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),r.bulletCurrent=o;const d=r.containerFlow(e,a);return r.bulletLastUsed=o,r.bulletCurrent=i,s(),d}function o5(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function l5(e,t,r,a){const s=o5(r);let i=r.bulletCurrent||f0(r);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=r.createTracker(a);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,l.current()),u);return c(),d;function u(m,h,p){return h?(p?"":" ".repeat(o))+m:(p?i:i+" ".repeat(o-i.length))+m}}function c5(e,t,r,a){const s=r.enter("paragraph"),i=r.enter("phrasing"),o=r.containerPhrasing(e,a);return i(),s(),o}const d5=Ts(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function u5(e,t,r,a){return(e.children.some(function(o){return d5(o)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function m5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}fh.peek=h5;function fh(e,t,r,a){const s=m5(r),i=r.enter("strong"),o=r.createTracker(a),l=o.move(s+s);let c=o.move(r.containerPhrasing(e,{after:s,before:l,...o.current()}));const d=c.charCodeAt(0),u=ki(a.before.charCodeAt(a.before.length-1),d,s);u.inside&&(c=fs(d)+c.slice(1));const m=c.charCodeAt(c.length-1),h=ki(a.after.charCodeAt(0),m,s);h.inside&&(c=c.slice(0,-1)+fs(m));const p=o.move(s+s);return i(),r.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+c+p}function h5(e,t,r){return r.options.strong||"*"}function p5(e,t,r,a){return r.safe(e.value,a)}function f5(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function g5(e,t,r){const a=(ph(r)+(r.options.ruleSpaces?" ":"")).repeat(f5(r));return r.options.ruleSpaces?a.slice(0,-1):a}const gh={blockquote:$v,break:ed,code:Uv,definition:Gv,emphasis:ih,hardBreak:ed,heading:Xv,html:oh,image:lh,imageReference:ch,inlineCode:dh,link:mh,linkReference:hh,list:i5,listItem:l5,paragraph:c5,root:u5,strong:fh,text:p5,thematicBreak:g5};function x5(){return{enter:{table:b5,tableData:td,tableHeader:td,tableRow:v5},exit:{codeText:k5,table:y5,tableData:jo,tableHeader:jo,tableRow:jo}}}function b5(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function y5(e){this.exit(e),this.data.inTable=void 0}function v5(e){this.enter({type:"tableRow",children:[]},e)}function jo(e){this.exit(e)}function td(e){this.enter({type:"tableCell",children:[]},e)}function k5(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,w5));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function w5(e,t){return t==="|"?t:e}function j5(e){const t=e||{},r=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,i=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
423
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:c,tableRow:l}};function o(p,g,y,v){return d(u(p,y,v),p.align)}function l(p,g,y,v){const w=m(p,y,v),S=d([w]);return S.slice(0,S.indexOf(`
424
+ `))}function c(p,g,y,v){const w=y.enter("tableCell"),S=y.enter("phrasing"),N=y.containerPhrasing(p,{...v,before:i,after:i});return S(),w(),N}function d(p,g){return Bv(p,{align:g,alignDelimiters:a,padding:r,stringLength:s})}function u(p,g,y){const v=p.children;let w=-1;const S=[],N=g.enter("table");for(;++w<v.length;)S[w]=m(v[w],g,y);return N(),S}function m(p,g,y){const v=p.children;let w=-1;const S=[],N=g.enter("tableRow");for(;++w<v.length;)S[w]=c(v[w],p,g,y);return N(),S}function h(p,g,y){let v=gh.inlineCode(p,g,y);return y.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function N5(){return{exit:{taskListCheckValueChecked:rd,taskListCheckValueUnchecked:rd,paragraph:C5}}}function S5(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:M5}}}function rd(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function C5(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const a=r.children[0];if(a&&a.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){o=l;break}}o===r&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function M5(e,t,r,a){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(a);i&&l.move(o);let c=gh.listItem(e,t,r,{...a,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(u){return u+o}}function A5(){return[ov(),Av(),Dv(),x5(),N5()]}function T5(e){return{extensions:[lv(),Tv(e),zv(),j5(e),S5()]}}const E5={tokenize:R5,partial:!0},xh={tokenize:F5,partial:!0},bh={tokenize:B5,partial:!0},yh={tokenize:O5,partial:!0},I5={tokenize:$5,partial:!0},vh={name:"wwwAutolink",tokenize:L5,previous:wh},kh={name:"protocolAutolink",tokenize:P5,previous:jh},En={name:"emailAutolink",tokenize:z5,previous:Nh},dn={};function D5(){return{text:dn}}let ta=48;for(;ta<123;)dn[ta]=En,ta++,ta===58?ta=65:ta===91&&(ta=97);dn[43]=En;dn[45]=En;dn[46]=En;dn[95]=En;dn[72]=[En,kh];dn[104]=[En,kh];dn[87]=[En,vh];dn[119]=[En,vh];function z5(e,t,r){const a=this;let s,i;return o;function o(m){return!fl(m)||!Nh.call(a,a.previous)||g0(a.events)?r(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return fl(m)?(e.consume(m),l):m===64?(e.consume(m),c):r(m)}function c(m){return m===46?e.check(I5,u,d)(m):m===45||m===95||ir(m)?(i=!0,e.consume(m),c):u(m)}function d(m){return e.consume(m),s=!0,c}function u(m){return i&&s&&ur(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):r(m)}}function L5(e,t,r){const a=this;return s;function s(o){return o!==87&&o!==119||!wh.call(a,a.previous)||g0(a.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(E5,e.attempt(xh,e.attempt(bh,i),r),r)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function P5(e,t,r){const a=this;let s="",i=!1;return o;function o(m){return(m===72||m===104)&&jh.call(a,a.previous)&&!g0(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),l):r(m)}function l(m){if(ur(m)&&s.length<5)return s+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const h=s.toLowerCase();if(h==="http"||h==="https")return e.consume(m),c}return r(m)}function c(m){return m===47?(e.consume(m),i?d:(i=!0,c)):r(m)}function d(m){return m===null||bi(m)||Et(m)||da(m)||Fi(m)?r(m):e.attempt(xh,e.attempt(bh,u),r)(m)}function u(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function R5(e,t,r){let a=0;return s;function s(o){return(o===87||o===119)&&a<3?(a++,e.consume(o),s):o===46&&a===3?(e.consume(o),i):r(o)}function i(o){return o===null?r(o):t(o)}}function F5(e,t,r){let a,s,i;return o;function o(d){return d===46||d===95?e.check(yh,c,l)(d):d===null||Et(d)||da(d)||d!==45&&Fi(d)?c(d):(i=!0,e.consume(d),o)}function l(d){return d===95?a=!0:(s=a,a=void 0),e.consume(d),o}function c(d){return s||a||!i?r(d):t(d)}}function B5(e,t){let r=0,a=0;return s;function s(o){return o===40?(r++,e.consume(o),s):o===41&&a<r?i(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?e.check(yh,t,i)(o):o===null||Et(o)||da(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&a++,e.consume(o),s}}function O5(e,t,r){return a;function a(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),a):l===38?(e.consume(l),i):l===93?(e.consume(l),s):l===60||l===null||Et(l)||da(l)?t(l):r(l)}function s(l){return l===null||l===40||l===91||Et(l)||da(l)?t(l):a(l)}function i(l){return ur(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),a):ur(l)?(e.consume(l),o):r(l)}}function $5(e,t,r){return a;function a(i){return e.consume(i),s}function s(i){return ir(i)?r(i):t(i)}}function wh(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Et(e)}function jh(e){return!ur(e)}function Nh(e){return!(e===47||fl(e))}function fl(e){return e===43||e===45||e===46||e===95||ir(e)}function g0(e){let t=e.length,r=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const _5={tokenize:J5,partial:!0};function q5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:V5,continuation:{tokenize:G5},exit:K5}},text:{91:{name:"gfmFootnoteCall",tokenize:U5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:H5,resolveTo:W5}}}}function H5(e,t,r){const a=this;let s=a.events.length;const i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o;for(;s--;){const c=a.events[s][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return r(c);const d=Yr(a.sliceSerialize({start:o.end,end:a.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?r(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function W5(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[r+1],e[r+2],["enter",a,t],e[r+3],e[r+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(r,e.length-r+1,...l),e}function U5(e,t,r){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let i=0,o;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?r(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(m){if(i>999||m===93&&!o||m===null||m===91||Et(m))return r(m);if(m===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(Yr(a.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(m)}return Et(m)||(o=!0),i++,e.consume(m),m===92?u:d}function u(m){return m===91||m===92||m===93?(e.consume(m),i++,d):d(m)}}function V5(e,t,r){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):r(g)}function u(g){if(o>999||g===93&&!l||g===null||g===91||Et(g))return r(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Yr(a.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Et(g)||(l=!0),o++,e.consume(g),g===92?m:u}function m(g){return g===91||g===92||g===93?(e.consume(g),o++,u):u(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),s.includes(i)||s.push(i),pt(e,p,"gfmFootnoteDefinitionWhitespace")):r(g)}function p(g){return t(g)}}function G5(e,t,r){return e.check(As,t,e.attempt(_5,t,r))}function K5(e){e.exit("gfmFootnoteDefinition")}function J5(e,t,r){const a=this;return pt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=a.events[a.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):r(i)}}function Y5(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:i,resolveAll:s};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let d=c;for(;d--;)if(o[d][0]==="exit"&&o[d][1].type==="strikethroughSequenceTemporary"&&o[d][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[d][1].end.offset-o[d][1].start.offset){o[c][1].type="strikethroughSequence",o[d][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[c][1].end)},m={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[c][1].start)},h=[["enter",u,l],["enter",o[d][1],l],["exit",o[d][1],l],["enter",m,l]],p=l.parser.constructs.insideSpan.null;p&&Er(h,h.length,0,Bi(p,o.slice(d+1,c),l)),Er(h,h.length,0,[["exit",m,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",u,l]]),Er(o,d-1,c-d+3,h),c=d+h.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const d=this.previous,u=this.events;let m=0;return h;function h(g){return d===126&&u[u.length-1][1].type!=="characterEscape"?c(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const y=Da(d);if(g===126)return m>1?c(g):(o.consume(g),m++,p);if(m<2&&!r)return c(g);const v=o.exit("strikethroughSequenceTemporary"),w=Da(g);return v._open=!w||w===2&&!!y,v._close=!y||y===2&&!!w,l(g)}}}class X5{constructor(){this.map=[]}add(t,r,a){Q5(this,t,r,a)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const a=[];for(;r>0;)r-=1,a.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const i of s)t.push(i);s=a.pop()}this.map.length=0}}function Q5(e,t,r,a){let s=0;if(!(r===0&&a.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=r,e.map[s][2].push(...a);return}s+=1}e.map.push([t,r,a])}}function Z5(e,t){let r=!1;const a=[];for(;t<e.length;){const s=e[t];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=a.length-1;a[i]=a[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return a}function e3(){return{flow:{null:{name:"table",tokenize:t3,resolveAll:r3}}}}function t3(e,t,r){const a=this;let s=0,i=0,o;return l;function l(A){let V=a.events.length-1;for(;V>-1;){const P=a.events[V][1].type;if(P==="lineEnding"||P==="linePrefix")V--;else break}const T=V>-1?a.events[V][1].type:null,U=T==="tableHead"||T==="tableRow"?E:c;return U===E&&a.parser.lazy[a.now().line]?r(A):U(A)}function c(A){return e.enter("tableHead"),e.enter("tableRow"),d(A)}function d(A){return A===124||(o=!0,i+=1),u(A)}function u(A){return A===null?r(A):We(A)?i>1?(i=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),p):r(A):xt(A)?pt(e,u,"whitespace")(A):(i+=1,o&&(o=!1,s+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),m(A)))}function m(A){return A===null||A===124||Et(A)?(e.exit("data"),u(A)):(e.consume(A),A===92?h:m)}function h(A){return A===92||A===124?(e.consume(A),m):m(A)}function p(A){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(A):(e.enter("tableDelimiterRow"),o=!1,xt(A)?pt(e,g,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):g(A))}function g(A){return A===45||A===58?v(A):A===124?(o=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),y):F(A)}function y(A){return xt(A)?pt(e,v,"whitespace")(A):v(A)}function v(A){return A===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),w):A===45?(i+=1,w(A)):A===null||We(A)?I(A):F(A)}function w(A){return A===45?(e.enter("tableDelimiterFiller"),S(A)):F(A)}function S(A){return A===45?(e.consume(A),S):A===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(A))}function N(A){return xt(A)?pt(e,I,"whitespace")(A):I(A)}function I(A){return A===124?g(A):A===null||We(A)?!o||s!==i?F(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):F(A)}function F(A){return r(A)}function E(A){return e.enter("tableRow"),R(A)}function R(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),R):A===null||We(A)?(e.exit("tableRow"),t(A)):xt(A)?pt(e,R,"whitespace")(A):(e.enter("data"),H(A))}function H(A){return A===null||A===124||Et(A)?(e.exit("data"),R(A)):(e.consume(A),A===92?$:H)}function $(A){return A===92||A===124?(e.consume(A),H):H(A)}}function r3(e,t){let r=-1,a=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,d,u,m;const h=new X5;for(;++r<e.length;){const p=e[r],g=p[1];p[0]==="enter"?g.type==="tableHead"?(l=!1,c!==0&&(nd(h,t,c,d,u),u=void 0,c=0),d={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(r,0,[["enter",d,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(a=!0,m=void 0,i=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,u={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(r,0,[["enter",u,t]])),s=g.type==="tableDelimiterRow"?2:u?3:1):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(a=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],m=Ks(h,t,i,s,void 0,m),i=[0,0,0,0]),o[2]=r)):g.type==="tableCellDivider"&&(a?a=!1:(i[1]!==0&&(o[0]=o[1],m=Ks(h,t,i,s,void 0,m)),i=o,o=[i[1],r,0,0])):g.type==="tableHead"?(l=!0,c=r):g.type==="tableRow"||g.type==="tableDelimiterRow"?(c=r,i[1]!==0?(o[0]=o[1],m=Ks(h,t,i,s,r,m)):o[1]!==0&&(m=Ks(h,t,o,s,r,m)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=r)}for(c!==0&&nd(h,t,c,d,u),h.consume(t.events),r=-1;++r<t.events.length;){const p=t.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Z5(t.events,r))}return e}function Ks(e,t,r,a,s,i){const o=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(i.end=Object.assign({},Sa(t.events,r[0])),e.add(r[0],0,[["exit",i,t]]));const c=Sa(t.events,r[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(r[1],0,[["enter",i,t]]),r[2]!==0){const d=Sa(t.events,r[2]),u=Sa(t.events,r[3]),m={type:l,start:Object.assign({},d),end:Object.assign({},u)};if(e.add(r[2],0,[["enter",m,t]]),a!==2){const h=t.events[r[2]],p=t.events[r[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",r[3]>r[2]+1){const g=r[2]+1,y=r[3]-r[2]-1;e.add(g,y,[])}}e.add(r[3]+1,0,[["exit",m,t]])}return s!==void 0&&(i.end=Object.assign({},Sa(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function nd(e,t,r,a,s){const i=[],o=Sa(t.events,r);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),a.end=Object.assign({},o),i.push(["exit",a,t]),e.add(r+1,0,i)}function Sa(e,t){const r=e[t],a=r[0]==="enter"?"start":"end";return r[1][a]}const n3={name:"tasklistCheck",tokenize:s3};function a3(){return{text:{91:n3}}}function s3(e,t,r){const a=this;return s;function s(c){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Et(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):r(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(c)}function l(c){return We(c)?t(c):xt(c)?e.check({tokenize:i3},t,r)(c):r(c)}}function i3(e,t,r){return pt(e,a,"whitespace");function a(s){return s===null?r(s):t(s)}}function o3(e){return Lm([D5(),q5(),Y5(e),e3(),a3()])}const l3={};function c3(e){const t=this,r=e||l3,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),i=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),o=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(o3(r)),i.push(A5()),o.push(T5(r))}function d3(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:s,mathFlowFence:a,mathFlowFenceMeta:r,mathFlowValue:l,mathText:o,mathTextData:l}};function e(c){const d={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[d]}},c)}function t(){this.buffer()}function r(){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,d.meta=c}function a(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const d=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(c),u.value=d;const m=u.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:d}),this.data.mathFlowInside=void 0}function i(c){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},c),this.buffer()}function o(c){const d=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(c),u.value=d,u.data.hChildren.push({type:"text",value:d})}function l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function u3(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),a.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
425
+ `,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:a}};function r(i,o,l,c){const d=i.value||"",u=l.createTracker(c),m="$".repeat(Math.max(sh(d,"$")+1,2)),h=l.enter("mathFlow");let p=u.move(m);if(i.meta){const g=l.enter("mathFlowMeta");p+=u.move(l.safe(i.meta,{after:`
426
+ `,before:p,encode:["$"],...u.current()})),g()}return p+=u.move(`
427
+ `),d&&(p+=u.move(d+`
428
+ `)),p+=u.move(m),h(),p}function a(i,o,l){let c=i.value||"",d=1;for(t||d++;new RegExp("(^|[^$])"+"\\$".repeat(d)+"([^$]|$)").test(c);)d++;const u="$".repeat(d);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m<l.unsafe.length;){const h=l.unsafe[m];if(!h.atBreak)continue;const p=l.compilePattern(h);let g;for(;g=p.exec(c);){let y=g.index;c.codePointAt(y)===10&&c.codePointAt(y-1)===13&&y--,c=c.slice(0,y)+" "+c.slice(g.index+1)}}return u+c+u}function s(){return"$"}}const m3={tokenize:h3,concrete:!0,name:"mathFlow"},ad={tokenize:p3,partial:!0};function h3(e,t,r){const a=this,s=a.events[a.events.length-1],i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let o=0;return l;function l(S){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),c(S)}function c(S){return S===36?(e.consume(S),o++,c):o<2?r(S):(e.exit("mathFlowFenceSequence"),pt(e,d,"whitespace")(S))}function d(S){return S===null||We(S)?m(S):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(S))}function u(S){return S===null||We(S)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),m(S)):S===36?r(S):(e.consume(S),u)}function m(S){return e.exit("mathFlowFence"),a.interrupt?t(S):e.attempt(ad,h,v)(S)}function h(S){return e.attempt({tokenize:w,partial:!0},v,p)(S)}function p(S){return(i?pt(e,g,"linePrefix",i+1):g)(S)}function g(S){return S===null?v(S):We(S)?e.attempt(ad,h,v)(S):(e.enter("mathFlowValue"),y(S))}function y(S){return S===null||We(S)?(e.exit("mathFlowValue"),g(S)):(e.consume(S),y)}function v(S){return e.exit("mathFlow"),t(S)}function w(S,N,I){let F=0;return pt(S,E,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function E($){return S.enter("mathFlowFence"),S.enter("mathFlowFenceSequence"),R($)}function R($){return $===36?(F++,S.consume($),R):F<o?I($):(S.exit("mathFlowFenceSequence"),pt(S,H,"whitespace")($))}function H($){return $===null||We($)?(S.exit("mathFlowFence"),N($)):I($)}}}function p3(e,t,r){const a=this;return s;function s(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return a.parser.lazy[a.now().line]?r(o):t(o)}}function f3(e){let r=(e||{}).singleDollarTextMath;return r==null&&(r=!0),{tokenize:a,resolve:g3,previous:x3,name:"mathText"};function a(s,i,o){let l=0,c,d;return u;function u(y){return s.enter("mathText"),s.enter("mathTextSequence"),m(y)}function m(y){return y===36?(s.consume(y),l++,m):l<2&&!r?o(y):(s.exit("mathTextSequence"),h(y))}function h(y){return y===null?o(y):y===36?(d=s.enter("mathTextSequence"),c=0,g(y)):y===32?(s.enter("space"),s.consume(y),s.exit("space"),h):We(y)?(s.enter("lineEnding"),s.consume(y),s.exit("lineEnding"),h):(s.enter("mathTextData"),p(y))}function p(y){return y===null||y===32||y===36||We(y)?(s.exit("mathTextData"),h(y)):(s.consume(y),p)}function g(y){return y===36?(s.consume(y),c++,g):c===l?(s.exit("mathTextSequence"),s.exit("mathText"),i(y)):(d.type="mathTextData",p(y))}}}function g3(e){let t=e.length-4,r=3,a,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=r;++a<t;)if(e[a][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[r][1].type="mathTextPadding",r+=2,t-=2;break}}for(a=r-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="mathTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function x3(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function b3(e){return{flow:{36:m3},text:{36:f3(e)}}}class kr{constructor(t,r,a){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=r,this.end=a}static range(t,r){return r?!t||!t.loc||!r.loc||t.loc.lexer!==r.loc.lexer?null:new kr(t.loc.lexer,t.loc.start,r.loc.end):t&&t.loc}}class Ir{constructor(t,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=r}range(t,r){return new Ir(r,kr.range(this,t))}}class ye{constructor(t,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var a="KaTeX parse error: "+t,s,i,o=r&&r.loc;if(o&&o.start<=o.end){var l=o.lexer.input;s=o.start,i=o.end,s===l.length?a+=" at end of input: ":a+=" at position "+(s+1)+": ";var c=l.slice(s,i).replace(/[^]/g,"$&̲"),d;s>15?d="…"+l.slice(s-15,s):d=l.slice(0,s);var u;i+15<l.length?u=l.slice(i,i+15)+"…":u=l.slice(i),a+=d+c+u}var m=new Error(a);return m.name="ParseError",m.__proto__=ye.prototype,m.position=s,s!=null&&i!=null&&(m.length=i-s),m.rawMessage=t,m}}ye.prototype.__proto__=Error.prototype;var y3=function(t,r){return t===void 0?r:t},v3=/([A-Z])/g,k3=function(t){return t.replace(v3,"-$1").toLowerCase()},w3={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},j3=/[&><"']/g;function N3(e){return String(e).replace(j3,t=>w3[t])}var Sh=function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},S3=function(t){var r=Sh(t);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},C3=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},M3=function(t){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},Nt={deflt:y3,escape:N3,hyphenate:k3,getBaseElem:Sh,isCharacterBox:S3,protocolFromUrl:M3},ui={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function A3(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}let x0=class{constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r in ui)if(ui.hasOwnProperty(r)){var a=ui[r];this[r]=t[r]!==void 0?a.processor?a.processor(t[r]):t[r]:A3(a)}}reportNonstrict(t,r,a){var s=this.strict;if(typeof s=="function"&&(s=s(t,r,a)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new ye("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),a);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,a){var s=this.strict;if(typeof s=="function")try{s=s(t,r,a)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var r=Nt.protocolFromUrl(t.url);if(r==null)return!1;t.protocol=r}var a=typeof this.trust=="function"?this.trust(t):this.trust;return!!a}};class Rn{constructor(t,r,a){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=a}sup(){return nn[T3[this.id]]}sub(){return nn[E3[this.id]]}fracNum(){return nn[I3[this.id]]}fracDen(){return nn[D3[this.id]]}cramp(){return nn[z3[this.id]]}text(){return nn[L3[this.id]]}isTight(){return this.size>=2}}var b0=0,wi=1,Aa=2,wn=3,gs=4,Br=5,za=6,mr=7,nn=[new Rn(b0,0,!1),new Rn(wi,0,!0),new Rn(Aa,1,!1),new Rn(wn,1,!0),new Rn(gs,2,!1),new Rn(Br,2,!0),new Rn(za,3,!1),new Rn(mr,3,!0)],T3=[gs,Br,gs,Br,za,mr,za,mr],E3=[Br,Br,Br,Br,mr,mr,mr,mr],I3=[Aa,wn,gs,Br,za,mr,za,mr],D3=[wn,wn,Br,Br,mr,mr,mr,mr],z3=[wi,wi,wn,wn,Br,Br,mr,mr],L3=[b0,wi,Aa,wn,Aa,wn,Aa,wn],tt={DISPLAY:nn[b0],TEXT:nn[Aa],SCRIPT:nn[gs],SCRIPTSCRIPT:nn[za]},gl=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function P3(e){for(var t=0;t<gl.length;t++)for(var r=gl[t],a=0;a<r.blocks.length;a++){var s=r.blocks[a];if(e>=s[0]&&e<=s[1])return r.name}return null}var mi=[];gl.forEach(e=>e.blocks.forEach(t=>mi.push(...t)));function Ch(e){for(var t=0;t<mi.length;t+=2)if(e>=mi[t]&&e<=mi[t+1])return!0;return!1}var ka=80,R3=function(t,r){return"M95,"+(622+t+r)+`
429
+ c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
430
+ c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
431
+ c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
432
+ s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
433
+ c69,-144,104.5,-217.7,106.5,-221
434
+ l`+t/2.075+" -"+t+`
435
+ c5.3,-9.3,12,-14,20,-14
436
+ H400000v`+(40+t)+`H845.2724
437
+ s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
438
+ c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
439
+ M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},F3=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119
440
+ c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
441
+ c340,-704.7,510.7,-1060.3,512,-1067
442
+ l`+t/2.084+" -"+t+`
443
+ c4.7,-7.3,11,-11,19,-11
444
+ H40000v`+(40+t)+`H1012.3
445
+ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
446
+ c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
447
+ s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
448
+ c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
449
+ M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},B3=function(t,r){return"M983 "+(10+t+r)+`
450
+ l`+t/3.13+" -"+t+`
451
+ c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+`
452
+ H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
453
+ s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
454
+ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
455
+ c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
456
+ c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
457
+ c53.7,-170.3,84.5,-266.8,92.5,-289.5z
458
+ M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},O3=function(t,r){return"M424,"+(2398+t+r)+`
459
+ c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
460
+ c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
461
+ s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
462
+ s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
463
+ l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000
464
+ v`+(40+t)+`H1014.6
465
+ s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
466
+ c-2,6,-10,9,-24,9
467
+ c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+r+`
468
+ h400000v`+(40+t)+"h-400000z"},$3=function(t,r){return"M473,"+(2713+t+r)+`
469
+ c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+`
470
+ c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7
471
+ s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
472
+ c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
473
+ c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
474
+ s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
475
+ 606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},_3=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},q3=function(t,r,a){var s=a-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+`
476
+ H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
477
+ h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
478
+ c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
479
+ 219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},H3=function(t,r,a){r=1e3*r;var s="";switch(t){case"sqrtMain":s=R3(r,ka);break;case"sqrtSize1":s=F3(r,ka);break;case"sqrtSize2":s=B3(r,ka);break;case"sqrtSize3":s=O3(r,ka);break;case"sqrtSize4":s=$3(r,ka);break;case"sqrtTall":s=q3(r,ka,a)}return s},W3=function(t,r){switch(t){case"⎜":return"M291 0 H417 V"+r+" H291z M291 0 H417 V"+r+" H291z";case"∣":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z";case"∥":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z"+("M367 0 H410 V"+r+" H367z M367 0 H410 V"+r+" H367z");case"⎟":return"M457 0 H583 V"+r+" H457z M457 0 H583 V"+r+" H457z";case"⎢":return"M319 0 H403 V"+r+" H319z M319 0 H403 V"+r+" H319z";case"⎥":return"M263 0 H347 V"+r+" H263z M263 0 H347 V"+r+" H263z";case"⎪":return"M384 0 H504 V"+r+" H384z M384 0 H504 V"+r+" H384z";case"⏐":return"M312 0 H355 V"+r+" H312z M312 0 H355 V"+r+" H312z";case"‖":return"M257 0 H300 V"+r+" H257z M257 0 H300 V"+r+" H257z"+("M478 0 H521 V"+r+" H478z M478 0 H521 V"+r+" H478z");default:return""}},sd={doubleleftarrow:`M262 157
480
+ l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
481
+ 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
482
+ 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
483
+ c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
484
+ 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
485
+ -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
486
+ -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
487
+ m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
488
+ -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
489
+ 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
490
+ -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
491
+ -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
492
+ -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
493
+ c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
494
+ -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
495
+ 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
496
+ -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
497
+ c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
498
+ 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
499
+ 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
500
+ l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
501
+ -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
502
+ 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
503
+ 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
504
+ 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
505
+ -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
506
+ H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
507
+ 435 0h399565z`,leftgroupunder:`M400000 262
508
+ H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
509
+ 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
510
+ -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
511
+ -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
512
+ -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
513
+ 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
514
+ -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
515
+ -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
516
+ m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
517
+ 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
518
+ 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
519
+ -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
520
+ 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
521
+ -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
522
+ v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
523
+ -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
524
+ -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
525
+ 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
526
+ M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
527
+ M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
528
+ -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
529
+ c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
530
+ 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
531
+ M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
532
+ c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
533
+ -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
534
+ 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
535
+ 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
536
+ c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
537
+ 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
538
+ 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
539
+ -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
540
+ -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
541
+ m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
542
+ 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
543
+ -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
544
+ m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
545
+ c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
546
+ -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
547
+ m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
548
+ 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
549
+ -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
550
+ m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
551
+ c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
552
+ -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
553
+ 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
554
+ 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
555
+ -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
556
+ -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
557
+ 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
558
+ -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
559
+ s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
560
+ c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
561
+ 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
562
+ -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
563
+ 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
564
+ 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
565
+ -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
566
+ -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
567
+ 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
568
+ -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
569
+ 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
570
+ m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
571
+ 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
572
+ -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
573
+ -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
574
+ 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
575
+ 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
576
+ -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
577
+ m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
578
+ 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
579
+ -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
580
+ 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
581
+ M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
582
+ 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
583
+ -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
584
+ -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
585
+ 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
586
+ -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
587
+ -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
588
+ -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
589
+ 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
590
+ c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
591
+ 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
592
+ 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
593
+ -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
594
+ 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
595
+ -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
596
+ 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
597
+ 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
598
+ -68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
599
+ -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
600
+ 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
601
+ c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
602
+ 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
603
+ -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
604
+ 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
605
+ 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
606
+ -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
607
+ -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
608
+ 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
609
+ 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
610
+ -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
611
+ 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
612
+ 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
613
+ -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
614
+ -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
615
+ H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
616
+ c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
617
+ c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
618
+ -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
619
+ -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
620
+ -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
621
+ -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
622
+ -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
623
+ -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
624
+ -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
625
+ c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
626
+ c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
627
+ s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
628
+ 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
629
+ s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
630
+ c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
631
+ M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
632
+ -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
633
+ 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
634
+ -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
635
+ -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
636
+ -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
637
+ 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
638
+ c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
639
+ c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
640
+ c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
641
+ c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
642
+ M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
643
+ c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
644
+ -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
645
+ c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
646
+ M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
647
+ c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
648
+ 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
649
+ -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
650
+ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
651
+ c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
652
+ -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
653
+ c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
654
+ M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},U3=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 h347 v-84
655
+ H403z M403 1759 V0 H319 V1759 v`+r+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z
656
+ M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15
657
+ c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15
658
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+" v585 h43z";case"doublevert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15
659
+ c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15
660
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+` v585 h43z
661
+ M367 15 v585 v`+r+` v585 c2.667,10,9.667,15,21,15
662
+ c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15
663
+ c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+r+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+r+` v1715 h263 v84 H319z
664
+ MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+r+` v1799 H0 v-84 H319z
665
+ MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v602 h84z
666
+ M403 1759 V0 H319 V1759 v`+r+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v602 h84z
667
+ M347 1759 V0 h-84 V1759 v`+r+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
668
+ c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
669
+ -36,557 l0,`+(r+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
670
+ 949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
671
+ c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
672
+ -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
673
+ l0,-`+(r+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
674
+ -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
675
+ 63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
676
+ c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(r+9)+`
677
+ c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
678
+ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
679
+ c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
680
+ c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
681
+ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
682
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Is{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t}toMarkup(){for(var t="",r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t}toText(){var t=r=>r.toText();return this.children.map(t).join("")}}var sn={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Js={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},id={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function V3(e,t){sn[e]=t}function y0(e,t,r){if(!sn[t])throw new Error("Font metrics not found for font: "+t+".");var a=e.charCodeAt(0),s=sn[t][a];if(!s&&e[0]in id&&(a=id[e[0]].charCodeAt(0),s=sn[t][a]),!s&&r==="text"&&Ch(a)&&(s=sn[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var No={};function G3(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!No[t]){var r=No[t]={cssEmPerMu:Js.quad[t]/18};for(var a in Js)Js.hasOwnProperty(a)&&(r[a]=Js[a][t])}return No[t]}var K3=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],od=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],ld=function(t,r){return r.size<2?t:K3[t-1][r.size-1]};class vn{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||vn.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=od[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var a in t)t.hasOwnProperty(a)&&(r[a]=t[a]);return new vn(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:ld(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:od[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=ld(vn.BASESIZE,t);return this.size===r&&this.textSize===vn.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==vn.BASESIZE?["sizing","reset-size"+this.size,"size"+vn.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=G3(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}vn.BASESIZE=6;var xl={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},J3={ex:!0,em:!0,mu:!0},Mh=function(t){return typeof t!="string"&&(t=t.unit),t in xl||t in J3||t==="ex"},_t=function(t,r){var a;if(t.unit in xl)a=xl[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")a=r.fontMetrics().cssEmPerMu;else{var s;if(r.style.isTight()?s=r.havingStyle(r.style.text()):s=r,t.unit==="ex")a=s.fontMetrics().xHeight;else if(t.unit==="em")a=s.fontMetrics().quad;else throw new ye("Invalid unit: '"+t.unit+"'");s!==r&&(a*=s.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*a,r.maxSize)},Te=function(t){return+t.toFixed(4)+"em"},Hn=function(t){return t.filter(r=>r).join(" ")},Ah=function(t,r,a){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=a||{},r){r.style.isTight()&&this.classes.push("mtight");var s=r.getColor();s&&(this.style.color=s)}},Th=function(t){var r=document.createElement(t);r.className=Hn(this.classes);for(var a in this.style)this.style.hasOwnProperty(a)&&(r.style[a]=this.style[a]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&r.setAttribute(s,this.attributes[s]);for(var i=0;i<this.children.length;i++)r.appendChild(this.children[i].toNode());return r},Y3=/[\s"'>/=\x00-\x1f]/,Eh=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+Nt.escape(Hn(this.classes))+'"');var a="";for(var s in this.style)this.style.hasOwnProperty(s)&&(a+=Nt.hyphenate(s)+":"+this.style[s]+";");a&&(r+=' style="'+Nt.escape(a)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Y3.test(i))throw new ye("Invalid attribute name '"+i+"'");r+=" "+i+'="'+Nt.escape(this.attributes[i])+'"'}r+=">";for(var o=0;o<this.children.length;o++)r+=this.children[o].toMarkup();return r+="</"+t+">",r};class Ds{constructor(t,r,a,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Ah.call(this,t,a,s),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return Th.call(this,"span")}toMarkup(){return Eh.call(this,"span")}}class v0{constructor(t,r,a,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Ah.call(this,r,s),this.children=a||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return Th.call(this,"a")}toMarkup(){return Eh.call(this,"a")}}class X3{constructor(t,r,a){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.style=a}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var r in this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);return t}toMarkup(){var t='<img src="'+Nt.escape(this.src)+'"'+(' alt="'+Nt.escape(this.alt)+'"'),r="";for(var a in this.style)this.style.hasOwnProperty(a)&&(r+=Nt.hyphenate(a)+":"+this.style[a]+";");return r&&(t+=' style="'+Nt.escape(r)+'"'),t+="'/>",t}}var Q3={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Or{constructor(t,r,a,s,i,o,l,c){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=r||0,this.depth=a||0,this.italic=s||0,this.skew=i||0,this.width=o||0,this.classes=l||[],this.style=c||{},this.maxFontSize=0;var d=P3(this.text.charCodeAt(0));d&&this.classes.push(d+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Q3[this.text])}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createTextNode(this.text),r=null;this.italic>0&&(r=document.createElement("span"),r.style.marginRight=Te(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=Hn(this.classes));for(var a in this.style)this.style.hasOwnProperty(a)&&(r=r||document.createElement("span"),r.style[a]=this.style[a]);return r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="<span";this.classes.length&&(t=!0,r+=' class="',r+=Nt.escape(Hn(this.classes)),r+='"');var a="";this.italic>0&&(a+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(a+=Nt.hyphenate(s)+":"+this.style[s]+";");a&&(t=!0,r+=' style="'+Nt.escape(a)+'"');var i=Nt.escape(this.text);return t?(r+=">",r+=i,r+="</span>",r):i}}class Nn{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&r.setAttribute(a,this.attributes[a]);for(var s=0;s<this.children.length;s++)r.appendChild(this.children[s].toNode());return r}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(t+=" "+r+'="'+Nt.escape(this.attributes[r])+'"');t+=">";for(var a=0;a<this.children.length;a++)t+=this.children[a].toMarkup();return t+="</svg>",t}}class Wn{constructor(t,r){this.pathName=void 0,this.alternate=void 0,this.pathName=t,this.alternate=r}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"path");return this.alternate?r.setAttribute("d",this.alternate):r.setAttribute("d",sd[this.pathName]),r}toMarkup(){return this.alternate?'<path d="'+Nt.escape(this.alternate)+'"/>':'<path d="'+Nt.escape(sd[this.pathName])+'"/>'}}class bl{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var a in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,a)&&r.setAttribute(a,this.attributes[a]);return r}toMarkup(){var t="<line";for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(t+=" "+r+'="'+Nt.escape(this.attributes[r])+'"');return t+="/>",t}}function cd(e){if(e instanceof Or)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function Z3(e){if(e instanceof Ds)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var ek={bin:1,close:1,inner:1,open:1,punct:1,rel:1},tk={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Lt={math:{},text:{}};function f(e,t,r,a,s,i){Lt[e][s]={font:t,group:r,replace:a},i&&a&&(Lt[e][a]=Lt[e][s])}var x="math",pe="text",k="main",D="ams",Bt="accent-token",Re="bin",pr="close",qa="inner",et="mathord",Yt="op-token",Dr="open",_i="punct",L="rel",In="spacing",O="textord";f(x,k,L,"≡","\\equiv",!0);f(x,k,L,"≺","\\prec",!0);f(x,k,L,"≻","\\succ",!0);f(x,k,L,"∼","\\sim",!0);f(x,k,L,"⊥","\\perp");f(x,k,L,"⪯","\\preceq",!0);f(x,k,L,"⪰","\\succeq",!0);f(x,k,L,"≃","\\simeq",!0);f(x,k,L,"∣","\\mid",!0);f(x,k,L,"≪","\\ll",!0);f(x,k,L,"≫","\\gg",!0);f(x,k,L,"≍","\\asymp",!0);f(x,k,L,"∥","\\parallel");f(x,k,L,"⋈","\\bowtie",!0);f(x,k,L,"⌣","\\smile",!0);f(x,k,L,"⊑","\\sqsubseteq",!0);f(x,k,L,"⊒","\\sqsupseteq",!0);f(x,k,L,"≐","\\doteq",!0);f(x,k,L,"⌢","\\frown",!0);f(x,k,L,"∋","\\ni",!0);f(x,k,L,"∝","\\propto",!0);f(x,k,L,"⊢","\\vdash",!0);f(x,k,L,"⊣","\\dashv",!0);f(x,k,L,"∋","\\owns");f(x,k,_i,".","\\ldotp");f(x,k,_i,"⋅","\\cdotp");f(x,k,O,"#","\\#");f(pe,k,O,"#","\\#");f(x,k,O,"&","\\&");f(pe,k,O,"&","\\&");f(x,k,O,"ℵ","\\aleph",!0);f(x,k,O,"∀","\\forall",!0);f(x,k,O,"ℏ","\\hbar",!0);f(x,k,O,"∃","\\exists",!0);f(x,k,O,"∇","\\nabla",!0);f(x,k,O,"♭","\\flat",!0);f(x,k,O,"ℓ","\\ell",!0);f(x,k,O,"♮","\\natural",!0);f(x,k,O,"♣","\\clubsuit",!0);f(x,k,O,"℘","\\wp",!0);f(x,k,O,"♯","\\sharp",!0);f(x,k,O,"♢","\\diamondsuit",!0);f(x,k,O,"ℜ","\\Re",!0);f(x,k,O,"♡","\\heartsuit",!0);f(x,k,O,"ℑ","\\Im",!0);f(x,k,O,"♠","\\spadesuit",!0);f(x,k,O,"§","\\S",!0);f(pe,k,O,"§","\\S");f(x,k,O,"¶","\\P",!0);f(pe,k,O,"¶","\\P");f(x,k,O,"†","\\dag");f(pe,k,O,"†","\\dag");f(pe,k,O,"†","\\textdagger");f(x,k,O,"‡","\\ddag");f(pe,k,O,"‡","\\ddag");f(pe,k,O,"‡","\\textdaggerdbl");f(x,k,pr,"⎱","\\rmoustache",!0);f(x,k,Dr,"⎰","\\lmoustache",!0);f(x,k,pr,"⟯","\\rgroup",!0);f(x,k,Dr,"⟮","\\lgroup",!0);f(x,k,Re,"∓","\\mp",!0);f(x,k,Re,"⊖","\\ominus",!0);f(x,k,Re,"⊎","\\uplus",!0);f(x,k,Re,"⊓","\\sqcap",!0);f(x,k,Re,"∗","\\ast");f(x,k,Re,"⊔","\\sqcup",!0);f(x,k,Re,"◯","\\bigcirc",!0);f(x,k,Re,"∙","\\bullet",!0);f(x,k,Re,"‡","\\ddagger");f(x,k,Re,"≀","\\wr",!0);f(x,k,Re,"⨿","\\amalg");f(x,k,Re,"&","\\And");f(x,k,L,"⟵","\\longleftarrow",!0);f(x,k,L,"⇐","\\Leftarrow",!0);f(x,k,L,"⟸","\\Longleftarrow",!0);f(x,k,L,"⟶","\\longrightarrow",!0);f(x,k,L,"⇒","\\Rightarrow",!0);f(x,k,L,"⟹","\\Longrightarrow",!0);f(x,k,L,"↔","\\leftrightarrow",!0);f(x,k,L,"⟷","\\longleftrightarrow",!0);f(x,k,L,"⇔","\\Leftrightarrow",!0);f(x,k,L,"⟺","\\Longleftrightarrow",!0);f(x,k,L,"↦","\\mapsto",!0);f(x,k,L,"⟼","\\longmapsto",!0);f(x,k,L,"↗","\\nearrow",!0);f(x,k,L,"↩","\\hookleftarrow",!0);f(x,k,L,"↪","\\hookrightarrow",!0);f(x,k,L,"↘","\\searrow",!0);f(x,k,L,"↼","\\leftharpoonup",!0);f(x,k,L,"⇀","\\rightharpoonup",!0);f(x,k,L,"↙","\\swarrow",!0);f(x,k,L,"↽","\\leftharpoondown",!0);f(x,k,L,"⇁","\\rightharpoondown",!0);f(x,k,L,"↖","\\nwarrow",!0);f(x,k,L,"⇌","\\rightleftharpoons",!0);f(x,D,L,"≮","\\nless",!0);f(x,D,L,"","\\@nleqslant");f(x,D,L,"","\\@nleqq");f(x,D,L,"⪇","\\lneq",!0);f(x,D,L,"≨","\\lneqq",!0);f(x,D,L,"","\\@lvertneqq");f(x,D,L,"⋦","\\lnsim",!0);f(x,D,L,"⪉","\\lnapprox",!0);f(x,D,L,"⊀","\\nprec",!0);f(x,D,L,"⋠","\\npreceq",!0);f(x,D,L,"⋨","\\precnsim",!0);f(x,D,L,"⪹","\\precnapprox",!0);f(x,D,L,"≁","\\nsim",!0);f(x,D,L,"","\\@nshortmid");f(x,D,L,"∤","\\nmid",!0);f(x,D,L,"⊬","\\nvdash",!0);f(x,D,L,"⊭","\\nvDash",!0);f(x,D,L,"⋪","\\ntriangleleft");f(x,D,L,"⋬","\\ntrianglelefteq",!0);f(x,D,L,"⊊","\\subsetneq",!0);f(x,D,L,"","\\@varsubsetneq");f(x,D,L,"⫋","\\subsetneqq",!0);f(x,D,L,"","\\@varsubsetneqq");f(x,D,L,"≯","\\ngtr",!0);f(x,D,L,"","\\@ngeqslant");f(x,D,L,"","\\@ngeqq");f(x,D,L,"⪈","\\gneq",!0);f(x,D,L,"≩","\\gneqq",!0);f(x,D,L,"","\\@gvertneqq");f(x,D,L,"⋧","\\gnsim",!0);f(x,D,L,"⪊","\\gnapprox",!0);f(x,D,L,"⊁","\\nsucc",!0);f(x,D,L,"⋡","\\nsucceq",!0);f(x,D,L,"⋩","\\succnsim",!0);f(x,D,L,"⪺","\\succnapprox",!0);f(x,D,L,"≆","\\ncong",!0);f(x,D,L,"","\\@nshortparallel");f(x,D,L,"∦","\\nparallel",!0);f(x,D,L,"⊯","\\nVDash",!0);f(x,D,L,"⋫","\\ntriangleright");f(x,D,L,"⋭","\\ntrianglerighteq",!0);f(x,D,L,"","\\@nsupseteqq");f(x,D,L,"⊋","\\supsetneq",!0);f(x,D,L,"","\\@varsupsetneq");f(x,D,L,"⫌","\\supsetneqq",!0);f(x,D,L,"","\\@varsupsetneqq");f(x,D,L,"⊮","\\nVdash",!0);f(x,D,L,"⪵","\\precneqq",!0);f(x,D,L,"⪶","\\succneqq",!0);f(x,D,L,"","\\@nsubseteqq");f(x,D,Re,"⊴","\\unlhd");f(x,D,Re,"⊵","\\unrhd");f(x,D,L,"↚","\\nleftarrow",!0);f(x,D,L,"↛","\\nrightarrow",!0);f(x,D,L,"⇍","\\nLeftarrow",!0);f(x,D,L,"⇏","\\nRightarrow",!0);f(x,D,L,"↮","\\nleftrightarrow",!0);f(x,D,L,"⇎","\\nLeftrightarrow",!0);f(x,D,L,"△","\\vartriangle");f(x,D,O,"ℏ","\\hslash");f(x,D,O,"▽","\\triangledown");f(x,D,O,"◊","\\lozenge");f(x,D,O,"Ⓢ","\\circledS");f(x,D,O,"®","\\circledR");f(pe,D,O,"®","\\circledR");f(x,D,O,"∡","\\measuredangle",!0);f(x,D,O,"∄","\\nexists");f(x,D,O,"℧","\\mho");f(x,D,O,"Ⅎ","\\Finv",!0);f(x,D,O,"⅁","\\Game",!0);f(x,D,O,"‵","\\backprime");f(x,D,O,"▲","\\blacktriangle");f(x,D,O,"▼","\\blacktriangledown");f(x,D,O,"■","\\blacksquare");f(x,D,O,"⧫","\\blacklozenge");f(x,D,O,"★","\\bigstar");f(x,D,O,"∢","\\sphericalangle",!0);f(x,D,O,"∁","\\complement",!0);f(x,D,O,"ð","\\eth",!0);f(pe,k,O,"ð","ð");f(x,D,O,"╱","\\diagup");f(x,D,O,"╲","\\diagdown");f(x,D,O,"□","\\square");f(x,D,O,"□","\\Box");f(x,D,O,"◊","\\Diamond");f(x,D,O,"¥","\\yen",!0);f(pe,D,O,"¥","\\yen",!0);f(x,D,O,"✓","\\checkmark",!0);f(pe,D,O,"✓","\\checkmark");f(x,D,O,"ℶ","\\beth",!0);f(x,D,O,"ℸ","\\daleth",!0);f(x,D,O,"ℷ","\\gimel",!0);f(x,D,O,"ϝ","\\digamma",!0);f(x,D,O,"ϰ","\\varkappa");f(x,D,Dr,"┌","\\@ulcorner",!0);f(x,D,pr,"┐","\\@urcorner",!0);f(x,D,Dr,"└","\\@llcorner",!0);f(x,D,pr,"┘","\\@lrcorner",!0);f(x,D,L,"≦","\\leqq",!0);f(x,D,L,"⩽","\\leqslant",!0);f(x,D,L,"⪕","\\eqslantless",!0);f(x,D,L,"≲","\\lesssim",!0);f(x,D,L,"⪅","\\lessapprox",!0);f(x,D,L,"≊","\\approxeq",!0);f(x,D,Re,"⋖","\\lessdot");f(x,D,L,"⋘","\\lll",!0);f(x,D,L,"≶","\\lessgtr",!0);f(x,D,L,"⋚","\\lesseqgtr",!0);f(x,D,L,"⪋","\\lesseqqgtr",!0);f(x,D,L,"≑","\\doteqdot");f(x,D,L,"≓","\\risingdotseq",!0);f(x,D,L,"≒","\\fallingdotseq",!0);f(x,D,L,"∽","\\backsim",!0);f(x,D,L,"⋍","\\backsimeq",!0);f(x,D,L,"⫅","\\subseteqq",!0);f(x,D,L,"⋐","\\Subset",!0);f(x,D,L,"⊏","\\sqsubset",!0);f(x,D,L,"≼","\\preccurlyeq",!0);f(x,D,L,"⋞","\\curlyeqprec",!0);f(x,D,L,"≾","\\precsim",!0);f(x,D,L,"⪷","\\precapprox",!0);f(x,D,L,"⊲","\\vartriangleleft");f(x,D,L,"⊴","\\trianglelefteq");f(x,D,L,"⊨","\\vDash",!0);f(x,D,L,"⊪","\\Vvdash",!0);f(x,D,L,"⌣","\\smallsmile");f(x,D,L,"⌢","\\smallfrown");f(x,D,L,"≏","\\bumpeq",!0);f(x,D,L,"≎","\\Bumpeq",!0);f(x,D,L,"≧","\\geqq",!0);f(x,D,L,"⩾","\\geqslant",!0);f(x,D,L,"⪖","\\eqslantgtr",!0);f(x,D,L,"≳","\\gtrsim",!0);f(x,D,L,"⪆","\\gtrapprox",!0);f(x,D,Re,"⋗","\\gtrdot");f(x,D,L,"⋙","\\ggg",!0);f(x,D,L,"≷","\\gtrless",!0);f(x,D,L,"⋛","\\gtreqless",!0);f(x,D,L,"⪌","\\gtreqqless",!0);f(x,D,L,"≖","\\eqcirc",!0);f(x,D,L,"≗","\\circeq",!0);f(x,D,L,"≜","\\triangleq",!0);f(x,D,L,"∼","\\thicksim");f(x,D,L,"≈","\\thickapprox");f(x,D,L,"⫆","\\supseteqq",!0);f(x,D,L,"⋑","\\Supset",!0);f(x,D,L,"⊐","\\sqsupset",!0);f(x,D,L,"≽","\\succcurlyeq",!0);f(x,D,L,"⋟","\\curlyeqsucc",!0);f(x,D,L,"≿","\\succsim",!0);f(x,D,L,"⪸","\\succapprox",!0);f(x,D,L,"⊳","\\vartriangleright");f(x,D,L,"⊵","\\trianglerighteq");f(x,D,L,"⊩","\\Vdash",!0);f(x,D,L,"∣","\\shortmid");f(x,D,L,"∥","\\shortparallel");f(x,D,L,"≬","\\between",!0);f(x,D,L,"⋔","\\pitchfork",!0);f(x,D,L,"∝","\\varpropto");f(x,D,L,"◀","\\blacktriangleleft");f(x,D,L,"∴","\\therefore",!0);f(x,D,L,"∍","\\backepsilon");f(x,D,L,"▶","\\blacktriangleright");f(x,D,L,"∵","\\because",!0);f(x,D,L,"⋘","\\llless");f(x,D,L,"⋙","\\gggtr");f(x,D,Re,"⊲","\\lhd");f(x,D,Re,"⊳","\\rhd");f(x,D,L,"≂","\\eqsim",!0);f(x,k,L,"⋈","\\Join");f(x,D,L,"≑","\\Doteq",!0);f(x,D,Re,"∔","\\dotplus",!0);f(x,D,Re,"∖","\\smallsetminus");f(x,D,Re,"⋒","\\Cap",!0);f(x,D,Re,"⋓","\\Cup",!0);f(x,D,Re,"⩞","\\doublebarwedge",!0);f(x,D,Re,"⊟","\\boxminus",!0);f(x,D,Re,"⊞","\\boxplus",!0);f(x,D,Re,"⋇","\\divideontimes",!0);f(x,D,Re,"⋉","\\ltimes",!0);f(x,D,Re,"⋊","\\rtimes",!0);f(x,D,Re,"⋋","\\leftthreetimes",!0);f(x,D,Re,"⋌","\\rightthreetimes",!0);f(x,D,Re,"⋏","\\curlywedge",!0);f(x,D,Re,"⋎","\\curlyvee",!0);f(x,D,Re,"⊝","\\circleddash",!0);f(x,D,Re,"⊛","\\circledast",!0);f(x,D,Re,"⋅","\\centerdot");f(x,D,Re,"⊺","\\intercal",!0);f(x,D,Re,"⋒","\\doublecap");f(x,D,Re,"⋓","\\doublecup");f(x,D,Re,"⊠","\\boxtimes",!0);f(x,D,L,"⇢","\\dashrightarrow",!0);f(x,D,L,"⇠","\\dashleftarrow",!0);f(x,D,L,"⇇","\\leftleftarrows",!0);f(x,D,L,"⇆","\\leftrightarrows",!0);f(x,D,L,"⇚","\\Lleftarrow",!0);f(x,D,L,"↞","\\twoheadleftarrow",!0);f(x,D,L,"↢","\\leftarrowtail",!0);f(x,D,L,"↫","\\looparrowleft",!0);f(x,D,L,"⇋","\\leftrightharpoons",!0);f(x,D,L,"↶","\\curvearrowleft",!0);f(x,D,L,"↺","\\circlearrowleft",!0);f(x,D,L,"↰","\\Lsh",!0);f(x,D,L,"⇈","\\upuparrows",!0);f(x,D,L,"↿","\\upharpoonleft",!0);f(x,D,L,"⇃","\\downharpoonleft",!0);f(x,k,L,"⊶","\\origof",!0);f(x,k,L,"⊷","\\imageof",!0);f(x,D,L,"⊸","\\multimap",!0);f(x,D,L,"↭","\\leftrightsquigarrow",!0);f(x,D,L,"⇉","\\rightrightarrows",!0);f(x,D,L,"⇄","\\rightleftarrows",!0);f(x,D,L,"↠","\\twoheadrightarrow",!0);f(x,D,L,"↣","\\rightarrowtail",!0);f(x,D,L,"↬","\\looparrowright",!0);f(x,D,L,"↷","\\curvearrowright",!0);f(x,D,L,"↻","\\circlearrowright",!0);f(x,D,L,"↱","\\Rsh",!0);f(x,D,L,"⇊","\\downdownarrows",!0);f(x,D,L,"↾","\\upharpoonright",!0);f(x,D,L,"⇂","\\downharpoonright",!0);f(x,D,L,"⇝","\\rightsquigarrow",!0);f(x,D,L,"⇝","\\leadsto");f(x,D,L,"⇛","\\Rrightarrow",!0);f(x,D,L,"↾","\\restriction");f(x,k,O,"‘","`");f(x,k,O,"$","\\$");f(pe,k,O,"$","\\$");f(pe,k,O,"$","\\textdollar");f(x,k,O,"%","\\%");f(pe,k,O,"%","\\%");f(x,k,O,"_","\\_");f(pe,k,O,"_","\\_");f(pe,k,O,"_","\\textunderscore");f(x,k,O,"∠","\\angle",!0);f(x,k,O,"∞","\\infty",!0);f(x,k,O,"′","\\prime");f(x,k,O,"△","\\triangle");f(x,k,O,"Γ","\\Gamma",!0);f(x,k,O,"Δ","\\Delta",!0);f(x,k,O,"Θ","\\Theta",!0);f(x,k,O,"Λ","\\Lambda",!0);f(x,k,O,"Ξ","\\Xi",!0);f(x,k,O,"Π","\\Pi",!0);f(x,k,O,"Σ","\\Sigma",!0);f(x,k,O,"Υ","\\Upsilon",!0);f(x,k,O,"Φ","\\Phi",!0);f(x,k,O,"Ψ","\\Psi",!0);f(x,k,O,"Ω","\\Omega",!0);f(x,k,O,"A","Α");f(x,k,O,"B","Β");f(x,k,O,"E","Ε");f(x,k,O,"Z","Ζ");f(x,k,O,"H","Η");f(x,k,O,"I","Ι");f(x,k,O,"K","Κ");f(x,k,O,"M","Μ");f(x,k,O,"N","Ν");f(x,k,O,"O","Ο");f(x,k,O,"P","Ρ");f(x,k,O,"T","Τ");f(x,k,O,"X","Χ");f(x,k,O,"¬","\\neg",!0);f(x,k,O,"¬","\\lnot");f(x,k,O,"⊤","\\top");f(x,k,O,"⊥","\\bot");f(x,k,O,"∅","\\emptyset");f(x,D,O,"∅","\\varnothing");f(x,k,et,"α","\\alpha",!0);f(x,k,et,"β","\\beta",!0);f(x,k,et,"γ","\\gamma",!0);f(x,k,et,"δ","\\delta",!0);f(x,k,et,"ϵ","\\epsilon",!0);f(x,k,et,"ζ","\\zeta",!0);f(x,k,et,"η","\\eta",!0);f(x,k,et,"θ","\\theta",!0);f(x,k,et,"ι","\\iota",!0);f(x,k,et,"κ","\\kappa",!0);f(x,k,et,"λ","\\lambda",!0);f(x,k,et,"μ","\\mu",!0);f(x,k,et,"ν","\\nu",!0);f(x,k,et,"ξ","\\xi",!0);f(x,k,et,"ο","\\omicron",!0);f(x,k,et,"π","\\pi",!0);f(x,k,et,"ρ","\\rho",!0);f(x,k,et,"σ","\\sigma",!0);f(x,k,et,"τ","\\tau",!0);f(x,k,et,"υ","\\upsilon",!0);f(x,k,et,"ϕ","\\phi",!0);f(x,k,et,"χ","\\chi",!0);f(x,k,et,"ψ","\\psi",!0);f(x,k,et,"ω","\\omega",!0);f(x,k,et,"ε","\\varepsilon",!0);f(x,k,et,"ϑ","\\vartheta",!0);f(x,k,et,"ϖ","\\varpi",!0);f(x,k,et,"ϱ","\\varrho",!0);f(x,k,et,"ς","\\varsigma",!0);f(x,k,et,"φ","\\varphi",!0);f(x,k,Re,"∗","*",!0);f(x,k,Re,"+","+");f(x,k,Re,"−","-",!0);f(x,k,Re,"⋅","\\cdot",!0);f(x,k,Re,"∘","\\circ",!0);f(x,k,Re,"÷","\\div",!0);f(x,k,Re,"±","\\pm",!0);f(x,k,Re,"×","\\times",!0);f(x,k,Re,"∩","\\cap",!0);f(x,k,Re,"∪","\\cup",!0);f(x,k,Re,"∖","\\setminus",!0);f(x,k,Re,"∧","\\land");f(x,k,Re,"∨","\\lor");f(x,k,Re,"∧","\\wedge",!0);f(x,k,Re,"∨","\\vee",!0);f(x,k,O,"√","\\surd");f(x,k,Dr,"⟨","\\langle",!0);f(x,k,Dr,"∣","\\lvert");f(x,k,Dr,"∥","\\lVert");f(x,k,pr,"?","?");f(x,k,pr,"!","!");f(x,k,pr,"⟩","\\rangle",!0);f(x,k,pr,"∣","\\rvert");f(x,k,pr,"∥","\\rVert");f(x,k,L,"=","=");f(x,k,L,":",":");f(x,k,L,"≈","\\approx",!0);f(x,k,L,"≅","\\cong",!0);f(x,k,L,"≥","\\ge");f(x,k,L,"≥","\\geq",!0);f(x,k,L,"←","\\gets");f(x,k,L,">","\\gt",!0);f(x,k,L,"∈","\\in",!0);f(x,k,L,"","\\@not");f(x,k,L,"⊂","\\subset",!0);f(x,k,L,"⊃","\\supset",!0);f(x,k,L,"⊆","\\subseteq",!0);f(x,k,L,"⊇","\\supseteq",!0);f(x,D,L,"⊈","\\nsubseteq",!0);f(x,D,L,"⊉","\\nsupseteq",!0);f(x,k,L,"⊨","\\models");f(x,k,L,"←","\\leftarrow",!0);f(x,k,L,"≤","\\le");f(x,k,L,"≤","\\leq",!0);f(x,k,L,"<","\\lt",!0);f(x,k,L,"→","\\rightarrow",!0);f(x,k,L,"→","\\to");f(x,D,L,"≱","\\ngeq",!0);f(x,D,L,"≰","\\nleq",!0);f(x,k,In," ","\\ ");f(x,k,In," ","\\space");f(x,k,In," ","\\nobreakspace");f(pe,k,In," ","\\ ");f(pe,k,In," "," ");f(pe,k,In," ","\\space");f(pe,k,In," ","\\nobreakspace");f(x,k,In,null,"\\nobreak");f(x,k,In,null,"\\allowbreak");f(x,k,_i,",",",");f(x,k,_i,";",";");f(x,D,Re,"⊼","\\barwedge",!0);f(x,D,Re,"⊻","\\veebar",!0);f(x,k,Re,"⊙","\\odot",!0);f(x,k,Re,"⊕","\\oplus",!0);f(x,k,Re,"⊗","\\otimes",!0);f(x,k,O,"∂","\\partial",!0);f(x,k,Re,"⊘","\\oslash",!0);f(x,D,Re,"⊚","\\circledcirc",!0);f(x,D,Re,"⊡","\\boxdot",!0);f(x,k,Re,"△","\\bigtriangleup");f(x,k,Re,"▽","\\bigtriangledown");f(x,k,Re,"†","\\dagger");f(x,k,Re,"⋄","\\diamond");f(x,k,Re,"⋆","\\star");f(x,k,Re,"◃","\\triangleleft");f(x,k,Re,"▹","\\triangleright");f(x,k,Dr,"{","\\{");f(pe,k,O,"{","\\{");f(pe,k,O,"{","\\textbraceleft");f(x,k,pr,"}","\\}");f(pe,k,O,"}","\\}");f(pe,k,O,"}","\\textbraceright");f(x,k,Dr,"{","\\lbrace");f(x,k,pr,"}","\\rbrace");f(x,k,Dr,"[","\\lbrack",!0);f(pe,k,O,"[","\\lbrack",!0);f(x,k,pr,"]","\\rbrack",!0);f(pe,k,O,"]","\\rbrack",!0);f(x,k,Dr,"(","\\lparen",!0);f(x,k,pr,")","\\rparen",!0);f(pe,k,O,"<","\\textless",!0);f(pe,k,O,">","\\textgreater",!0);f(x,k,Dr,"⌊","\\lfloor",!0);f(x,k,pr,"⌋","\\rfloor",!0);f(x,k,Dr,"⌈","\\lceil",!0);f(x,k,pr,"⌉","\\rceil",!0);f(x,k,O,"\\","\\backslash");f(x,k,O,"∣","|");f(x,k,O,"∣","\\vert");f(pe,k,O,"|","\\textbar",!0);f(x,k,O,"∥","\\|");f(x,k,O,"∥","\\Vert");f(pe,k,O,"∥","\\textbardbl");f(pe,k,O,"~","\\textasciitilde");f(pe,k,O,"\\","\\textbackslash");f(pe,k,O,"^","\\textasciicircum");f(x,k,L,"↑","\\uparrow",!0);f(x,k,L,"⇑","\\Uparrow",!0);f(x,k,L,"↓","\\downarrow",!0);f(x,k,L,"⇓","\\Downarrow",!0);f(x,k,L,"↕","\\updownarrow",!0);f(x,k,L,"⇕","\\Updownarrow",!0);f(x,k,Yt,"∐","\\coprod");f(x,k,Yt,"⋁","\\bigvee");f(x,k,Yt,"⋀","\\bigwedge");f(x,k,Yt,"⨄","\\biguplus");f(x,k,Yt,"⋂","\\bigcap");f(x,k,Yt,"⋃","\\bigcup");f(x,k,Yt,"∫","\\int");f(x,k,Yt,"∫","\\intop");f(x,k,Yt,"∬","\\iint");f(x,k,Yt,"∭","\\iiint");f(x,k,Yt,"∏","\\prod");f(x,k,Yt,"∑","\\sum");f(x,k,Yt,"⨂","\\bigotimes");f(x,k,Yt,"⨁","\\bigoplus");f(x,k,Yt,"⨀","\\bigodot");f(x,k,Yt,"∮","\\oint");f(x,k,Yt,"∯","\\oiint");f(x,k,Yt,"∰","\\oiiint");f(x,k,Yt,"⨆","\\bigsqcup");f(x,k,Yt,"∫","\\smallint");f(pe,k,qa,"…","\\textellipsis");f(x,k,qa,"…","\\mathellipsis");f(pe,k,qa,"…","\\ldots",!0);f(x,k,qa,"…","\\ldots",!0);f(x,k,qa,"⋯","\\@cdots",!0);f(x,k,qa,"⋱","\\ddots",!0);f(x,k,O,"⋮","\\varvdots");f(pe,k,O,"⋮","\\varvdots");f(x,k,Bt,"ˊ","\\acute");f(x,k,Bt,"ˋ","\\grave");f(x,k,Bt,"¨","\\ddot");f(x,k,Bt,"~","\\tilde");f(x,k,Bt,"ˉ","\\bar");f(x,k,Bt,"˘","\\breve");f(x,k,Bt,"ˇ","\\check");f(x,k,Bt,"^","\\hat");f(x,k,Bt,"⃗","\\vec");f(x,k,Bt,"˙","\\dot");f(x,k,Bt,"˚","\\mathring");f(x,k,et,"","\\@imath");f(x,k,et,"","\\@jmath");f(x,k,O,"ı","ı");f(x,k,O,"ȷ","ȷ");f(pe,k,O,"ı","\\i",!0);f(pe,k,O,"ȷ","\\j",!0);f(pe,k,O,"ß","\\ss",!0);f(pe,k,O,"æ","\\ae",!0);f(pe,k,O,"œ","\\oe",!0);f(pe,k,O,"ø","\\o",!0);f(pe,k,O,"Æ","\\AE",!0);f(pe,k,O,"Œ","\\OE",!0);f(pe,k,O,"Ø","\\O",!0);f(pe,k,Bt,"ˊ","\\'");f(pe,k,Bt,"ˋ","\\`");f(pe,k,Bt,"ˆ","\\^");f(pe,k,Bt,"˜","\\~");f(pe,k,Bt,"ˉ","\\=");f(pe,k,Bt,"˘","\\u");f(pe,k,Bt,"˙","\\.");f(pe,k,Bt,"¸","\\c");f(pe,k,Bt,"˚","\\r");f(pe,k,Bt,"ˇ","\\v");f(pe,k,Bt,"¨",'\\"');f(pe,k,Bt,"˝","\\H");f(pe,k,Bt,"◯","\\textcircled");var Ih={"--":!0,"---":!0,"``":!0,"''":!0};f(pe,k,O,"–","--",!0);f(pe,k,O,"–","\\textendash");f(pe,k,O,"—","---",!0);f(pe,k,O,"—","\\textemdash");f(pe,k,O,"‘","`",!0);f(pe,k,O,"‘","\\textquoteleft");f(pe,k,O,"’","'",!0);f(pe,k,O,"’","\\textquoteright");f(pe,k,O,"“","``",!0);f(pe,k,O,"“","\\textquotedblleft");f(pe,k,O,"”","''",!0);f(pe,k,O,"”","\\textquotedblright");f(x,k,O,"°","\\degree",!0);f(pe,k,O,"°","\\degree");f(pe,k,O,"°","\\textdegree",!0);f(x,k,O,"£","\\pounds");f(x,k,O,"£","\\mathsterling",!0);f(pe,k,O,"£","\\pounds");f(pe,k,O,"£","\\textsterling",!0);f(x,D,O,"✠","\\maltese");f(pe,D,O,"✠","\\maltese");var dd='0123456789/@."';for(var So=0;So<dd.length;So++){var ud=dd.charAt(So);f(x,k,O,ud,ud)}var md='0123456789!@*()-=+";:?/.,';for(var Co=0;Co<md.length;Co++){var hd=md.charAt(Co);f(pe,k,O,hd,hd)}var ji="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var Mo=0;Mo<ji.length;Mo++){var Ys=ji.charAt(Mo);f(x,k,et,Ys,Ys),f(pe,k,O,Ys,Ys)}f(x,D,O,"C","ℂ");f(pe,D,O,"C","ℂ");f(x,D,O,"H","ℍ");f(pe,D,O,"H","ℍ");f(x,D,O,"N","ℕ");f(pe,D,O,"N","ℕ");f(x,D,O,"P","ℙ");f(pe,D,O,"P","ℙ");f(x,D,O,"Q","ℚ");f(pe,D,O,"Q","ℚ");f(x,D,O,"R","ℝ");f(pe,D,O,"R","ℝ");f(x,D,O,"Z","ℤ");f(pe,D,O,"Z","ℤ");f(x,k,et,"h","ℎ");f(pe,k,et,"h","ℎ");var nt="";for(var cr=0;cr<ji.length;cr++){var qt=ji.charAt(cr);nt=String.fromCharCode(55349,56320+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56372+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56424+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56580+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56684+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56736+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56788+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56840+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56944+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),cr<26&&(nt=String.fromCharCode(55349,56632+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt),nt=String.fromCharCode(55349,56476+cr),f(x,k,et,qt,nt),f(pe,k,O,qt,nt))}nt="𝕜";f(x,k,et,"k",nt);f(pe,k,O,"k",nt);for(var ra=0;ra<10;ra++){var Fn=ra.toString();nt=String.fromCharCode(55349,57294+ra),f(x,k,et,Fn,nt),f(pe,k,O,Fn,nt),nt=String.fromCharCode(55349,57314+ra),f(x,k,et,Fn,nt),f(pe,k,O,Fn,nt),nt=String.fromCharCode(55349,57324+ra),f(x,k,et,Fn,nt),f(pe,k,O,Fn,nt),nt=String.fromCharCode(55349,57334+ra),f(x,k,et,Fn,nt),f(pe,k,O,Fn,nt)}var yl="ÐÞþ";for(var Ao=0;Ao<yl.length;Ao++){var Xs=yl.charAt(Ao);f(x,k,et,Xs,Xs),f(pe,k,O,Xs,Xs)}var Qs=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],pd=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],rk=function(t,r){var a=t.charCodeAt(0),s=t.charCodeAt(1),i=(a-55296)*1024+(s-56320)+65536,o=r==="math"?0:1;if(119808<=i&&i<120484){var l=Math.floor((i-119808)/26);return[Qs[l][2],Qs[l][o]]}else if(120782<=i&&i<=120831){var c=Math.floor((i-120782)/10);return[pd[c][2],pd[c][o]]}else{if(i===120485||i===120486)return[Qs[0][2],Qs[0][o]];if(120486<i&&i<120782)return["",""];throw new ye("Unsupported character: "+t)}},qi=function(t,r,a){return Lt[a][t]&&Lt[a][t].replace&&(t=Lt[a][t].replace),{value:t,metrics:y0(t,r,a)}},Vr=function(t,r,a,s,i){var o=qi(t,r,a),l=o.metrics;t=o.value;var c;if(l){var d=l.italic;(a==="text"||s&&s.font==="mathit")&&(d=0),c=new Or(t,l.height,l.depth,d,l.skew,l.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+r+"' and mode '"+a+"'")),c=new Or(t,0,0,0,0,0,i);if(s){c.maxFontSize=s.sizeMultiplier,s.style.isTight()&&c.classes.push("mtight");var u=s.getColor();u&&(c.style.color=u)}return c},nk=function(t,r,a,s){return s===void 0&&(s=[]),a.font==="boldsymbol"&&qi(t,"Main-Bold",r).metrics?Vr(t,"Main-Bold",r,a,s.concat(["mathbf"])):t==="\\"||Lt[r][t].font==="main"?Vr(t,"Main-Regular",r,a,s):Vr(t,"AMS-Regular",r,a,s.concat(["amsrm"]))},ak=function(t,r,a,s,i){return i!=="textord"&&qi(t,"Math-BoldItalic",r).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},sk=function(t,r,a){var s=t.mode,i=t.text,o=["mord"],l=s==="math"||s==="text"&&r.font,c=l?r.font:r.fontFamily,d="",u="";if(i.charCodeAt(0)===55349&&([d,u]=rk(i,s)),d.length>0)return Vr(i,d,s,r,o.concat(u));if(c){var m,h;if(c==="boldsymbol"){var p=ak(i,s,r,o,a);m=p.fontName,h=[p.fontClass]}else l?(m=Lh[c].fontName,h=[c]):(m=Zs(c,r.fontWeight,r.fontShape),h=[c,r.fontWeight,r.fontShape]);if(qi(i,m,s).metrics)return Vr(i,m,s,r,o.concat(h));if(Ih.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var g=[],y=0;y<i.length;y++)g.push(Vr(i[y],m,s,r,o.concat(h)));return zh(g)}}if(a==="mathord")return Vr(i,"Math-Italic",s,r,o.concat(["mathnormal"]));if(a==="textord"){var v=Lt[s][i]&&Lt[s][i].font;if(v==="ams"){var w=Zs("amsrm",r.fontWeight,r.fontShape);return Vr(i,w,s,r,o.concat("amsrm",r.fontWeight,r.fontShape))}else if(v==="main"||!v){var S=Zs("textrm",r.fontWeight,r.fontShape);return Vr(i,S,s,r,o.concat(r.fontWeight,r.fontShape))}else{var N=Zs(v,r.fontWeight,r.fontShape);return Vr(i,N,s,r,o.concat(N,r.fontWeight,r.fontShape))}}else throw new Error("unexpected type: "+a+" in makeOrd")},ik=(e,t)=>{if(Hn(e.classes)!==Hn(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var a in e.style)if(e.style.hasOwnProperty(a)&&e.style[a]!==t.style[a])return!1;for(var s in t.style)if(t.style.hasOwnProperty(s)&&e.style[s]!==t.style[s])return!1;return!0},ok=e=>{for(var t=0;t<e.length-1;t++){var r=e[t],a=e[t+1];r instanceof Or&&a instanceof Or&&ik(r,a)&&(r.text+=a.text,r.height=Math.max(r.height,a.height),r.depth=Math.max(r.depth,a.depth),r.italic=a.italic,e.splice(t+1,1),t--)}return e},k0=function(t){for(var r=0,a=0,s=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>r&&(r=o.height),o.depth>a&&(a=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}t.height=r,t.depth=a,t.maxFontSize=s},br=function(t,r,a,s){var i=new Ds(t,r,a,s);return k0(i),i},Dh=(e,t,r,a)=>new Ds(e,t,r,a),lk=function(t,r,a){var s=br([t],[],r);return s.height=Math.max(a||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),s.style.borderBottomWidth=Te(s.height),s.maxFontSize=1,s},ck=function(t,r,a,s){var i=new v0(t,r,a,s);return k0(i),i},zh=function(t){var r=new Is(t);return k0(r),r},dk=function(t,r){return t instanceof Is?br([],[t],r):t},uk=function(t){if(t.positionType==="individualShift"){for(var r=t.children,a=[r[0]],s=-r[0].shift-r[0].elem.depth,i=s,o=1;o<r.length;o++){var l=-r[o].shift-i-r[o].elem.depth,c=l-(r[o-1].elem.height+r[o-1].elem.depth);i=i+l,a.push({type:"kern",size:c}),a.push(r[o])}return{children:a,depth:s}}var d;if(t.positionType==="top"){for(var u=t.positionData,m=0;m<t.children.length;m++){var h=t.children[m];u-=h.type==="kern"?h.size:h.elem.height+h.elem.depth}d=u}else if(t.positionType==="bottom")d=-t.positionData;else{var p=t.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")d=-p.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")d=-p.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:d}},mk=function(t,r){for(var{children:a,depth:s}=uk(t),i=0,o=0;o<a.length;o++){var l=a[o];if(l.type==="elem"){var c=l.elem;i=Math.max(i,c.maxFontSize,c.height)}}i+=2;var d=br(["pstrut"],[]);d.style.height=Te(i);for(var u=[],m=s,h=s,p=s,g=0;g<a.length;g++){var y=a[g];if(y.type==="kern")p+=y.size;else{var v=y.elem,w=y.wrapperClasses||[],S=y.wrapperStyle||{},N=br(w,[d,v],void 0,S);N.style.top=Te(-i-p-v.depth),y.marginLeft&&(N.style.marginLeft=y.marginLeft),y.marginRight&&(N.style.marginRight=y.marginRight),u.push(N),p+=v.height+v.depth}m=Math.min(m,p),h=Math.max(h,p)}var I=br(["vlist"],u);I.style.height=Te(h);var F;if(m<0){var E=br([],[]),R=br(["vlist"],[E]);R.style.height=Te(-m);var H=br(["vlist-s"],[new Or("​")]);F=[br(["vlist-r"],[I,H]),br(["vlist-r"],[R])]}else F=[br(["vlist-r"],[I])];var $=br(["vlist-t"],F);return F.length===2&&$.classes.push("vlist-t2"),$.height=h,$.depth=-m,$},hk=(e,t)=>{var r=br(["mspace"],[],t),a=_t(e,t);return r.style.marginRight=Te(a),r},Zs=function(t,r,a){var s="";switch(t){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=t}var i;return r==="textbf"&&a==="textit"?i="BoldItalic":r==="textbf"?i="Bold":r==="textit"?i="Italic":i="Regular",s+"-"+i},Lh={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Ph={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},pk=function(t,r){var[a,s,i]=Ph[t],o=new Wn(a),l=new Nn([o],{width:Te(s),height:Te(i),style:"width:"+Te(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=Dh(["overlay"],[l],r);return c.height=i,c.style.height=Te(i),c.style.width=Te(s),c},K={fontMap:Lh,makeSymbol:Vr,mathsym:nk,makeSpan:br,makeSvgSpan:Dh,makeLineSpan:lk,makeAnchor:ck,makeFragment:zh,wrapFragment:dk,makeVList:mk,makeOrd:sk,makeGlue:hk,staticSvg:pk,svgData:Ph,tryCombineChars:ok},Ot={number:3,unit:"mu"},na={number:4,unit:"mu"},bn={number:5,unit:"mu"},fk={mord:{mop:Ot,mbin:na,mrel:bn,minner:Ot},mop:{mord:Ot,mop:Ot,mrel:bn,minner:Ot},mbin:{mord:na,mop:na,mopen:na,minner:na},mrel:{mord:bn,mop:bn,mopen:bn,minner:bn},mopen:{},mclose:{mop:Ot,mbin:na,mrel:bn,minner:Ot},mpunct:{mord:Ot,mop:Ot,mrel:bn,mopen:Ot,mclose:Ot,mpunct:Ot,minner:Ot},minner:{mord:Ot,mop:Ot,mbin:na,mrel:bn,mopen:Ot,mpunct:Ot,minner:Ot}},gk={mord:{mop:Ot},mop:{mord:Ot,mop:Ot},mbin:{},mrel:{},mopen:{},mclose:{mop:Ot},mpunct:{},minner:{mop:Ot}},Rh={},Ni={},Si={};function ze(e){for(var{type:t,names:r,props:a,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,l={type:t,numArgs:a.numArgs,argTypes:a.argTypes,allowedInArgument:!!a.allowedInArgument,allowedInText:!!a.allowedInText,allowedInMath:a.allowedInMath===void 0?!0:a.allowedInMath,numOptionalArgs:a.numOptionalArgs||0,infix:!!a.infix,primitive:!!a.primitive,handler:s},c=0;c<r.length;++c)Rh[r[c]]=l;t&&(i&&(Ni[t]=i),o&&(Si[t]=o))}function ha(e){var{type:t,htmlBuilder:r,mathmlBuilder:a}=e;ze({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:r,mathmlBuilder:a})}var Ci=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Ut=function(t){return t.type==="ordgroup"?t.body:[t]},Sn=K.makeSpan,xk=["leftmost","mbin","mopen","mrel","mop","mpunct"],bk=["rightmost","mrel","mclose","mpunct"],yk={display:tt.DISPLAY,text:tt.TEXT,script:tt.SCRIPT,scriptscript:tt.SCRIPTSCRIPT},vk={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Qt=function(t,r,a,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<t.length;o++){var l=jt(t[o],r);if(l instanceof Is){var c=l.children;i.push(...c)}else i.push(l)}if(K.tryCombineChars(i),!a)return i;var d=r;if(t.length===1){var u=t[0];u.type==="sizing"?d=r.havingSize(u.size):u.type==="styling"&&(d=r.havingStyle(yk[u.style]))}var m=Sn([s[0]||"leftmost"],[],r),h=Sn([s[1]||"rightmost"],[],r),p=a==="root";return fd(i,(g,y)=>{var v=y.classes[0],w=g.classes[0];v==="mbin"&&bk.includes(w)?y.classes[0]="mord":w==="mbin"&&xk.includes(v)&&(g.classes[0]="mord")},{node:m},h,p),fd(i,(g,y)=>{var v=vl(y),w=vl(g),S=v&&w?g.hasClass("mtight")?gk[v][w]:fk[v][w]:null;if(S)return K.makeGlue(S,d)},{node:m},h,p),i},fd=function e(t,r,a,s,i){s&&t.push(s);for(var o=0;o<t.length;o++){var l=t[o],c=Fh(l);if(c){e(c.children,r,a,null,i);continue}var d=!l.hasClass("mspace");if(d){var u=r(l,a.node);u&&(a.insertAfter?a.insertAfter(u):(t.unshift(u),o++))}d?a.node=l:i&&l.hasClass("newline")&&(a.node=Sn(["leftmost"])),a.insertAfter=(m=>h=>{t.splice(m+1,0,h),o++})(o)}s&&t.pop()},Fh=function(t){return t instanceof Is||t instanceof v0||t instanceof Ds&&t.hasClass("enclosing")?t:null},kk=function e(t,r){var a=Fh(t);if(a){var s=a.children;if(s.length){if(r==="right")return e(s[s.length-1],"right");if(r==="left")return e(s[0],"left")}}return t},vl=function(t,r){return t?(r&&(t=kk(t,r)),vk[t.classes[0]]||null):null},xs=function(t,r){var a=["nulldelimiter"].concat(t.baseSizingClasses());return Sn(r.concat(a))},jt=function(t,r,a){if(!t)return Sn();if(Ni[t.type]){var s=Ni[t.type](t,r);if(a&&r.size!==a.size){s=Sn(r.sizingClasses(a),[s],r);var i=r.sizeMultiplier/a.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new ye("Got group of unknown type: '"+t.type+"'")};function ei(e,t){var r=Sn(["base"],e,t),a=Sn(["strut"]);return a.style.height=Te(r.height+r.depth),r.depth&&(a.style.verticalAlign=Te(-r.depth)),r.children.unshift(a),r}function kl(e,t){var r=null;e.length===1&&e[0].type==="tag"&&(r=e[0].tag,e=e[0].body);var a=Qt(e,t,"root"),s;a.length===2&&a[1].hasClass("tag")&&(s=a.pop());for(var i=[],o=[],l=0;l<a.length;l++)if(o.push(a[l]),a[l].hasClass("mbin")||a[l].hasClass("mrel")||a[l].hasClass("allowbreak")){for(var c=!1;l<a.length-1&&a[l+1].hasClass("mspace")&&!a[l+1].hasClass("newline");)l++,o.push(a[l]),a[l].hasClass("nobreak")&&(c=!0);c||(i.push(ei(o,t)),o=[])}else a[l].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(ei(o,t)),o=[]),i.push(a[l]));o.length>0&&i.push(ei(o,t));var d;r?(d=ei(Qt(r,t,!0)),d.classes=["tag"],i.push(d)):s&&i.push(s);var u=Sn(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),d){var m=d.children[0];m.style.height=Te(u.height+u.depth),u.depth&&(m.style.verticalAlign=Te(-u.depth))}return u}function Bh(e){return new Is(e)}class Ar{constructor(t,r,a){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=a||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=Hn(this.classes));for(var a=0;a<this.children.length;a++)if(this.children[a]instanceof on&&this.children[a+1]instanceof on){for(var s=this.children[a].toText()+this.children[++a].toText();this.children[a+1]instanceof on;)s+=this.children[++a].toText();t.appendChild(new on(s).toNode())}else t.appendChild(this.children[a].toNode());return t}toMarkup(){var t="<"+this.type;for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(t+=" "+r+'="',t+=Nt.escape(this.attributes[r]),t+='"');this.classes.length>0&&(t+=' class ="'+Nt.escape(Hn(this.classes))+'"'),t+=">";for(var a=0;a<this.children.length;a++)t+=this.children[a].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}class on{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Nt.escape(this.toText())}toText(){return this.text}}class wk{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Te(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Te(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var xe={MathNode:Ar,TextNode:on,SpaceNode:wk,newDocumentFragment:Bh},$r=function(t,r,a){return Lt[r][t]&&Lt[r][t].replace&&t.charCodeAt(0)!==55349&&!(Ih.hasOwnProperty(t)&&a&&(a.fontFamily&&a.fontFamily.slice(4,6)==="tt"||a.font&&a.font.slice(4,6)==="tt"))&&(t=Lt[r][t].replace),new xe.TextNode(t)},w0=function(t){return t.length===1?t[0]:new xe.MathNode("mrow",t)},j0=function(t,r){if(r.fontFamily==="texttt")return"monospace";if(r.fontFamily==="textsf")return r.fontShape==="textit"&&r.fontWeight==="textbf"?"sans-serif-bold-italic":r.fontShape==="textit"?"sans-serif-italic":r.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(r.fontShape==="textit"&&r.fontWeight==="textbf")return"bold-italic";if(r.fontShape==="textit")return"italic";if(r.fontWeight==="textbf")return"bold";var a=r.font;if(!a||a==="mathnormal")return null;var s=t.mode;if(a==="mathit")return"italic";if(a==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(a==="mathbf")return"bold";if(a==="mathbb")return"double-struck";if(a==="mathsfit")return"sans-serif-italic";if(a==="mathfrak")return"fraktur";if(a==="mathscr"||a==="mathcal")return"script";if(a==="mathsf")return"sans-serif";if(a==="mathtt")return"monospace";var i=t.text;if(["\\imath","\\jmath"].includes(i))return null;Lt[s][i]&&Lt[s][i].replace&&(i=Lt[s][i].replace);var o=K.fontMap[a].fontName;return y0(i,o,s)?K.fontMap[a].variant:null};function To(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof on&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof on&&r.text===","}else return!1}var jr=function(t,r,a){if(t.length===1){var s=It(t[0],r);return a&&s instanceof Ar&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,l=0;l<t.length;l++){var c=It(t[l],r);if(c instanceof Ar&&o instanceof Ar){if(c.type==="mtext"&&o.type==="mtext"&&c.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...c.children);continue}else if(c.type==="mn"&&o.type==="mn"){o.children.push(...c.children);continue}else if(To(c)&&o.type==="mn"){o.children.push(...c.children);continue}else if(c.type==="mn"&&To(o))c.children=[...o.children,...c.children],i.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&(o.type==="mn"||To(o))){var d=c.children[0];d instanceof Ar&&d.type==="mn"&&(d.children=[...o.children,...d.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof on&&u.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof on&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),o=c}return i},Un=function(t,r,a){return w0(jr(t,r,a))},It=function(t,r){if(!t)return new xe.MathNode("mrow");if(Si[t.type]){var a=Si[t.type](t,r);return a}else throw new ye("Got group of unknown type: '"+t.type+"'")};function gd(e,t,r,a,s){var i=jr(e,r),o;i.length===1&&i[0]instanceof Ar&&["mrow","mtable"].includes(i[0].type)?o=i[0]:o=new xe.MathNode("mrow",i);var l=new xe.MathNode("annotation",[new xe.TextNode(t)]);l.setAttribute("encoding","application/x-tex");var c=new xe.MathNode("semantics",[o,l]),d=new xe.MathNode("math",[c]);d.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),a&&d.setAttribute("display","block");var u=s?"katex":"katex-mathml";return K.makeSpan([u],[d])}var Oh=function(t){return new vn({style:t.displayMode?tt.DISPLAY:tt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},$h=function(t,r){if(r.displayMode){var a=["katex-display"];r.leqno&&a.push("leqno"),r.fleqn&&a.push("fleqn"),t=K.makeSpan(a,[t])}return t},jk=function(t,r,a){var s=Oh(a),i;if(a.output==="mathml")return gd(t,r,s,a.displayMode,!0);if(a.output==="html"){var o=kl(t,s);i=K.makeSpan(["katex"],[o])}else{var l=gd(t,r,s,a.displayMode,!1),c=kl(t,s);i=K.makeSpan(["katex"],[l,c])}return $h(i,a)},Nk=function(t,r,a){var s=Oh(a),i=kl(t,s),o=K.makeSpan(["katex"],[i]);return $h(o,a)},Sk={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Ck=function(t){var r=new xe.MathNode("mo",[new xe.TextNode(Sk[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},Mk={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ak=function(t){return t.type==="ordgroup"?t.body.length:1},Tk=function(t,r){function a(){var l=4e5,c=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var d=t,u=Ak(d.base),m,h,p;if(u>5)c==="widehat"||c==="widecheck"?(m=420,l=2364,p=.42,h=c+"4"):(m=312,l=2340,p=.34,h="tilde4");else{var g=[1,1,2,2,3,3][u];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][g],m=[0,239,300,360,420][g],p=[0,.24,.3,.3,.36,.42][g],h=c+g):(l=[0,600,1033,2339,2340][g],m=[0,260,286,306,312][g],p=[0,.26,.286,.3,.306,.34][g],h="tilde"+g)}var y=new Wn(h),v=new Nn([y],{width:"100%",height:Te(p),viewBox:"0 0 "+l+" "+m,preserveAspectRatio:"none"});return{span:K.makeSvgSpan([],[v],r),minWidth:0,height:p}}else{var w=[],S=Mk[c],[N,I,F]=S,E=F/1e3,R=N.length,H,$;if(R===1){var A=S[3];H=["hide-tail"],$=[A]}else if(R===2)H=["halfarrow-left","halfarrow-right"],$=["xMinYMin","xMaxYMin"];else if(R===3)H=["brace-left","brace-center","brace-right"],$=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
683
+ `+R+" children.");for(var V=0;V<R;V++){var T=new Wn(N[V]),U=new Nn([T],{width:"400em",height:Te(E),viewBox:"0 0 "+l+" "+F,preserveAspectRatio:$[V]+" slice"}),P=K.makeSvgSpan([H[V]],[U],r);if(R===1)return{span:P,minWidth:I,height:E};P.style.height=Te(E),w.push(P)}return{span:K.makeSpan(["stretchy"],w,r),minWidth:I,height:E}}}var{span:s,minWidth:i,height:o}=a();return s.height=o,s.style.height=Te(o),i>0&&(s.style.minWidth=Te(i)),s},Ek=function(t,r,a,s,i){var o,l=t.height+t.depth+a+s;if(/fbox|color|angl/.test(r)){if(o=K.makeSpan(["stretchy",r],[],i),r==="fbox"){var c=i.color&&i.getColor();c&&(o.style.borderColor=c)}}else{var d=[];/^[bx]cancel$/.test(r)&&d.push(new bl({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&d.push(new bl({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new Nn(d,{width:"100%",height:Te(l)});o=K.makeSvgSpan([],[u],i)}return o.height=l,o.style.height=Te(l),o},Cn={encloseSpan:Ek,mathMLnode:Ck,svgSpan:Tk};function dt(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function N0(e){var t=Hi(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Hi(e){return e&&(e.type==="atom"||tk.hasOwnProperty(e.type))?e:null}var S0=(e,t)=>{var r,a,s;e&&e.type==="supsub"?(a=dt(e.base,"accent"),r=a.base,e.base=r,s=Z3(jt(e,t)),e.base=a):(a=dt(e,"accent"),r=a.base);var i=jt(r,t.havingCrampedStyle()),o=a.isShifty&&Nt.isCharacterBox(r),l=0;if(o){var c=Nt.getBaseElem(r),d=jt(c,t.havingCrampedStyle());l=cd(d).skew}var u=a.label==="\\c",m=u?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),h;if(a.isStretchy)h=Cn.svgSpan(a,t),h=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+Te(2*l)+")",marginLeft:Te(2*l)}:void 0}]},t);else{var p,g;a.label==="\\vec"?(p=K.staticSvg("vec",t),g=K.svgData.vec[1]):(p=K.makeOrd({mode:a.mode,text:a.label},t,"textord"),p=cd(p),p.italic=0,g=p.width,u&&(m+=p.depth)),h=K.makeSpan(["accent-body"],[p]);var y=a.label==="\\textcircled";y&&(h.classes.push("accent-full"),m=i.height);var v=l;y||(v-=g/2),h.style.left=Te(v),a.label==="\\textcircled"&&(h.style.top=".2em"),h=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:h}]},t)}var w=K.makeSpan(["mord","accent"],[h],t);return s?(s.children[0]=w,s.height=Math.max(w.height,s.height),s.classes[0]="mord",s):w},_h=(e,t)=>{var r=e.isStretchy?Cn.mathMLnode(e.label):new xe.MathNode("mo",[$r(e.label,e.mode)]),a=new xe.MathNode("mover",[It(e.base,t),r]);return a.setAttribute("accent","true"),a},Ik=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));ze({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=Ci(t[0]),a=!Ik.test(e.funcName),s=!a||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:a,isShifty:s,base:r}},htmlBuilder:S0,mathmlBuilder:_h});ze({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],a=e.parser.mode;return a==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),a="text"),{type:"accent",mode:a,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:S0,mathmlBuilder:_h});ze({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=t[0];return{type:"accentUnder",mode:r.mode,label:a,base:s}},htmlBuilder:(e,t)=>{var r=jt(e.base,t),a=Cn.svgSpan(e,t),s=e.label==="\\utilde"?.12:0,i=K.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:r}]},t);return K.makeSpan(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var r=Cn.mathMLnode(e.label),a=new xe.MathNode("munder",[It(e.base,t),r]);return a.setAttribute("accentunder","true"),a}});var ti=e=>{var t=new xe.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};ze({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:a,funcName:s}=e;return{type:"xArrow",mode:a.mode,label:s,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,a=t.havingStyle(r.sup()),s=K.wrapFragment(jt(e.body,a,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var o;e.below&&(a=t.havingStyle(r.sub()),o=K.wrapFragment(jt(e.below,a,t),t),o.classes.push(i+"-arrow-pad"));var l=Cn.svgSpan(e,t),c=-t.fontMetrics().axisHeight+.5*l.height,d=-t.fontMetrics().axisHeight-.5*l.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(d-=s.depth);var u;if(o){var m=-t.fontMetrics().axisHeight+o.height+.5*l.height+.111;u=K.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c},{type:"elem",elem:o,shift:m}]},t)}else u=K.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:d},{type:"elem",elem:l,shift:c}]},t);return u.children[0].children[0].children[1].classes.push("svg-align"),K.makeSpan(["mrel","x-arrow"],[u],t)},mathmlBuilder(e,t){var r=Cn.mathMLnode(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var a;if(e.body){var s=ti(It(e.body,t));if(e.below){var i=ti(It(e.below,t));a=new xe.MathNode("munderover",[r,i,s])}else a=new xe.MathNode("mover",[r,s])}else if(e.below){var o=ti(It(e.below,t));a=new xe.MathNode("munder",[r,o])}else a=ti(),a=new xe.MathNode("mover",[r,a]);return a}});var Dk=K.makeSpan;function qh(e,t){var r=Qt(e.body,t,!0);return Dk([e.mclass],r,t)}function Hh(e,t){var r,a=jr(e.body,t);return e.mclass==="minner"?r=new xe.MathNode("mpadded",a):e.mclass==="mord"?e.isCharacterBox?(r=a[0],r.type="mi"):r=new xe.MathNode("mi",a):(e.isCharacterBox?(r=a[0],r.type="mo"):r=new xe.MathNode("mo",a),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}ze({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:a}=e,s=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+a.slice(5),body:Ut(s),isCharacterBox:Nt.isCharacterBox(s)}},htmlBuilder:qh,mathmlBuilder:Hh});var Wi=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};ze({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:Wi(t[0]),body:Ut(t[1]),isCharacterBox:Nt.isCharacterBox(t[1])}}});ze({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:a}=e,s=t[1],i=t[0],o;a!=="\\stackrel"?o=Wi(s):o="mrel";var l={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:a!=="\\stackrel",body:Ut(s)},c={type:"supsub",mode:i.mode,base:l,sup:a==="\\underset"?null:i,sub:a==="\\underset"?i:null};return{type:"mclass",mode:r.mode,mclass:o,body:[c],isCharacterBox:Nt.isCharacterBox(c)}},htmlBuilder:qh,mathmlBuilder:Hh});ze({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:Wi(t[0]),body:Ut(t[0])}},htmlBuilder(e,t){var r=Qt(e.body,t,!0),a=K.makeSpan([e.mclass],r,t);return a.style.textShadow="0.02em 0.01em 0.04px",a},mathmlBuilder(e,t){var r=jr(e.body,t),a=new xe.MathNode("mstyle",r);return a.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),a}});var zk={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},xd=()=>({type:"styling",body:[],mode:"math",style:"display"}),bd=e=>e.type==="textord"&&e.text==="@",Lk=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function Pk(e,t,r){var a=zk[e];switch(a){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(a,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var s=r.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:a,mode:"math",family:"rel"},o=r.callFunction("\\Big",[i],[]),l=r.callFunction("\\\\cdright",[t[1]],[]),c={type:"ordgroup",mode:"math",body:[s,o,l]};return r.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var d={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[d],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Rk(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new ye("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var a=[],s=[a],i=0;i<t.length;i++){for(var o=t[i],l=xd(),c=0;c<o.length;c++)if(!bd(o[c]))l.body.push(o[c]);else{a.push(l),c+=1;var d=N0(o[c]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(d)>-1))if("<>AV".indexOf(d)>-1)for(var m=0;m<2;m++){for(var h=!0,p=c+1;p<o.length;p++){if(Lk(o[p],d)){h=!1,c=p;break}if(bd(o[p]))throw new ye("Missing a "+d+" character to complete a CD arrow.",o[p]);u[m].body.push(o[p])}if(h)throw new ye("Missing a "+d+" character to complete a CD arrow.",o[c])}else throw new ye('Expected one of "<>AV=|." after @',o[c]);var g=Pk(d,u,e),y={type:"styling",body:[g],mode:"math",style:"display"};a.push(y),l=xd()}i%2===0?a.push(l):a.shift(),a=[],s.push(a)}e.gullet.endGroup(),e.gullet.endGroup();var v=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}ze({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:a}=e;return{type:"cdlabel",mode:r.mode,side:a.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),a=K.wrapFragment(jt(e.label,r,t),t);return a.classes.push("cd-label-"+e.side),a.style.bottom=Te(.8-a.depth),a.height=0,a.depth=0,a},mathmlBuilder(e,t){var r=new xe.MathNode("mrow",[It(e.label,t)]);return r=new xe.MathNode("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new xe.MathNode("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});ze({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=K.wrapFragment(jt(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new xe.MathNode("mrow",[It(e.fragment,t)])}});ze({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,a=dt(t[0],"ordgroup"),s=a.body,i="",o=0;o<s.length;o++){var l=dt(s[o],"textord");i+=l.text}var c=parseInt(i),d;if(isNaN(c))throw new ye("\\@char has non-numeric argument "+i);if(c<0||c>=1114111)throw new ye("\\@char with invalid code point "+i);return c<=65535?d=String.fromCharCode(c):(c-=65536,d=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:r.mode,text:d}}});var Wh=(e,t)=>{var r=Qt(e.body,t.withColor(e.color),!1);return K.makeFragment(r)},Uh=(e,t)=>{var r=jr(e.body,t.withColor(e.color)),a=new xe.MathNode("mstyle",r);return a.setAttribute("mathcolor",e.color),a};ze({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,a=dt(t[0],"color-token").color,s=t[1];return{type:"color",mode:r.mode,color:a,body:Ut(s)}},htmlBuilder:Wh,mathmlBuilder:Uh});ze({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:a}=e,s=dt(t[0],"color-token").color;r.gullet.macros.set("\\current@color",s);var i=r.parseExpression(!0,a);return{type:"color",mode:r.mode,color:s,body:i}},htmlBuilder:Wh,mathmlBuilder:Uh});ze({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:a}=e,s=a.gullet.future().text==="["?a.parseSizeGroup(!0):null,i=!a.settings.displayMode||!a.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:a.mode,newLine:i,size:s&&dt(s,"size").value}},htmlBuilder(e,t){var r=K.makeSpan(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=Te(_t(e.size,t)))),r},mathmlBuilder(e,t){var r=new xe.MathNode("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",Te(_t(e.size,t)))),r}});var wl={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Vh=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new ye("Expected a control sequence",e);return t},Fk=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},Gh=(e,t,r,a)=>{var s=e.gullet.macros.get(r.text);s==null&&(r.noexpand=!0,s={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,s,a)};ze({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var a=t.fetch();if(wl[a.text])return(r==="\\global"||r==="\\\\globallong")&&(a.text=wl[a.text]),dt(t.parseFunction(),"internal");throw new ye("Invalid token after macro prefix",a)}});ze({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,a=t.gullet.popToken(),s=a.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new ye("Expected a control sequence",a);for(var i=0,o,l=[[]];t.gullet.future().text!=="{";)if(a=t.gullet.popToken(),a.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),l[i].push("{");break}if(a=t.gullet.popToken(),!/^[1-9]$/.test(a.text))throw new ye('Invalid argument number "'+a.text+'"');if(parseInt(a.text)!==i+1)throw new ye('Argument number "'+a.text+'" out of order');i++,l.push([])}else{if(a.text==="EOF")throw new ye("Expected a macro definition");l[i].push(a.text)}var{tokens:c}=t.gullet.consumeArg();return o&&c.unshift(o),(r==="\\edef"||r==="\\xdef")&&(c=t.gullet.expandTokens(c),c.reverse()),t.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:l},r===wl[r]),{type:"internal",mode:t.mode}}});ze({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,a=Vh(t.gullet.popToken());t.gullet.consumeSpaces();var s=Fk(t);return Gh(t,a,s,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});ze({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,a=Vh(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return Gh(t,a,i,r==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var ts=function(t,r,a){var s=Lt.math[t]&&Lt.math[t].replace,i=y0(s||t,r,a);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return i},C0=function(t,r,a,s){var i=a.havingBaseStyle(r),o=K.makeSpan(s.concat(i.sizingClasses(a)),[t],a),l=i.sizeMultiplier/a.sizeMultiplier;return o.height*=l,o.depth*=l,o.maxFontSize=i.sizeMultiplier,o},Kh=function(t,r,a){var s=r.havingBaseStyle(a),i=(1-r.sizeMultiplier/s.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Te(i),t.height-=i,t.depth+=i},Bk=function(t,r,a,s,i,o){var l=K.makeSymbol(t,"Main-Regular",i,s),c=C0(l,r,s,o);return a&&Kh(c,s,r),c},Ok=function(t,r,a,s){return K.makeSymbol(t,"Size"+r+"-Regular",a,s)},Jh=function(t,r,a,s,i,o){var l=Ok(t,r,i,s),c=C0(K.makeSpan(["delimsizing","size"+r],[l],s),tt.TEXT,s,o);return a&&Kh(c,s,tt.TEXT),c},Eo=function(t,r,a){var s;r==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=K.makeSpan(["delimsizinginner",s],[K.makeSpan([],[K.makeSymbol(t,r,a)])]);return{type:"elem",elem:i}},Io=function(t,r,a){var s=sn["Size4-Regular"][t.charCodeAt(0)]?sn["Size4-Regular"][t.charCodeAt(0)][4]:sn["Size1-Regular"][t.charCodeAt(0)][4],i=new Wn("inner",W3(t,Math.round(1e3*r))),o=new Nn([i],{width:Te(s),height:Te(r),style:"width:"+Te(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),l=K.makeSvgSpan([],[o],a);return l.height=r,l.style.height=Te(r),l.style.width=Te(s),{type:"elem",elem:l}},jl=.008,ri={type:"kern",size:-1*jl},$k=["|","\\lvert","\\rvert","\\vert"],_k=["\\|","\\lVert","\\rVert","\\Vert"],Yh=function(t,r,a,s,i,o){var l,c,d,u,m="",h=0;l=d=u=t,c=null;var p="Size1-Regular";t==="\\uparrow"?d=u="⏐":t==="\\Uparrow"?d=u="‖":t==="\\downarrow"?l=d="⏐":t==="\\Downarrow"?l=d="‖":t==="\\updownarrow"?(l="\\uparrow",d="⏐",u="\\downarrow"):t==="\\Updownarrow"?(l="\\Uparrow",d="‖",u="\\Downarrow"):$k.includes(t)?(d="∣",m="vert",h=333):_k.includes(t)?(d="∥",m="doublevert",h=556):t==="["||t==="\\lbrack"?(l="⎡",d="⎢",u="⎣",p="Size4-Regular",m="lbrack",h=667):t==="]"||t==="\\rbrack"?(l="⎤",d="⎥",u="⎦",p="Size4-Regular",m="rbrack",h=667):t==="\\lfloor"||t==="⌊"?(d=l="⎢",u="⎣",p="Size4-Regular",m="lfloor",h=667):t==="\\lceil"||t==="⌈"?(l="⎡",d=u="⎢",p="Size4-Regular",m="lceil",h=667):t==="\\rfloor"||t==="⌋"?(d=l="⎥",u="⎦",p="Size4-Regular",m="rfloor",h=667):t==="\\rceil"||t==="⌉"?(l="⎤",d=u="⎥",p="Size4-Regular",m="rceil",h=667):t==="("||t==="\\lparen"?(l="⎛",d="⎜",u="⎝",p="Size4-Regular",m="lparen",h=875):t===")"||t==="\\rparen"?(l="⎞",d="⎟",u="⎠",p="Size4-Regular",m="rparen",h=875):t==="\\{"||t==="\\lbrace"?(l="⎧",c="⎨",u="⎩",d="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(l="⎫",c="⎬",u="⎭",d="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(l="⎧",u="⎩",d="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(l="⎫",u="⎭",d="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(l="⎧",u="⎭",d="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(l="⎫",u="⎩",d="⎪",p="Size4-Regular");var g=ts(l,p,i),y=g.height+g.depth,v=ts(d,p,i),w=v.height+v.depth,S=ts(u,p,i),N=S.height+S.depth,I=0,F=1;if(c!==null){var E=ts(c,p,i);I=E.height+E.depth,F=2}var R=y+N+I,H=Math.max(0,Math.ceil((r-R)/(F*w))),$=R+H*F*w,A=s.fontMetrics().axisHeight;a&&(A*=s.sizeMultiplier);var V=$/2-A,T=[];if(m.length>0){var U=$-y-N,P=Math.round($*1e3),_=U3(m,Math.round(U*1e3)),se=new Wn(m,_),de=(h/1e3).toFixed(3)+"em",J=(P/1e3).toFixed(3)+"em",X=new Nn([se],{width:de,height:J,viewBox:"0 0 "+h+" "+P}),j=K.makeSvgSpan([],[X],s);j.height=P/1e3,j.style.width=de,j.style.height=J,T.push({type:"elem",elem:j})}else{if(T.push(Eo(u,p,i)),T.push(ri),c===null){var ne=$-y-N+2*jl;T.push(Io(d,ne,s))}else{var ue=($-y-N-I)/2+2*jl;T.push(Io(d,ue,s)),T.push(ri),T.push(Eo(c,p,i)),T.push(ri),T.push(Io(d,ue,s))}T.push(ri),T.push(Eo(l,p,i))}var M=s.havingBaseStyle(tt.TEXT),ie=K.makeVList({positionType:"bottom",positionData:V,children:T},M);return C0(K.makeSpan(["delimsizing","mult"],[ie],M),tt.TEXT,s,o)},Do=80,zo=.08,Lo=function(t,r,a,s,i){var o=H3(t,s,a),l=new Wn(t,o),c=new Nn([l],{width:"400em",height:Te(r),viewBox:"0 0 400000 "+a,preserveAspectRatio:"xMinYMin slice"});return K.makeSvgSpan(["hide-tail"],[c],i)},qk=function(t,r){var a=r.havingBaseSizing(),s=ep("\\surd",t*a.sizeMultiplier,Zh,a),i=a.sizeMultiplier,o=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),l,c=0,d=0,u=0,m;return s.type==="small"?(u=1e3+1e3*o+Do,t<1?i=1:t<1.4&&(i=.7),c=(1+o+zo)/i,d=(1+o)/i,l=Lo("sqrtMain",c,u,o,r),l.style.minWidth="0.853em",m=.833/i):s.type==="large"?(u=(1e3+Do)*ls[s.size],d=(ls[s.size]+o)/i,c=(ls[s.size]+o+zo)/i,l=Lo("sqrtSize"+s.size,c,u,o,r),l.style.minWidth="1.02em",m=1/i):(c=t+o+zo,d=t+o,u=Math.floor(1e3*t+o)+Do,l=Lo("sqrtTall",c,u,o,r),l.style.minWidth="0.742em",m=1.056),l.height=d,l.style.height=Te(c),{span:l,advanceWidth:m,ruleWidth:(r.fontMetrics().sqrtRuleThickness+o)*i}},Xh=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Hk=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],Qh=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],ls=[0,1.2,1.8,2.4,3],Wk=function(t,r,a,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),Xh.includes(t)||Qh.includes(t))return Jh(t,r,!1,a,s,i);if(Hk.includes(t))return Yh(t,ls[r],!1,a,s,i);throw new ye("Illegal delimiter: '"+t+"'")},Uk=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Vk=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"stack"}],Zh=[{type:"small",style:tt.SCRIPTSCRIPT},{type:"small",style:tt.SCRIPT},{type:"small",style:tt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Gk=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},ep=function(t,r,a,s){for(var i=Math.min(2,3-s.style.size),o=i;o<a.length&&a[o].type!=="stack";o++){var l=ts(t,Gk(a[o]),"math"),c=l.height+l.depth;if(a[o].type==="small"){var d=s.havingBaseStyle(a[o].style);c*=d.sizeMultiplier}if(c>r)return a[o]}return a[a.length-1]},tp=function(t,r,a,s,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var l;Qh.includes(t)?l=Uk:Xh.includes(t)?l=Zh:l=Vk;var c=ep(t,r,l,s);return c.type==="small"?Bk(t,c.style,a,s,i,o):c.type==="large"?Jh(t,c.size,a,s,i,o):Yh(t,r,a,s,i,o)},Kk=function(t,r,a,s,i,o){var l=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,d=5/s.fontMetrics().ptPerEm,u=Math.max(r-l,a+l),m=Math.max(u/500*c,2*u-d);return tp(t,m,!0,s,i,o)},jn={sqrtImage:qk,sizedDelim:Wk,sizeToMaxHeight:ls,customSizedDelim:tp,leftRightDelim:Kk},yd={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Jk=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Ui(e,t){var r=Hi(e);if(r&&Jk.includes(r.text))return r;throw r?new ye("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new ye("Invalid delimiter type '"+e.type+"'",e)}ze({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=Ui(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:yd[e.funcName].size,mclass:yd[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?K.makeSpan([e.mclass]):jn.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push($r(e.delim,e.mode));var r=new xe.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var a=Te(jn.sizeToMaxHeight[e.size]);return r.setAttribute("minsize",a),r.setAttribute("maxsize",a),r}});function vd(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ze({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new ye("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Ui(t[0],e).text,color:r}}});ze({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=Ui(t[0],e),a=e.parser;++a.leftrightDepth;var s=a.parseExpression(!1);--a.leftrightDepth,a.expect("\\right",!1);var i=dt(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:s,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{vd(e);for(var r=Qt(e.body,t,!0,["mopen","mclose"]),a=0,s=0,i=!1,o=0;o<r.length;o++)r[o].isMiddle?i=!0:(a=Math.max(r[o].height,a),s=Math.max(r[o].depth,s));a*=t.sizeMultiplier,s*=t.sizeMultiplier;var l;if(e.left==="."?l=xs(t,["mopen"]):l=jn.leftRightDelim(e.left,a,s,t,e.mode,["mopen"]),r.unshift(l),i)for(var c=1;c<r.length;c++){var d=r[c],u=d.isMiddle;u&&(r[c]=jn.leftRightDelim(u.delim,a,s,u.options,e.mode,[]))}var m;if(e.right===".")m=xs(t,["mclose"]);else{var h=e.rightColor?t.withColor(e.rightColor):t;m=jn.leftRightDelim(e.right,a,s,h,e.mode,["mclose"])}return r.push(m),K.makeSpan(["minner"],r,t)},mathmlBuilder:(e,t)=>{vd(e);var r=jr(e.body,t);if(e.left!=="."){var a=new xe.MathNode("mo",[$r(e.left,e.mode)]);a.setAttribute("fence","true"),r.unshift(a)}if(e.right!=="."){var s=new xe.MathNode("mo",[$r(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),r.push(s)}return w0(r)}});ze({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=Ui(t[0],e);if(!e.parser.leftrightDepth)throw new ye("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;if(e.delim===".")r=xs(t,[]);else{r=jn.sizedDelim(e.delim,1,t,e.mode,[]);var a={delim:e.delim,options:t};r.isMiddle=a}return r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?$r("|","text"):$r(e.delim,e.mode),a=new xe.MathNode("mo",[r]);return a.setAttribute("fence","true"),a.setAttribute("lspace","0.05em"),a.setAttribute("rspace","0.05em"),a}});var M0=(e,t)=>{var r=K.wrapFragment(jt(e.body,t),t),a=e.label.slice(1),s=t.sizeMultiplier,i,o=0,l=Nt.isCharacterBox(e.body);if(a==="sout")i=K.makeSpan(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,o=-.5*t.fontMetrics().xHeight;else if(a==="phase"){var c=_t({number:.6,unit:"pt"},t),d=_t({number:.35,unit:"ex"},t),u=t.havingBaseSizing();s=s/u.sizeMultiplier;var m=r.height+r.depth+c+d;r.style.paddingLeft=Te(m/2+c);var h=Math.floor(1e3*m*s),p=_3(h),g=new Nn([new Wn("phase",p)],{width:"400em",height:Te(h/1e3),viewBox:"0 0 400000 "+h,preserveAspectRatio:"xMinYMin slice"});i=K.makeSvgSpan(["hide-tail"],[g],t),i.style.height=Te(m),o=r.depth+c+d}else{/cancel/.test(a)?l||r.classes.push("cancel-pad"):a==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var y=0,v=0,w=0;/box/.test(a)?(w=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(a==="colorbox"?0:w),v=y):a==="angl"?(w=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*w,v=Math.max(0,.25-r.depth)):(y=l?.2:0,v=y),i=Cn.encloseSpan(r,a,y,v,t),/fbox|boxed|fcolorbox/.test(a)?(i.style.borderStyle="solid",i.style.borderWidth=Te(w)):a==="angl"&&w!==.049&&(i.style.borderTopWidth=Te(w),i.style.borderRightWidth=Te(w)),o=r.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var S;if(e.backgroundColor)S=K.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:r,shift:0}]},t);else{var N=/cancel|phase/.test(a)?["svg-align"]:[];S=K.makeVList({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:N}]},t)}return/cancel/.test(a)&&(S.height=r.height,S.depth=r.depth),/cancel/.test(a)&&!l?K.makeSpan(["mord","cancel-lap"],[S],t):K.makeSpan(["mord"],[S],t)},A0=(e,t)=>{var r=0,a=new xe.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[It(e.body,t)]);switch(e.label){case"\\cancel":a.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike");break;case"\\phase":a.setAttribute("notation","phasorangle");break;case"\\sout":a.setAttribute("notation","horizontalstrike");break;case"\\fbox":a.setAttribute("notation","box");break;case"\\angl":a.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,a.setAttribute("width","+"+2*r+"pt"),a.setAttribute("height","+"+2*r+"pt"),a.setAttribute("lspace",r+"pt"),a.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var s=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);a.setAttribute("style","border: "+s+"em solid "+String(e.borderColor))}break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&a.setAttribute("mathbackground",e.backgroundColor),a};ze({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,r){var{parser:a,funcName:s}=e,i=dt(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:a.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:M0,mathmlBuilder:A0});ze({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,r){var{parser:a,funcName:s}=e,i=dt(t[0],"color-token").color,o=dt(t[1],"color-token").color,l=t[2];return{type:"enclose",mode:a.mode,label:s,backgroundColor:o,borderColor:i,body:l}},htmlBuilder:M0,mathmlBuilder:A0});ze({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});ze({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:a}=e,s=t[0];return{type:"enclose",mode:r.mode,label:a,body:s}},htmlBuilder:M0,mathmlBuilder:A0});ze({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});var rp={};function un(e){for(var{type:t,names:r,props:a,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,l={type:t,numArgs:a.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c<r.length;++c)rp[r[c]]=l;i&&(Ni[t]=i),o&&(Si[t]=o)}var np={};function C(e,t){np[e]=t}function kd(e){var t=[];e.consumeSpaces();var r=e.fetch().text;for(r==="\\relax"&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);r==="\\hline"||r==="\\hdashline";)e.consume(),t.push(r==="\\hdashline"),e.consumeSpaces(),r=e.fetch().text;return t}var Vi=e=>{var t=e.parser.settings;if(!t.displayMode)throw new ye("{"+e.envName+"} can be used only in display mode.")};function T0(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Gn(e,t,r){var{hskipBeforeAndAfter:a,addJot:s,cols:i,arraystretch:o,colSeparationType:l,autoTag:c,singleRow:d,emptySingleRow:u,maxNumCols:m,leqno:h}=t;if(e.gullet.beginGroup(),d||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)o=1;else if(o=parseFloat(p),!o||o<0)throw new ye("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],y=[g],v=[],w=[],S=c!=null?[]:void 0;function N(){c&&e.gullet.macros.set("\\@eqnsw","1",!0)}function I(){S&&(e.gullet.macros.get("\\df@tag")?(S.push(e.subparse([new Ir("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):S.push(!!c&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(N(),w.push(kd(e));;){var F=e.parseExpression(!1,d?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),F={type:"ordgroup",mode:e.mode,body:F},r&&(F={type:"styling",mode:e.mode,style:r,body:[F]}),g.push(F);var E=e.fetch().text;if(E==="&"){if(m&&g.length===m){if(d||l)throw new ye("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(E==="\\end"){I(),g.length===1&&F.type==="styling"&&F.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),w.length<y.length+1&&w.push([]);break}else if(E==="\\\\"){e.consume();var R=void 0;e.gullet.future().text!==" "&&(R=e.parseSizeGroup(!0)),v.push(R?R.value:null),I(),w.push(kd(e)),g=[],y.push(g),N()}else throw new ye("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:s,arraystretch:o,body:y,cols:i,rowGaps:v,hskipBeforeAndAfter:a,hLinesBeforeRow:w,colSeparationType:l,tags:S,leqno:h}}function E0(e){return e.slice(0,1)==="d"?"display":"text"}var mn=function(t,r){var a,s,i=t.body.length,o=t.hLinesBeforeRow,l=0,c=new Array(i),d=[],u=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),m=1/r.fontMetrics().ptPerEm,h=5*m;if(t.colSeparationType&&t.colSeparationType==="small"){var p=r.havingStyle(tt.SCRIPT).sizeMultiplier;h=.2778*(p/r.sizeMultiplier)}var g=t.colSeparationType==="CD"?_t({number:3,unit:"ex"},r):12*m,y=3*m,v=t.arraystretch*g,w=.7*v,S=.3*v,N=0;function I(ft){for(var Ue=0;Ue<ft.length;++Ue)Ue>0&&(N+=.25),d.push({pos:N,isDashed:ft[Ue]})}for(I(o[0]),a=0;a<t.body.length;++a){var F=t.body[a],E=w,R=S;l<F.length&&(l=F.length);var H=new Array(F.length);for(s=0;s<F.length;++s){var $=jt(F[s],r);R<$.depth&&(R=$.depth),E<$.height&&(E=$.height),H[s]=$}var A=t.rowGaps[a],V=0;A&&(V=_t(A,r),V>0&&(V+=S,R<V&&(R=V),V=0)),t.addJot&&(R+=y),H.height=E,H.depth=R,N+=E,H.pos=N,N+=R+V,c[a]=H,I(o[a+1])}var T=N/2+r.fontMetrics().axisHeight,U=t.cols||[],P=[],_,se,de=[];if(t.tags&&t.tags.some(ft=>ft))for(a=0;a<i;++a){var J=c[a],X=J.pos-T,j=t.tags[a],ne=void 0;j===!0?ne=K.makeSpan(["eqn-num"],[],r):j===!1?ne=K.makeSpan([],[],r):ne=K.makeSpan([],Qt(j,r,!0),r),ne.depth=J.depth,ne.height=J.height,de.push({type:"elem",elem:ne,shift:X})}for(s=0,se=0;s<l||se<U.length;++s,++se){for(var ue=U[se]||{},M=!0;ue.type==="separator";){if(M||(_=K.makeSpan(["arraycolsep"],[]),_.style.width=Te(r.fontMetrics().doubleRuleSep),P.push(_)),ue.separator==="|"||ue.separator===":"){var ie=ue.separator==="|"?"solid":"dashed",Me=K.makeSpan(["vertical-separator"],[],r);Me.style.height=Te(N),Me.style.borderRightWidth=Te(u),Me.style.borderRightStyle=ie,Me.style.margin="0 "+Te(-u/2);var Se=N-T;Se&&(Me.style.verticalAlign=Te(-Se)),P.push(Me)}else throw new ye("Invalid separator type: "+ue.separator);se++,ue=U[se]||{},M=!1}if(!(s>=l)){var me=void 0;(s>0||t.hskipBeforeAndAfter)&&(me=Nt.deflt(ue.pregap,h),me!==0&&(_=K.makeSpan(["arraycolsep"],[]),_.style.width=Te(me),P.push(_)));var _e=[];for(a=0;a<i;++a){var ce=c[a],ve=ce[s];if(ve){var He=ce.pos-T;ve.depth=ce.depth,ve.height=ce.height,_e.push({type:"elem",elem:ve,shift:He})}}_e=K.makeVList({positionType:"individualShift",children:_e},r),_e=K.makeSpan(["col-align-"+(ue.align||"c")],[_e]),P.push(_e),(s<l-1||t.hskipBeforeAndAfter)&&(me=Nt.deflt(ue.postgap,h),me!==0&&(_=K.makeSpan(["arraycolsep"],[]),_.style.width=Te(me),P.push(_)))}}if(c=K.makeSpan(["mtable"],P),d.length>0){for(var Le=K.makeLineSpan("hline",r,u),rt=K.makeLineSpan("hdashline",r,u),Ye=[{type:"elem",elem:c,shift:0}];d.length>0;){var yt=d.pop(),mt=yt.pos-T;yt.isDashed?Ye.push({type:"elem",elem:rt,shift:mt}):Ye.push({type:"elem",elem:Le,shift:mt})}c=K.makeVList({positionType:"individualShift",children:Ye},r)}if(de.length===0)return K.makeSpan(["mord"],[c],r);var vt=K.makeVList({positionType:"individualShift",children:de},r);return vt=K.makeSpan(["tag"],[vt],r),K.makeFragment([c,vt])},Yk={c:"center ",l:"left ",r:"right "},hn=function(t,r){for(var a=[],s=new xe.MathNode("mtd",[],["mtr-glue"]),i=new xe.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var l=t.body[o],c=[],d=0;d<l.length;d++)c.push(new xe.MathNode("mtd",[It(l[d],r)]));t.tags&&t.tags[o]&&(c.unshift(s),c.push(s),t.leqno?c.unshift(i):c.push(i)),a.push(new xe.MathNode("mtr",c))}var u=new xe.MathNode("mtable",a),m=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);u.setAttribute("rowspacing",Te(m));var h="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,y="",v=!1,w=0,S=g.length;g[0].type==="separator"&&(h+="top ",w=1),g[g.length-1].type==="separator"&&(h+="bottom ",S-=1);for(var N=w;N<S;N++)g[N].type==="align"?(p+=Yk[g[N].align],v&&(y+="none "),v=!0):g[N].type==="separator"&&v&&(y+=g[N].separator==="|"?"solid ":"dashed ",v=!1);u.setAttribute("columnalign",p.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var I=t.cols||[],F="",E=1;E<I.length;E++)F+=E%2?"0em ":"1em ";u.setAttribute("columnspacing",F.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var R="",H=t.hLinesBeforeRow;h+=H[0].length>0?"left ":"",h+=H[H.length-1].length>0?"right ":"";for(var $=1;$<H.length-1;$++)R+=H[$].length===0?"none ":H[$][0]?"dashed ":"solid ";return/[sd]/.test(R)&&u.setAttribute("rowlines",R.trim()),h!==""&&(u=new xe.MathNode("menclose",[u]),u.setAttribute("notation",h.trim())),t.arraystretch&&t.arraystretch<1&&(u=new xe.MathNode("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},ap=function(t,r){t.envName.indexOf("ed")===-1&&Vi(t);var a=[],s=t.envName.indexOf("at")>-1?"alignat":"align",i=t.envName==="split",o=Gn(t.parser,{cols:a,addJot:!0,autoTag:i?void 0:T0(t.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),l,c=0,d={type:"ordgroup",mode:t.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var u="",m=0;m<r[0].body.length;m++){var h=dt(r[0].body[m],"textord");u+=h.text}l=Number(u),c=l*2}var p=!c;o.body.forEach(function(w){for(var S=1;S<w.length;S+=2){var N=dt(w[S],"styling"),I=dt(N.body[0],"ordgroup");I.body.unshift(d)}if(p)c<w.length&&(c=w.length);else{var F=w.length/2;if(l<F)throw new ye("Too many math in a row: "+("expected "+l+", but got "+F),w[0])}});for(var g=0;g<c;++g){var y="r",v=0;g%2===1?y="l":g>0&&p&&(v=1),a[g]={type:"align",align:y,pregap:v,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};un({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=Hi(t[0]),a=r?[t[0]]:dt(t[0],"ordgroup").body,s=a.map(function(o){var l=N0(o),c=l.text;if("lcr".indexOf(c)!==-1)return{type:"align",align:c};if(c==="|")return{type:"separator",separator:"|"};if(c===":")return{type:"separator",separator:":"};throw new ye("Unknown column alignment: "+c,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Gn(e.parser,i,E0(e.envName))},htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",a={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var s=e.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),r=s.fetch().text,"lcr".indexOf(r)===-1)throw new ye("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),a.cols=[{type:"align",align:r}]}}var i=Gn(e.parser,a,E0(e.envName)),o=Math.max(0,...i.body.map(l=>l.length));return i.cols=new Array(o).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=Gn(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=Hi(t[0]),a=r?[t[0]]:dt(t[0],"ordgroup").body,s=a.map(function(o){var l=N0(o),c=l.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new ye("Unknown column alignment: "+c,o)});if(s.length>1)throw new ye("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Gn(e.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new ye("{subarray} can contain only one column");return i},htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Gn(e.parser,t,E0(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:ap,htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&Vi(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:T0(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Gn(e.parser,t,"display")},htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:ap,htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Vi(e);var t={autoTag:T0(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Gn(e.parser,t,"display")},htmlBuilder:mn,mathmlBuilder:hn});un({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Vi(e),Rk(e.parser)},htmlBuilder:mn,mathmlBuilder:hn});C("\\nonumber","\\gdef\\@eqnsw{0}");C("\\notag","\\nonumber");ze({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new ye(e.funcName+" valid only within array environment")}});var wd=rp;ze({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:a}=e,s=t[0];if(s.type!=="ordgroup")throw new ye("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=dt(s.body[o],"textord").text;if(a==="\\begin"){if(!wd.hasOwnProperty(i))throw new ye("No such environment: "+i,s);var l=wd[i],{args:c,optArgs:d}=r.parseArguments("\\begin{"+i+"}",l),u={mode:r.mode,envName:i,parser:r},m=l.handler(u,c,d);r.expect("\\end",!1);var h=r.nextToken,p=dt(r.parseFunction(),"environment");if(p.name!==i)throw new ye("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",h);return m}return{type:"environment",mode:r.mode,name:i,nameGroup:s}}});var sp=(e,t)=>{var r=e.font,a=t.withFont(r);return jt(e.body,a)},ip=(e,t)=>{var r=e.font,a=t.withFont(r);return It(e.body,a)},jd={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};ze({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=Ci(t[0]),i=a;return i in jd&&(i=jd[i]),{type:"font",mode:r.mode,font:i.slice(1),body:s}},htmlBuilder:sp,mathmlBuilder:ip});ze({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,a=t[0],s=Nt.isCharacterBox(a);return{type:"mclass",mode:r.mode,mclass:Wi(a),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:a}],isCharacterBox:s}}});ze({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:a,breakOnTokenText:s}=e,{mode:i}=r,o=r.parseExpression(!0,s),l="math"+a.slice(1);return{type:"font",mode:i,font:l,body:{type:"ordgroup",mode:r.mode,body:o}}},htmlBuilder:sp,mathmlBuilder:ip});var op=(e,t)=>{var r=t;return e==="display"?r=r.id>=tt.SCRIPT.id?r.text():tt.DISPLAY:e==="text"&&r.size===tt.DISPLAY.size?r=tt.TEXT:e==="script"?r=tt.SCRIPT:e==="scriptscript"&&(r=tt.SCRIPTSCRIPT),r},I0=(e,t)=>{var r=op(e.size,t.style),a=r.fracNum(),s=r.fracDen(),i;i=t.havingStyle(a);var o=jt(e.numer,i,t);if(e.continued){var l=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height<l?l:o.height,o.depth=o.depth<c?c:o.depth}i=t.havingStyle(s);var d=jt(e.denom,i,t),u,m,h;e.hasBarLine?(e.barSize?(m=_t(e.barSize,t),u=K.makeLineSpan("frac-line",t,m)):u=K.makeLineSpan("frac-line",t),m=u.height,h=u.height):(u=null,m=0,h=t.fontMetrics().defaultRuleThickness);var p,g,y;r.size===tt.DISPLAY.size||e.size==="display"?(p=t.fontMetrics().num1,m>0?g=3*h:g=7*h,y=t.fontMetrics().denom1):(m>0?(p=t.fontMetrics().num2,g=h):(p=t.fontMetrics().num3,g=3*h),y=t.fontMetrics().denom2);var v;if(u){var S=t.fontMetrics().axisHeight;p-o.depth-(S+.5*m)<g&&(p+=g-(p-o.depth-(S+.5*m))),S-.5*m-(d.height-y)<g&&(y+=g-(S-.5*m-(d.height-y)));var N=-(S-.5*m);v=K.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:y},{type:"elem",elem:u,shift:N},{type:"elem",elem:o,shift:-p}]},t)}else{var w=p-o.depth-(d.height-y);w<g&&(p+=.5*(g-w),y+=.5*(g-w)),v=K.makeVList({positionType:"individualShift",children:[{type:"elem",elem:d,shift:y},{type:"elem",elem:o,shift:-p}]},t)}i=t.havingStyle(r),v.height*=i.sizeMultiplier/t.sizeMultiplier,v.depth*=i.sizeMultiplier/t.sizeMultiplier;var I;r.size===tt.DISPLAY.size?I=t.fontMetrics().delim1:r.size===tt.SCRIPTSCRIPT.size?I=t.havingStyle(tt.SCRIPT).fontMetrics().delim2:I=t.fontMetrics().delim2;var F,E;return e.leftDelim==null?F=xs(t,["mopen"]):F=jn.customSizedDelim(e.leftDelim,I,!0,t.havingStyle(r),e.mode,["mopen"]),e.continued?E=K.makeSpan([]):e.rightDelim==null?E=xs(t,["mclose"]):E=jn.customSizedDelim(e.rightDelim,I,!0,t.havingStyle(r),e.mode,["mclose"]),K.makeSpan(["mord"].concat(i.sizingClasses(t)),[F,K.makeSpan(["mfrac"],[v]),E],t)},D0=(e,t)=>{var r=new xe.MathNode("mfrac",[It(e.numer,t),It(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var a=_t(e.barSize,t);r.setAttribute("linethickness",Te(a))}var s=op(e.size,t.style);if(s.size!==t.style.size){r=new xe.MathNode("mstyle",[r]);var i=s.size===tt.DISPLAY.size?"true":"false";r.setAttribute("displaystyle",i),r.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var o=[];if(e.leftDelim!=null){var l=new xe.MathNode("mo",[new xe.TextNode(e.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}if(o.push(r),e.rightDelim!=null){var c=new xe.MathNode("mo",[new xe.TextNode(e.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),o.push(c)}return w0(o)}return r};ze({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=t[0],i=t[1],o,l=null,c=null,d="auto";switch(a){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,l="(",c=")";break;case"\\\\bracefrac":o=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":o=!1,l="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(a){case"\\dfrac":case"\\dbinom":d="display";break;case"\\tfrac":case"\\tbinom":d="text";break}return{type:"genfrac",mode:r.mode,continued:!1,numer:s,denom:i,hasBarLine:o,leftDelim:l,rightDelim:c,size:d,barSize:null}},htmlBuilder:I0,mathmlBuilder:D0});ze({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=t[0],i=t[1];return{type:"genfrac",mode:r.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});ze({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:a}=e,s;switch(r){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:s,token:a}}});var Nd=["display","text","script","scriptscript"],Sd=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};ze({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,a=t[4],s=t[5],i=Ci(t[0]),o=i.type==="atom"&&i.family==="open"?Sd(i.text):null,l=Ci(t[1]),c=l.type==="atom"&&l.family==="close"?Sd(l.text):null,d=dt(t[2],"size"),u,m=null;d.isBlank?u=!0:(m=d.value,u=m.number>0);var h="auto",p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=dt(p.body[0],"textord");h=Nd[Number(g.text)]}}else p=dt(p,"textord"),h=Nd[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:a,denom:s,continued:!1,hasBarLine:u,barSize:m,leftDelim:o,rightDelim:c,size:h}},htmlBuilder:I0,mathmlBuilder:D0});ze({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:a,token:s}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:dt(t[0],"size").value,token:s}}});ze({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=t[0],i=C3(dt(t[1],"infix").size),o=t[2],l=i.number>0;return{type:"genfrac",mode:r.mode,numer:s,denom:o,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:I0,mathmlBuilder:D0});var lp=(e,t)=>{var r=t.style,a,s;e.type==="supsub"?(a=e.sup?jt(e.sup,t.havingStyle(r.sup()),t):jt(e.sub,t.havingStyle(r.sub()),t),s=dt(e.base,"horizBrace")):s=dt(e,"horizBrace");var i=jt(s.base,t.havingBaseStyle(tt.DISPLAY)),o=Cn.svgSpan(s,t),l;if(s.isOver?(l=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o}]},t),l.children[0].children[0].children[1].classes.push("svg-align")):(l=K.makeVList({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:i}]},t),l.children[0].children[0].children[0].classes.push("svg-align")),a){var c=K.makeSpan(["mord",s.isOver?"mover":"munder"],[l],t);s.isOver?l=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:a}]},t):l=K.makeVList({positionType:"bottom",positionData:c.depth+.2+a.height+a.depth,children:[{type:"elem",elem:a},{type:"kern",size:.2},{type:"elem",elem:c}]},t)}return K.makeSpan(["mord",s.isOver?"mover":"munder"],[l],t)},Xk=(e,t)=>{var r=Cn.mathMLnode(e.label);return new xe.MathNode(e.isOver?"mover":"munder",[It(e.base,t),r])};ze({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:a}=e;return{type:"horizBrace",mode:r.mode,label:a,isOver:/^\\over/.test(a),base:t[0]}},htmlBuilder:lp,mathmlBuilder:Xk});ze({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,a=t[1],s=dt(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:r.mode,href:s,body:Ut(a)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=Qt(e.body,t,!1);return K.makeAnchor(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=Un(e.body,t);return r instanceof Ar||(r=new Ar("mrow",[r])),r.setAttribute("href",e.href),r}});ze({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,a=dt(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:a}))return r.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<a.length;i++){var o=a[i];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var l={type:"text",mode:r.mode,font:"\\texttt",body:s};return{type:"href",mode:r.mode,href:a,body:Ut(l)}}});ze({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:r}=e;return{type:"hbox",mode:r.mode,body:Ut(t[0])}},htmlBuilder(e,t){var r=Qt(e.body,t,!1);return K.makeFragment(r)},mathmlBuilder(e,t){return new xe.MathNode("mrow",jr(e.body,t))}});ze({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:a,token:s}=e,i=dt(t[0],"raw").string,o=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(a){case"\\htmlClass":c.class=i,l={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,l={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,l={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var d=i.split(","),u=0;u<d.length;u++){var m=d[u].split("=");if(m.length!==2)throw new ye("Error parsing key-value for \\htmlData");c["data-"+m[0].trim()]=m[1].trim()}l={command:"\\htmlData",attributes:c};break}default:throw new Error("Unrecognized html command")}return r.settings.isTrusted(l)?{type:"html",mode:r.mode,attributes:c,body:Ut(o)}:r.formatUnsupportedCmd(a)},htmlBuilder:(e,t)=>{var r=Qt(e.body,t,!1),a=["enclosing"];e.attributes.class&&a.push(...e.attributes.class.trim().split(/\s+/));var s=K.makeSpan(a,r,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&s.setAttribute(i,e.attributes[i]);return s},mathmlBuilder:(e,t)=>Un(e.body,t)});ze({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:Ut(t[0]),mathml:Ut(t[1])}},htmlBuilder:(e,t)=>{var r=Qt(e.html,t,!1);return K.makeFragment(r)},mathmlBuilder:(e,t)=>Un(e.mathml,t)});var Po=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new ye("Invalid size: '"+t+"' in \\includegraphics");var a={number:+(r[1]+r[2]),unit:r[3]};if(!Mh(a))throw new ye("Invalid unit: '"+a.unit+"' in \\includegraphics.");return a};ze({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:a}=e,s={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},l="";if(r[0])for(var c=dt(r[0],"raw").string,d=c.split(","),u=0;u<d.length;u++){var m=d[u].split("=");if(m.length===2){var h=m[1].trim();switch(m[0].trim()){case"alt":l=h;break;case"width":s=Po(h);break;case"height":i=Po(h);break;case"totalheight":o=Po(h);break;default:throw new ye("Invalid key: '"+m[0]+"' in \\includegraphics.")}}}var p=dt(t[0],"url").url;return l===""&&(l=p,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),a.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:a.mode,alt:l,width:s,height:i,totalheight:o,src:p}:a.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var r=_t(e.height,t),a=0;e.totalheight.number>0&&(a=_t(e.totalheight,t)-r);var s=0;e.width.number>0&&(s=_t(e.width,t));var i={height:Te(r+a)};s>0&&(i.width=Te(s)),a>0&&(i.verticalAlign=Te(-a));var o=new X3(e.src,e.alt,i);return o.height=r,o.depth=a,o},mathmlBuilder:(e,t)=>{var r=new xe.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var a=_t(e.height,t),s=0;if(e.totalheight.number>0&&(s=_t(e.totalheight,t)-a,r.setAttribute("valign",Te(-s))),r.setAttribute("height",Te(a+s)),e.width.number>0){var i=_t(e.width,t);r.setAttribute("width",Te(i))}return r.setAttribute("src",e.src),r}});ze({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:a}=e,s=dt(t[0],"size");if(r.settings.strict){var i=a[1]==="m",o=s.value.unit==="mu";i?(o||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" supports only mu units, "+("not "+s.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" works only in math mode")):o&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:s.value}},htmlBuilder(e,t){return K.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var r=_t(e.dimension,t);return new xe.SpaceNode(r)}});ze({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=t[0];return{type:"lap",mode:r.mode,alignment:a.slice(5),body:s}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=K.makeSpan([],[jt(e.body,t)]),r=K.makeSpan(["inner"],[r],t)):r=K.makeSpan(["inner"],[jt(e.body,t)]);var a=K.makeSpan(["fix"],[]),s=K.makeSpan([e.alignment],[r,a],t),i=K.makeSpan(["strut"]);return i.style.height=Te(s.height+s.depth),s.depth&&(i.style.verticalAlign=Te(-s.depth)),s.children.unshift(i),s=K.makeSpan(["thinbox"],[s],t),K.makeSpan(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var r=new xe.MathNode("mpadded",[It(e.body,t)]);if(e.alignment!=="rlap"){var a=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",a+"width")}return r.setAttribute("width","0px"),r}});ze({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:a}=e,s=a.mode;a.switchMode("math");var i=r==="\\("?"\\)":"$",o=a.parseExpression(!1,i);return a.expect(i),a.switchMode(s),{type:"styling",mode:a.mode,style:"text",body:o}}});ze({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new ye("Mismatched "+e.funcName)}});var Cd=(e,t)=>{switch(t.style.size){case tt.DISPLAY.size:return e.display;case tt.TEXT.size:return e.text;case tt.SCRIPT.size:return e.script;case tt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};ze({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:Ut(t[0]),text:Ut(t[1]),script:Ut(t[2]),scriptscript:Ut(t[3])}},htmlBuilder:(e,t)=>{var r=Cd(e,t),a=Qt(r,t,!1);return K.makeFragment(a)},mathmlBuilder:(e,t)=>{var r=Cd(e,t);return Un(r,t)}});var cp=(e,t,r,a,s,i,o)=>{e=K.makeSpan([],[e]);var l=r&&Nt.isCharacterBox(r),c,d;if(t){var u=jt(t,a.havingStyle(s.sup()),a);d={elem:u,kern:Math.max(a.fontMetrics().bigOpSpacing1,a.fontMetrics().bigOpSpacing3-u.depth)}}if(r){var m=jt(r,a.havingStyle(s.sub()),a);c={elem:m,kern:Math.max(a.fontMetrics().bigOpSpacing2,a.fontMetrics().bigOpSpacing4-m.height)}}var h;if(d&&c){var p=a.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o;h=K.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Te(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Te(i)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else if(c){var g=e.height-o;h=K.makeVList({positionType:"top",positionData:g,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Te(-i)},{type:"kern",size:c.kern},{type:"elem",elem:e}]},a)}else if(d){var y=e.depth+o;h=K.makeVList({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:d.kern},{type:"elem",elem:d.elem,marginLeft:Te(i)},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else return e;var v=[h];if(c&&i!==0&&!l){var w=K.makeSpan(["mspace"],[],a);w.style.marginRight=Te(i),v.unshift(w)}return K.makeSpan(["mop","op-limits"],v,a)},dp=["\\smallint"],Ha=(e,t)=>{var r,a,s=!1,i;e.type==="supsub"?(r=e.sup,a=e.sub,i=dt(e.base,"op"),s=!0):i=dt(e,"op");var o=t.style,l=!1;o.size===tt.DISPLAY.size&&i.symbol&&!dp.includes(i.name)&&(l=!0);var c;if(i.symbol){var d=l?"Size2-Regular":"Size1-Regular",u="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(u=i.name.slice(1),i.name=u==="oiint"?"\\iint":"\\iiint"),c=K.makeSymbol(i.name,d,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),u.length>0){var m=c.italic,h=K.staticSvg(u+"Size"+(l?"2":"1"),t);c=K.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:h,shift:l?.08:0}]},t),i.name="\\"+u,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var p=Qt(i.body,t,!0);p.length===1&&p[0]instanceof Or?(c=p[0],c.classes[0]="mop"):c=K.makeSpan(["mop"],p,t)}else{for(var g=[],y=1;y<i.name.length;y++)g.push(K.mathsym(i.name[y],i.mode,t));c=K.makeSpan(["mop"],g,t)}var v=0,w=0;return(c instanceof Or||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift&&(v=(c.height-c.depth)/2-t.fontMetrics().axisHeight,w=c.italic),s?cp(c,r,a,t,o,w,v):(v&&(c.style.position="relative",c.style.top=Te(v)),c)},zs=(e,t)=>{var r;if(e.symbol)r=new Ar("mo",[$r(e.name,e.mode)]),dp.includes(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new Ar("mo",jr(e.body,t));else{r=new Ar("mi",[new on(e.name.slice(1))]);var a=new Ar("mo",[$r("⁡","text")]);e.parentIsSupSub?r=new Ar("mrow",[r,a]):r=Bh([r,a])}return r},Qk={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};ze({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=a;return s.length===1&&(s=Qk[s]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Ha,mathmlBuilder:zs});ze({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,a=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Ut(a)}},htmlBuilder:Ha,mathmlBuilder:zs});var Zk={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};ze({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Ha,mathmlBuilder:zs});ze({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Ha,mathmlBuilder:zs});ze({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e,a=r;return a.length===1&&(a=Zk[a]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:a}},htmlBuilder:Ha,mathmlBuilder:zs});var up=(e,t)=>{var r,a,s=!1,i;e.type==="supsub"?(r=e.sup,a=e.sub,i=dt(e.base,"operatorname"),s=!0):i=dt(e,"operatorname");var o;if(i.body.length>0){for(var l=i.body.map(m=>{var h=m.text;return typeof h=="string"?{type:"textord",mode:m.mode,text:h}:m}),c=Qt(l,t.withFont("mathrm"),!0),d=0;d<c.length;d++){var u=c[d];u instanceof Or&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=K.makeSpan(["mop"],c,t)}else o=K.makeSpan(["mop"],[],t);return s?cp(o,r,a,t,t.style,0,0):o},e6=(e,t)=>{for(var r=jr(e.body,t.withFont("mathrm")),a=!0,s=0;s<r.length;s++){var i=r[s];if(!(i instanceof xe.SpaceNode))if(i instanceof xe.MathNode)switch(i.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=i.children[0];i.children.length===1&&o instanceof xe.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):a=!1;break}default:a=!1}else a=!1}if(a){var l=r.map(u=>u.toText()).join("");r=[new xe.TextNode(l)]}var c=new xe.MathNode("mi",r);c.setAttribute("mathvariant","normal");var d=new xe.MathNode("mo",[$r("⁡","text")]);return e.parentIsSupSub?new xe.MathNode("mrow",[c,d]):xe.newDocumentFragment([c,d])};ze({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:a}=e,s=t[0];return{type:"operatorname",mode:r.mode,body:Ut(s),alwaysHandleSupSub:a==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:up,mathmlBuilder:e6});C("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");ha({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?K.makeFragment(Qt(e.body,t,!1)):K.makeSpan(["mord"],Qt(e.body,t,!0),t)},mathmlBuilder(e,t){return Un(e.body,t,!0)}});ze({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,a=t[0];return{type:"overline",mode:r.mode,body:a}},htmlBuilder(e,t){var r=jt(e.body,t.havingCrampedStyle()),a=K.makeLineSpan("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:a},{type:"kern",size:s}]},t);return K.makeSpan(["mord","overline"],[i],t)},mathmlBuilder(e,t){var r=new xe.MathNode("mo",[new xe.TextNode("‾")]);r.setAttribute("stretchy","true");var a=new xe.MathNode("mover",[It(e.body,t),r]);return a.setAttribute("accent","true"),a}});ze({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,a=t[0];return{type:"phantom",mode:r.mode,body:Ut(a)}},htmlBuilder:(e,t)=>{var r=Qt(e.body,t.withPhantom(),!1);return K.makeFragment(r)},mathmlBuilder:(e,t)=>{var r=jr(e.body,t);return new xe.MathNode("mphantom",r)}});ze({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,a=t[0];return{type:"hphantom",mode:r.mode,body:a}},htmlBuilder:(e,t)=>{var r=K.makeSpan([],[jt(e.body,t.withPhantom())]);if(r.height=0,r.depth=0,r.children)for(var a=0;a<r.children.length;a++)r.children[a].height=0,r.children[a].depth=0;return r=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r}]},t),K.makeSpan(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var r=jr(Ut(e.body),t),a=new xe.MathNode("mphantom",r),s=new xe.MathNode("mpadded",[a]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});ze({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,a=t[0];return{type:"vphantom",mode:r.mode,body:a}},htmlBuilder:(e,t)=>{var r=K.makeSpan(["inner"],[jt(e.body,t.withPhantom())]),a=K.makeSpan(["fix"],[]);return K.makeSpan(["mord","rlap"],[r,a],t)},mathmlBuilder:(e,t)=>{var r=jr(Ut(e.body),t),a=new xe.MathNode("mphantom",r),s=new xe.MathNode("mpadded",[a]);return s.setAttribute("width","0px"),s}});ze({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,a=dt(t[0],"size").value,s=t[1];return{type:"raisebox",mode:r.mode,dy:a,body:s}},htmlBuilder(e,t){var r=jt(e.body,t),a=_t(e.dy,t);return K.makeVList({positionType:"shift",positionData:-a,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){var r=new xe.MathNode("mpadded",[It(e.body,t)]),a=e.dy.number+e.dy.unit;return r.setAttribute("voffset",a),r}});ze({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});ze({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:a}=e,s=r[0],i=dt(t[0],"size"),o=dt(t[1],"size");return{type:"rule",mode:a.mode,shift:s&&dt(s,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var r=K.makeSpan(["mord","rule"],[],t),a=_t(e.width,t),s=_t(e.height,t),i=e.shift?_t(e.shift,t):0;return r.style.borderRightWidth=Te(a),r.style.borderTopWidth=Te(s),r.style.bottom=Te(i),r.width=a,r.height=s+i,r.depth=-i,r.maxFontSize=s*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=_t(e.width,t),a=_t(e.height,t),s=e.shift?_t(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new xe.MathNode("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Te(r)),o.setAttribute("height",Te(a));var l=new xe.MathNode("mpadded",[o]);return s>=0?l.setAttribute("height",Te(s)):(l.setAttribute("height",Te(s)),l.setAttribute("depth",Te(-s))),l.setAttribute("voffset",Te(s)),l}});function mp(e,t,r){for(var a=Qt(e,t,!1),s=t.sizeMultiplier/r.sizeMultiplier,i=0;i<a.length;i++){var o=a[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(a[i].classes,t.sizingClasses(r)):a[i].classes[o+1]==="reset-size"+t.size&&(a[i].classes[o+1]="reset-size"+r.size),a[i].height*=s,a[i].depth*=s}return K.makeFragment(a)}var Md=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],t6=(e,t)=>{var r=t.havingSize(e.size);return mp(e.body,r,t)};ze({type:"sizing",names:Md,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:a,parser:s}=e,i=s.parseExpression(!1,r);return{type:"sizing",mode:s.mode,size:Md.indexOf(a)+1,body:i}},htmlBuilder:t6,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),a=jr(e.body,r),s=new xe.MathNode("mstyle",a);return s.setAttribute("mathsize",Te(r.sizeMultiplier)),s}});ze({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:a}=e,s=!1,i=!1,o=r[0]&&dt(r[0],"ordgroup");if(o)for(var l="",c=0;c<o.body.length;++c){var d=o.body[c];if(l=d.text,l==="t")s=!0;else if(l==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var u=t[0];return{type:"smash",mode:a.mode,body:u,smashHeight:s,smashDepth:i}},htmlBuilder:(e,t)=>{var r=K.makeSpan([],[jt(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0,r.children))for(var a=0;a<r.children.length;a++)r.children[a].height=0;if(e.smashDepth&&(r.depth=0,r.children))for(var s=0;s<r.children.length;s++)r.children[s].depth=0;var i=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r}]},t);return K.makeSpan(["mord"],[i],t)},mathmlBuilder:(e,t)=>{var r=new xe.MathNode("mpadded",[It(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});ze({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:a}=e,s=r[0],i=t[0];return{type:"sqrt",mode:a.mode,body:i,index:s}},htmlBuilder(e,t){var r=jt(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=K.wrapFragment(r,t);var a=t.fontMetrics(),s=a.defaultRuleThickness,i=s;t.style.id<tt.TEXT.id&&(i=t.fontMetrics().xHeight);var o=s+i/4,l=r.height+r.depth+o+s,{span:c,ruleWidth:d,advanceWidth:u}=jn.sqrtImage(l,t),m=c.height-d;m>r.height+r.depth+o&&(o=(o+m-r.height-r.depth)/2);var h=c.height-r.height-o-d;r.style.paddingLeft=Te(u);var p=K.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+h)},{type:"elem",elem:c},{type:"kern",size:d}]},t);if(e.index){var g=t.havingStyle(tt.SCRIPTSCRIPT),y=jt(e.index,g,t),v=.6*(p.height-p.depth),w=K.makeVList({positionType:"shift",positionData:-v,children:[{type:"elem",elem:y}]},t),S=K.makeSpan(["root"],[w]);return K.makeSpan(["mord","sqrt"],[S,p],t)}else return K.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:a}=e;return a?new xe.MathNode("mroot",[It(r,t),It(a,t)]):new xe.MathNode("msqrt",[It(r,t)])}});var Ad={display:tt.DISPLAY,text:tt.TEXT,script:tt.SCRIPT,scriptscript:tt.SCRIPTSCRIPT};ze({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:a,parser:s}=e,i=s.parseExpression(!0,r),o=a.slice(1,a.length-5);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(e,t){var r=Ad[e.style],a=t.havingStyle(r).withFont("");return mp(e.body,a,t)},mathmlBuilder(e,t){var r=Ad[e.style],a=t.havingStyle(r),s=jr(e.body,a),i=new xe.MathNode("mstyle",s),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=o[e.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var r6=function(t,r){var a=t.base;if(a)if(a.type==="op"){var s=a.limits&&(r.style.size===tt.DISPLAY.size||a.alwaysHandleSupSub);return s?Ha:null}else if(a.type==="operatorname"){var i=a.alwaysHandleSupSub&&(r.style.size===tt.DISPLAY.size||a.limits);return i?up:null}else{if(a.type==="accent")return Nt.isCharacterBox(a.base)?S0:null;if(a.type==="horizBrace"){var o=!t.sub;return o===a.isOver?lp:null}else return null}else return null};ha({type:"supsub",htmlBuilder(e,t){var r=r6(e,t);if(r)return r(e,t);var{base:a,sup:s,sub:i}=e,o=jt(a,t),l,c,d=t.fontMetrics(),u=0,m=0,h=a&&Nt.isCharacterBox(a);if(s){var p=t.havingStyle(t.style.sup());l=jt(s,p,t),h||(u=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());c=jt(i,g,t),h||(m=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var y;t.style===tt.DISPLAY?y=d.sup1:t.style.cramped?y=d.sup3:y=d.sup2;var v=t.sizeMultiplier,w=Te(.5/d.ptPerEm/v),S=null;if(c){var N=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(o instanceof Or||N)&&(S=Te(-o.italic))}var I;if(l&&c){u=Math.max(u,y,l.depth+.25*d.xHeight),m=Math.max(m,d.sub2);var F=d.defaultRuleThickness,E=4*F;if(u-l.depth-(c.height-m)<E){m=E-(u-l.depth)+c.height;var R=.8*d.xHeight-(u-l.depth);R>0&&(u+=R,m-=R)}var H=[{type:"elem",elem:c,shift:m,marginRight:w,marginLeft:S},{type:"elem",elem:l,shift:-u,marginRight:w}];I=K.makeVList({positionType:"individualShift",children:H},t)}else if(c){m=Math.max(m,d.sub1,c.height-.8*d.xHeight);var $=[{type:"elem",elem:c,marginLeft:S,marginRight:w}];I=K.makeVList({positionType:"shift",positionData:m,children:$},t)}else if(l)u=Math.max(u,y,l.depth+.25*d.xHeight),I=K.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:l,marginRight:w}]},t);else throw new Error("supsub must have either sup or sub.");var A=vl(o,"right")||"mord";return K.makeSpan([A],[o,K.makeSpan(["msupsub"],[I])],t)},mathmlBuilder(e,t){var r=!1,a,s;e.base&&e.base.type==="horizBrace"&&(s=!!e.sup,s===e.base.isOver&&(r=!0,a=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[It(e.base,t)];e.sub&&i.push(It(e.sub,t)),e.sup&&i.push(It(e.sup,t));var o;if(r)o=a?"mover":"munder";else if(e.sub)if(e.sup){var d=e.base;d&&d.type==="op"&&d.limits&&t.style===tt.DISPLAY||d&&d.type==="operatorname"&&d.alwaysHandleSupSub&&(t.style===tt.DISPLAY||d.limits)?o="munderover":o="msubsup"}else{var c=e.base;c&&c.type==="op"&&c.limits&&(t.style===tt.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||t.style===tt.DISPLAY)?o="munder":o="msub"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===tt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===tt.DISPLAY)?o="mover":o="msup"}return new xe.MathNode(o,i)}});ha({type:"atom",htmlBuilder(e,t){return K.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new xe.MathNode("mo",[$r(e.text,e.mode)]);if(e.family==="bin"){var a=j0(e,t);a==="bold-italic"&&r.setAttribute("mathvariant",a)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});var hp={mi:"italic",mn:"normal",mtext:"normal"};ha({type:"mathord",htmlBuilder(e,t){return K.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var r=new xe.MathNode("mi",[$r(e.text,e.mode,t)]),a=j0(e,t)||"italic";return a!==hp[r.type]&&r.setAttribute("mathvariant",a),r}});ha({type:"textord",htmlBuilder(e,t){return K.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var r=$r(e.text,e.mode,t),a=j0(e,t)||"normal",s;return e.mode==="text"?s=new xe.MathNode("mtext",[r]):/[0-9]/.test(e.text)?s=new xe.MathNode("mn",[r]):e.text==="\\prime"?s=new xe.MathNode("mo",[r]):s=new xe.MathNode("mi",[r]),a!==hp[s.type]&&s.setAttribute("mathvariant",a),s}});var Ro={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Fo={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};ha({type:"spacing",htmlBuilder(e,t){if(Fo.hasOwnProperty(e.text)){var r=Fo[e.text].className||"";if(e.mode==="text"){var a=K.makeOrd(e,t,"textord");return a.classes.push(r),a}else return K.makeSpan(["mspace",r],[K.mathsym(e.text,e.mode,t)],t)}else{if(Ro.hasOwnProperty(e.text))return K.makeSpan(["mspace",Ro[e.text]],[],t);throw new ye('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(Fo.hasOwnProperty(e.text))r=new xe.MathNode("mtext",[new xe.TextNode(" ")]);else{if(Ro.hasOwnProperty(e.text))return new xe.MathNode("mspace");throw new ye('Unknown type of space "'+e.text+'"')}return r}});var Td=()=>{var e=new xe.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};ha({type:"tag",mathmlBuilder(e,t){var r=new xe.MathNode("mtable",[new xe.MathNode("mtr",[Td(),new xe.MathNode("mtd",[Un(e.body,t)]),Td(),new xe.MathNode("mtd",[Un(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var Ed={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Id={"\\textbf":"textbf","\\textmd":"textmd"},n6={"\\textit":"textit","\\textup":"textup"},Dd=(e,t)=>{var r=e.font;if(r){if(Ed[r])return t.withTextFontFamily(Ed[r]);if(Id[r])return t.withTextFontWeight(Id[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(n6[r])};ze({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:a}=e,s=t[0];return{type:"text",mode:r.mode,body:Ut(s),font:a}},htmlBuilder(e,t){var r=Dd(e,t),a=Qt(e.body,r,!0);return K.makeSpan(["mord","text"],a,r)},mathmlBuilder(e,t){var r=Dd(e,t);return Un(e.body,r)}});ze({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=jt(e.body,t),a=K.makeLineSpan("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=K.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:s},{type:"elem",elem:a},{type:"kern",size:3*s},{type:"elem",elem:r}]},t);return K.makeSpan(["mord","underline"],[i],t)},mathmlBuilder(e,t){var r=new xe.MathNode("mo",[new xe.TextNode("‾")]);r.setAttribute("stretchy","true");var a=new xe.MathNode("munder",[It(e.body,t),r]);return a.setAttribute("accentunder","true"),a}});ze({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=jt(e.body,t),a=t.fontMetrics().axisHeight,s=.5*(r.height-a-(r.depth+a));return K.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){return new xe.MathNode("mpadded",[It(e.body,t)],["vcenter"])}});ze({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new ye("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=zd(e),a=[],s=t.havingStyle(t.style.text()),i=0;i<r.length;i++){var o=r[i];o==="~"&&(o="\\textasciitilde"),a.push(K.makeSymbol(o,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return K.makeSpan(["mord","text"].concat(s.sizingClasses(t)),K.tryCombineChars(a),s)},mathmlBuilder(e,t){var r=new xe.TextNode(zd(e)),a=new xe.MathNode("mtext",[r]);return a.setAttribute("mathvariant","monospace"),a}});var zd=e=>e.body.replace(/ /g,e.star?"␣":" "),$n=Rh,pp=`[ \r
684
+ ]`,a6="\\\\[a-zA-Z@]+",s6="\\\\[^\uD800-\uDFFF]",i6="("+a6+")"+pp+"*",o6=`\\\\(
685
+ |[ \r ]+
686
+ ?)[ \r ]*`,Nl="[̀-ͯ]",l6=new RegExp(Nl+"+$"),c6="("+pp+"+)|"+(o6+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(Nl+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(Nl+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+i6)+("|"+s6+")");class Ld{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(c6,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Ir("EOF",new kr(this,r,r));var a=this.tokenRegex.exec(t);if(a===null||a.index!==r)throw new ye("Unexpected character: '"+t[r]+"'",new Ir(t[r],new kr(this,r,r+1)));var s=a[6]||a[3]||(a[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=t.indexOf(`
687
+ `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Ir(s,new kr(this,r,this.tokenRegex.lastIndex))}}class d6{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new ye("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,a){if(a===void 0&&(a=!1),a){for(var s=0;s<this.undefStack.length;s++)delete this.undefStack[s][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}}var u6=np;C("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});C("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});C("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});C("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});C("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});C("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");C("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var Pd={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};C("\\char",function(e){var t=e.popToken(),r,a="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")a=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new ye("\\char` missing argument");a=t.text.charCodeAt(0)}else r=10;if(r){if(a=Pd[t.text],a==null||a>=r)throw new ye("Invalid base-"+r+" digit "+t.text);for(var s;(s=Pd[e.future().text])!=null&&s<r;)a*=r,a+=s,e.popToken()}return"\\@char{"+a+"}"});var z0=(e,t,r,a)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new ye("\\newcommand's first argument must be a macro name");var i=s[0].text,o=e.isDefined(i);if(o&&!t)throw new ye("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!r)throw new ye("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var l=0;if(s=e.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",d=e.expandNextToken();d.text!=="]"&&d.text!=="EOF";)c+=d.text,d=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new ye("Invalid number of arguments: "+c);l=parseInt(c),s=e.consumeArg().tokens}return o&&a||e.macros.set(i,{tokens:s,numArgs:l}),""};C("\\newcommand",e=>z0(e,!1,!0,!1));C("\\renewcommand",e=>z0(e,!0,!1,!1));C("\\providecommand",e=>z0(e,!0,!0,!0));C("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});C("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});C("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),$n[r],Lt.math[r],Lt.text[r]),""});C("\\bgroup","{");C("\\egroup","}");C("~","\\nobreakspace");C("\\lq","`");C("\\rq","'");C("\\aa","\\r a");C("\\AA","\\r A");C("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");C("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");C("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");C("ℬ","\\mathscr{B}");C("ℰ","\\mathscr{E}");C("ℱ","\\mathscr{F}");C("ℋ","\\mathscr{H}");C("ℐ","\\mathscr{I}");C("ℒ","\\mathscr{L}");C("ℳ","\\mathscr{M}");C("ℛ","\\mathscr{R}");C("ℭ","\\mathfrak{C}");C("ℌ","\\mathfrak{H}");C("ℨ","\\mathfrak{Z}");C("\\Bbbk","\\Bbb{k}");C("·","\\cdotp");C("\\llap","\\mathllap{\\textrm{#1}}");C("\\rlap","\\mathrlap{\\textrm{#1}}");C("\\clap","\\mathclap{\\textrm{#1}}");C("\\mathstrut","\\vphantom{(}");C("\\underbar","\\underline{\\text{#1}}");C("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');C("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");C("\\ne","\\neq");C("≠","\\neq");C("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");C("∉","\\notin");C("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");C("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");C("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");C("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");C("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");C("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");C("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");C("⟂","\\perp");C("‼","\\mathclose{!\\mkern-0.8mu!}");C("∌","\\notni");C("⌜","\\ulcorner");C("⌝","\\urcorner");C("⌞","\\llcorner");C("⌟","\\lrcorner");C("©","\\copyright");C("®","\\textregistered");C("️","\\textregistered");C("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');C("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');C("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');C("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');C("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");C("⋮","\\vdots");C("\\varGamma","\\mathit{\\Gamma}");C("\\varDelta","\\mathit{\\Delta}");C("\\varTheta","\\mathit{\\Theta}");C("\\varLambda","\\mathit{\\Lambda}");C("\\varXi","\\mathit{\\Xi}");C("\\varPi","\\mathit{\\Pi}");C("\\varSigma","\\mathit{\\Sigma}");C("\\varUpsilon","\\mathit{\\Upsilon}");C("\\varPhi","\\mathit{\\Phi}");C("\\varPsi","\\mathit{\\Psi}");C("\\varOmega","\\mathit{\\Omega}");C("\\substack","\\begin{subarray}{c}#1\\end{subarray}");C("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");C("\\boxed","\\fbox{$\\displaystyle{#1}$}");C("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");C("\\implies","\\DOTSB\\;\\Longrightarrow\\;");C("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");C("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");C("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Rd={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};C("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Rd?t=Rd[r]:(r.slice(0,4)==="\\not"||r in Lt.math&&["bin","rel"].includes(Lt.math[r].group))&&(t="\\dotsb"),t});var L0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};C("\\dotso",function(e){var t=e.future().text;return t in L0?"\\ldots\\,":"\\ldots"});C("\\dotsc",function(e){var t=e.future().text;return t in L0&&t!==","?"\\ldots\\,":"\\ldots"});C("\\cdots",function(e){var t=e.future().text;return t in L0?"\\@cdots\\,":"\\@cdots"});C("\\dotsb","\\cdots");C("\\dotsm","\\cdots");C("\\dotsi","\\!\\cdots");C("\\dotsx","\\ldots\\,");C("\\DOTSI","\\relax");C("\\DOTSB","\\relax");C("\\DOTSX","\\relax");C("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");C("\\,","\\tmspace+{3mu}{.1667em}");C("\\thinspace","\\,");C("\\>","\\mskip{4mu}");C("\\:","\\tmspace+{4mu}{.2222em}");C("\\medspace","\\:");C("\\;","\\tmspace+{5mu}{.2777em}");C("\\thickspace","\\;");C("\\!","\\tmspace-{3mu}{.1667em}");C("\\negthinspace","\\!");C("\\negmedspace","\\tmspace-{4mu}{.2222em}");C("\\negthickspace","\\tmspace-{5mu}{.277em}");C("\\enspace","\\kern.5em ");C("\\enskip","\\hskip.5em\\relax");C("\\quad","\\hskip1em\\relax");C("\\qquad","\\hskip2em\\relax");C("\\tag","\\@ifstar\\tag@literal\\tag@paren");C("\\tag@paren","\\tag@literal{({#1})}");C("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new ye("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});C("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");C("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");C("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");C("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");C("\\newline","\\\\\\relax");C("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var fp=Te(sn["Main-Regular"][84][1]-.7*sn["Main-Regular"][65][1]);C("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+fp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");C("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+fp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");C("\\hspace","\\@ifstar\\@hspacer\\@hspace");C("\\@hspace","\\hskip #1\\relax");C("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");C("\\ordinarycolon",":");C("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");C("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');C("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');C("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');C("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');C("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');C("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');C("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');C("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');C("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');C("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');C("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');C("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');C("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');C("∷","\\dblcolon");C("∹","\\eqcolon");C("≔","\\coloneqq");C("≕","\\eqqcolon");C("⩴","\\Coloneqq");C("\\ratio","\\vcentcolon");C("\\coloncolon","\\dblcolon");C("\\colonequals","\\coloneqq");C("\\coloncolonequals","\\Coloneqq");C("\\equalscolon","\\eqqcolon");C("\\equalscoloncolon","\\Eqqcolon");C("\\colonminus","\\coloneq");C("\\coloncolonminus","\\Coloneq");C("\\minuscolon","\\eqcolon");C("\\minuscoloncolon","\\Eqcolon");C("\\coloncolonapprox","\\Colonapprox");C("\\coloncolonsim","\\Colonsim");C("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");C("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");C("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");C("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");C("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");C("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");C("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");C("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");C("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");C("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");C("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");C("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");C("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");C("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");C("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");C("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");C("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");C("\\nleqq","\\html@mathml{\\@nleqq}{≰}");C("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");C("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");C("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");C("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");C("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");C("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");C("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");C("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");C("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");C("\\imath","\\html@mathml{\\@imath}{ı}");C("\\jmath","\\html@mathml{\\@jmath}{ȷ}");C("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");C("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");C("⟦","\\llbracket");C("⟧","\\rrbracket");C("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");C("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");C("⦃","\\lBrace");C("⦄","\\rBrace");C("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");C("⦵","\\minuso");C("\\darr","\\downarrow");C("\\dArr","\\Downarrow");C("\\Darr","\\Downarrow");C("\\lang","\\langle");C("\\rang","\\rangle");C("\\uarr","\\uparrow");C("\\uArr","\\Uparrow");C("\\Uarr","\\Uparrow");C("\\N","\\mathbb{N}");C("\\R","\\mathbb{R}");C("\\Z","\\mathbb{Z}");C("\\alef","\\aleph");C("\\alefsym","\\aleph");C("\\Alpha","\\mathrm{A}");C("\\Beta","\\mathrm{B}");C("\\bull","\\bullet");C("\\Chi","\\mathrm{X}");C("\\clubs","\\clubsuit");C("\\cnums","\\mathbb{C}");C("\\Complex","\\mathbb{C}");C("\\Dagger","\\ddagger");C("\\diamonds","\\diamondsuit");C("\\empty","\\emptyset");C("\\Epsilon","\\mathrm{E}");C("\\Eta","\\mathrm{H}");C("\\exist","\\exists");C("\\harr","\\leftrightarrow");C("\\hArr","\\Leftrightarrow");C("\\Harr","\\Leftrightarrow");C("\\hearts","\\heartsuit");C("\\image","\\Im");C("\\infin","\\infty");C("\\Iota","\\mathrm{I}");C("\\isin","\\in");C("\\Kappa","\\mathrm{K}");C("\\larr","\\leftarrow");C("\\lArr","\\Leftarrow");C("\\Larr","\\Leftarrow");C("\\lrarr","\\leftrightarrow");C("\\lrArr","\\Leftrightarrow");C("\\Lrarr","\\Leftrightarrow");C("\\Mu","\\mathrm{M}");C("\\natnums","\\mathbb{N}");C("\\Nu","\\mathrm{N}");C("\\Omicron","\\mathrm{O}");C("\\plusmn","\\pm");C("\\rarr","\\rightarrow");C("\\rArr","\\Rightarrow");C("\\Rarr","\\Rightarrow");C("\\real","\\Re");C("\\reals","\\mathbb{R}");C("\\Reals","\\mathbb{R}");C("\\Rho","\\mathrm{P}");C("\\sdot","\\cdot");C("\\sect","\\S");C("\\spades","\\spadesuit");C("\\sub","\\subset");C("\\sube","\\subseteq");C("\\supe","\\supseteq");C("\\Tau","\\mathrm{T}");C("\\thetasym","\\vartheta");C("\\weierp","\\wp");C("\\Zeta","\\mathrm{Z}");C("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");C("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");C("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");C("\\bra","\\mathinner{\\langle{#1}|}");C("\\ket","\\mathinner{|{#1}\\rangle}");C("\\braket","\\mathinner{\\langle{#1}\\rangle}");C("\\Bra","\\left\\langle#1\\right|");C("\\Ket","\\left|#1\\right\\rangle");var gp=e=>t=>{var r=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),l=t.macros.get("\\|");t.macros.beginGroup();var c=m=>h=>{e&&(h.macros.set("|",o),s.length&&h.macros.set("\\|",l));var p=m;if(!m&&s.length){var g=h.future();g.text==="|"&&(h.popToken(),p=!0)}return{tokens:p?s:a,numArgs:0}};t.macros.set("|",c(!1)),s.length&&t.macros.set("\\|",c(!0));var d=t.consumeArg().tokens,u=t.expandTokens([...i,...d,...r]);return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};C("\\bra@ket",gp(!1));C("\\bra@set",gp(!0));C("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");C("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");C("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");C("\\angln","{\\angl n}");C("\\blue","\\textcolor{##6495ed}{#1}");C("\\orange","\\textcolor{##ffa500}{#1}");C("\\pink","\\textcolor{##ff00af}{#1}");C("\\red","\\textcolor{##df0030}{#1}");C("\\green","\\textcolor{##28ae7b}{#1}");C("\\gray","\\textcolor{gray}{#1}");C("\\purple","\\textcolor{##9d38bd}{#1}");C("\\blueA","\\textcolor{##ccfaff}{#1}");C("\\blueB","\\textcolor{##80f6ff}{#1}");C("\\blueC","\\textcolor{##63d9ea}{#1}");C("\\blueD","\\textcolor{##11accd}{#1}");C("\\blueE","\\textcolor{##0c7f99}{#1}");C("\\tealA","\\textcolor{##94fff5}{#1}");C("\\tealB","\\textcolor{##26edd5}{#1}");C("\\tealC","\\textcolor{##01d1c1}{#1}");C("\\tealD","\\textcolor{##01a995}{#1}");C("\\tealE","\\textcolor{##208170}{#1}");C("\\greenA","\\textcolor{##b6ffb0}{#1}");C("\\greenB","\\textcolor{##8af281}{#1}");C("\\greenC","\\textcolor{##74cf70}{#1}");C("\\greenD","\\textcolor{##1fab54}{#1}");C("\\greenE","\\textcolor{##0d923f}{#1}");C("\\goldA","\\textcolor{##ffd0a9}{#1}");C("\\goldB","\\textcolor{##ffbb71}{#1}");C("\\goldC","\\textcolor{##ff9c39}{#1}");C("\\goldD","\\textcolor{##e07d10}{#1}");C("\\goldE","\\textcolor{##a75a05}{#1}");C("\\redA","\\textcolor{##fca9a9}{#1}");C("\\redB","\\textcolor{##ff8482}{#1}");C("\\redC","\\textcolor{##f9685d}{#1}");C("\\redD","\\textcolor{##e84d39}{#1}");C("\\redE","\\textcolor{##bc2612}{#1}");C("\\maroonA","\\textcolor{##ffbde0}{#1}");C("\\maroonB","\\textcolor{##ff92c6}{#1}");C("\\maroonC","\\textcolor{##ed5fa6}{#1}");C("\\maroonD","\\textcolor{##ca337c}{#1}");C("\\maroonE","\\textcolor{##9e034e}{#1}");C("\\purpleA","\\textcolor{##ddd7ff}{#1}");C("\\purpleB","\\textcolor{##c6b9fc}{#1}");C("\\purpleC","\\textcolor{##aa87ff}{#1}");C("\\purpleD","\\textcolor{##7854ab}{#1}");C("\\purpleE","\\textcolor{##543b78}{#1}");C("\\mintA","\\textcolor{##f5f9e8}{#1}");C("\\mintB","\\textcolor{##edf2df}{#1}");C("\\mintC","\\textcolor{##e0e5cc}{#1}");C("\\grayA","\\textcolor{##f6f7f7}{#1}");C("\\grayB","\\textcolor{##f0f1f2}{#1}");C("\\grayC","\\textcolor{##e3e5e6}{#1}");C("\\grayD","\\textcolor{##d6d8da}{#1}");C("\\grayE","\\textcolor{##babec2}{#1}");C("\\grayF","\\textcolor{##888d93}{#1}");C("\\grayG","\\textcolor{##626569}{#1}");C("\\grayH","\\textcolor{##3b3e40}{#1}");C("\\grayI","\\textcolor{##21242c}{#1}");C("\\kaBlue","\\textcolor{##314453}{#1}");C("\\kaGreen","\\textcolor{##71B307}{#1}");var xp={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class m6{constructor(t,r,a){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new d6(u6,r.macros),this.mode=a,this.stack=[]}feed(t){this.lexer=new Ld(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,a,s;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:s,end:a}=this.consumeArg(["]"])}else({tokens:s,start:r,end:a}=this.consumeArg());return this.pushToken(new Ir("EOF",a.loc)),this.pushTokens(s),new Ir("",kr.range(r,a))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],a=t&&t.length>0;a||this.consumeSpaces();var s=this.future(),i,o=0,l=0;do{if(i=this.popToken(),r.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new ye("Extra }",i)}else if(i.text==="EOF")throw new ye("Unexpected end of input in a macro argument, expected '"+(t&&a?t[l]:"}")+"'",i);if(t&&a)if((o===0||o===1&&t[l]==="{")&&i.text===t[l]){if(++l,l===t.length){r.splice(-l,l);break}}else l=0}while(o!==0||a);return s.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:s,end:i}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new ye("The length of delimiters doesn't match the number of args!");for(var a=r[0],s=0;s<a.length;s++){var i=this.popToken();if(a[s]!==i.text)throw new ye("Use of the macro doesn't match its definition",i)}}for(var o=[],l=0;l<t;l++)o.push(this.consumeArg(r&&r[l+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new ye("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),a=r.text,s=r.noexpand?null:this._getExpansion(a);if(s==null||t&&s.unexpandable){if(t&&s==null&&a[0]==="\\"&&!this.isDefined(a))throw new ye("Undefined control sequence: "+a);return this.pushToken(r),!1}this.countExpansion(1);var i=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var l=i.length-1;l>=0;--l){var c=i[l];if(c.text==="#"){if(l===0)throw new ye("Incomplete placeholder at end of macro body",c);if(c=i[--l],c.text==="#")i.splice(l+1,1);else if(/^[1-9]$/.test(c.text))i.splice(l,2,...o[+c.text-1]);else throw new ye("Not a valid argument number",c)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Ir(t)]):void 0}expandTokens(t){var r=[],a=this.stack.length;for(this.pushTokens(t);this.stack.length>a;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),r.push(s)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(a=>a.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var a=this.lexer.catcodes[t];if(a!=null&&a!==13)return}var s=typeof r=="function"?r(this):r;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var o=s.replace(/##/g,"");o.indexOf("#"+(i+1))!==-1;)++i;for(var l=new Ld(s,this.settings),c=[],d=l.lex();d.text!=="EOF";)c.push(d),d=l.lex();c.reverse();var u={tokens:c,numArgs:i};return u}return s}isDefined(t){return this.macros.has(t)||$n.hasOwnProperty(t)||Lt.math.hasOwnProperty(t)||Lt.text.hasOwnProperty(t)||xp.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:$n.hasOwnProperty(t)&&!$n[t].primitive}}var Fd=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,ni=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Bo={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Bd={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Gi{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new m6(t,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new ye("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new Ir("}")),this.gullet.pushTokens(t);var a=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,a}parseExpression(t,r){for(var a=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Gi.endOfExpression.indexOf(s.text)!==-1||r&&s.text===r||t&&$n[s.text]&&$n[s.text].infix)break;var i=this.parseAtom(r);if(i){if(i.type==="internal")continue}else break;a.push(i)}return this.mode==="text"&&this.formLigatures(a),this.handleInfixNodes(a)}handleInfixNodes(t){for(var r=-1,a,s=0;s<t.length;s++)if(t[s].type==="infix"){if(r!==-1)throw new ye("only one infix operator per group",t[s].token);r=s,a=t[s].replaceWith}if(r!==-1&&a){var i,o,l=t.slice(0,r),c=t.slice(r+1);l.length===1&&l[0].type==="ordgroup"?i=l[0]:i={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?o=c[0]:o={type:"ordgroup",mode:this.mode,body:c};var d;return a==="\\\\abovefrac"?d=this.callFunction(a,[i,t[r],o],[]):d=this.callFunction(a,[i,o],[]),[d]}else return t}handleSupSubscript(t){var r=this.fetch(),a=r.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(t)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new ye("Expected group after '"+a+"'",r);return s}formatUnsupportedCmd(t){for(var r=[],a=0;a<t.length;a++)r.push({type:"textord",mode:"text",text:t[a]});var s={type:"text",mode:this.mode,body:r},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return i}parseAtom(t){var r=this.parseGroup("atom",t);if(r?.type==="internal"||this.mode==="text")return r;for(var a,s;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(r&&r.type==="op"){var o=i.text==="\\limits";r.limits=o,r.alwaysHandleSupSub=!0}else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=i.text==="\\limits");else throw new ye("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(a)throw new ye("Double superscript",i);a=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new ye("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(a)throw new ye("Double superscript",i);var l={type:"textord",mode:this.mode,text:"\\prime"},c=[l];for(this.consume();this.fetch().text==="'";)c.push(l),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),a={type:"ordgroup",mode:this.mode,body:c}}else if(ni[i.text]){var d=Fd.test(i.text),u=[];for(u.push(new Ir(ni[i.text])),this.consume();;){var m=this.fetch().text;if(!ni[m]||Fd.test(m)!==d)break;u.unshift(new Ir(ni[m])),this.consume()}var h=this.subparse(u);d?s={type:"ordgroup",mode:"math",body:h}:a={type:"ordgroup",mode:"math",body:h}}else break}return a||s?{type:"supsub",mode:this.mode,base:r,sup:a,sub:s}:r}parseFunction(t,r){var a=this.fetch(),s=a.text,i=$n[s];if(!i)return null;if(this.consume(),r&&r!=="atom"&&!i.allowedInArgument)throw new ye("Got function '"+s+"' with no arguments"+(r?" as "+r:""),a);if(this.mode==="text"&&!i.allowedInText)throw new ye("Can't use function '"+s+"' in text mode",a);if(this.mode==="math"&&i.allowedInMath===!1)throw new ye("Can't use function '"+s+"' in math mode",a);var{args:o,optArgs:l}=this.parseArguments(s,i);return this.callFunction(s,o,l,a,t)}callFunction(t,r,a,s,i){var o={funcName:t,parser:this,token:s,breakOnTokenText:i},l=$n[t];if(l&&l.handler)return l.handler(o,r,a);throw new ye("No function handler for "+t)}parseArguments(t,r){var a=r.numArgs+r.numOptionalArgs;if(a===0)return{args:[],optArgs:[]};for(var s=[],i=[],o=0;o<a;o++){var l=r.argTypes&&r.argTypes[o],c=o<r.numOptionalArgs;(r.primitive&&l==null||r.type==="sqrt"&&o===1&&i[0]==null)&&(l="primitive");var d=this.parseGroupOfType("argument to '"+t+"'",l,c);if(c)i.push(d);else if(d!=null)s.push(d);else throw new ye("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(t,r,a){switch(r){case"color":return this.parseColorGroup(a);case"size":return this.parseSizeGroup(a);case"url":return this.parseUrlGroup(a);case"math":case"text":return this.parseArgumentGroup(a,r);case"hbox":{var s=this.parseArgumentGroup(a,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text"}:null}case"raw":{var i=this.parseStringGroup("raw",a);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(a)throw new ye("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new ye("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(a);default:throw new ye("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,r){var a=this.gullet.scanArgument(r);if(a==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),a.text=s,a}parseRegexGroup(t,r){for(var a=this.fetch(),s=a,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)s=o,i+=s.text,this.consume();if(i==="")throw new ye("Invalid "+r+": '"+a.text+"'",a);return a.range(s,i)}parseColorGroup(t){var r=this.parseStringGroup("color",t);if(r==null)return null;var a=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);if(!a)throw new ye("Invalid color: '"+r.text+"'",r);var s=a[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(t){var r,a=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup("size",t),!r)return null;!t&&r.text.length===0&&(r.text="0pt",a=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!s)throw new ye("Invalid size: '"+r.text+"'",r);var i={number:+(s[1]+s[2]),unit:s[3]};if(!Mh(i))throw new ye("Invalid unit: '"+i.unit+"'",r);return{type:"size",mode:this.mode,value:i,isBlank:a}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var r=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;var a=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:a}}parseArgumentGroup(t,r){var a=this.gullet.scanArgument(t);if(a==null)return null;var s=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:a.loc,body:i};return r&&this.switchMode(s),o}parseGroup(t,r){var a=this.fetch(),s=a.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var l=this.parseExpression(!1,o),c=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:kr.range(a,c),body:l,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(r,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!xp.hasOwnProperty(s)){if(this.settings.throwOnError)throw new ye("Undefined control sequence: "+s,a);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(t){for(var r=t.length-1,a=0;a<r;++a){var s=t[a],i=s.text;i==="-"&&t[a+1].text==="-"&&(a+1<r&&t[a+2].text==="-"?(t.splice(a,3,{type:"textord",mode:"text",loc:kr.range(s,t[a+2]),text:"---"}),r-=2):(t.splice(a,2,{type:"textord",mode:"text",loc:kr.range(s,t[a+1]),text:"--"}),r-=1)),(i==="'"||i==="`")&&t[a+1].text===i&&(t.splice(a,2,{type:"textord",mode:"text",loc:kr.range(s,t[a+1]),text:i+i}),r-=1)}}parseSymbol(){var t=this.fetch(),r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var a=r.slice(5),s=a.charAt(0)==="*";if(s&&(a=a.slice(1)),a.length<2||a.charAt(0)!==a.slice(-1))throw new ye(`\\verb assertion failed --
688
+ please report what input caused this bug`);return a=a.slice(1,-1),{type:"verb",mode:"text",body:a,star:s}}Bd.hasOwnProperty(r[0])&&!Lt[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+r[0]+'" used in math mode',t),r=Bd[r[0]]+r.slice(1));var i=l6.exec(r);i&&(r=r.substring(0,i.index),r==="i"?r="ı":r==="j"&&(r="ȷ"));var o;if(Lt[this.mode][r]){this.settings.strict&&this.mode==="math"&&yl.indexOf(r)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var l=Lt[this.mode][r].group,c=kr.range(t),d;if(ek.hasOwnProperty(l)){var u=l;d={type:"atom",mode:this.mode,family:u,loc:c,text:r}}else d={type:l,mode:this.mode,loc:c,text:r};o=d}else if(r.charCodeAt(0)>=128)this.settings.strict&&(Ch(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),o={type:"textord",mode:"text",loc:kr.range(t),text:r};else return null;if(this.consume(),i)for(var m=0;m<i[0].length;m++){var h=i[0][m];if(!Bo[h])throw new ye("Unknown accent ' "+h+"'",t);var p=Bo[h][this.mode]||Bo[h].text;if(!p)throw new ye("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:kr.range(t),label:p,isStretchy:!1,isShifty:!0,base:o}}return o}}Gi.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var P0=function(t,r){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var a=new Gi(t,r);delete a.gullet.macros.current["\\df@tag"];var s=a.parse();if(delete a.gullet.macros.current["\\current@color"],delete a.gullet.macros.current["\\color"],a.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new ye("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:a.subparse([new Ir("\\df@tag")])}]}return s},bp=function(t,r,a){r.textContent="";var s=R0(t,a).toNode();r.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),bp=function(){throw new ye("KaTeX doesn't work in quirks mode.")});var h6=function(t,r){var a=R0(t,r).toMarkup();return a},p6=function(t,r){var a=new x0(r);return P0(t,a)},yp=function(t,r,a){if(a.throwOnError||!(t instanceof ye))throw t;var s=K.makeSpan(["katex-error"],[new Or(r)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+a.errorColor),s},R0=function(t,r){var a=new x0(r);try{var s=P0(t,a);return jk(s,t,a)}catch(i){return yp(i,t,a)}},f6=function(t,r){var a=new x0(r);try{var s=P0(t,a);return Nk(s,t,a)}catch(i){return yp(i,t,a)}},g6="0.16.25",x6={Span:Ds,Anchor:v0,SymbolNode:Or,SvgNode:Nn,PathNode:Wn,LineNode:bl},Od={version:g6,render:bp,renderToString:h6,ParseError:ye,SETTINGS_SCHEMA:ui,__parse:p6,__renderToDomTree:R0,__renderToHTMLTree:f6,__setFontMetrics:V3,__defineSymbol:f,__defineFunction:ze,__defineMacro:C,__domTree:x6};const b6={};function y6(e){const t=this,r=e||b6,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),i=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),o=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(b3(r)),i.push(d3()),o.push(u3(r))}const $d=/[#.]/g;function v6(e,t){const r=e||"",a={};let s=0,i,o;for(;s<r.length;){$d.lastIndex=s;const l=$d.exec(r),c=r.slice(s,l?l.index:r.length);c&&(i?i==="#"?a.id=c:Array.isArray(a.className)?a.className.push(c):a.className=[c]:o=c,s+=c.length),l&&(i=l[0],s++)}return{type:"element",tagName:o||t||"div",properties:a,children:[]}}function vp(e,t,r){const a=r?N6(r):void 0;function s(i,o,...l){let c;if(i==null){c={type:"root",children:[]};const d=o;l.unshift(d)}else{c=v6(i,t);const d=c.tagName.toLowerCase(),u=a?a.get(d):void 0;if(c.tagName=u||d,k6(o))l.unshift(o);else for(const[m,h]of Object.entries(o))w6(e,c.properties,m,h)}for(const d of l)Sl(c.children,d);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return s}function k6(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,r=Object.keys(e);for(const a of r){const s=t[a];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function w6(e,t,r,a){const s=Sm(e,r);let i;if(a!=null){if(typeof a=="number"){if(Number.isNaN(a))return;i=a}else typeof a=="boolean"?i=a:typeof a=="string"?s.spaceSeparated?i=bc(a):s.commaSeparated?i=hc(a):s.commaOrSpaceSeparated?i=bc(hc(a).join(" ")):i=_d(s,s.property,a):Array.isArray(a)?i=[...a]:i=s.property==="style"?j6(a):String(a);if(Array.isArray(i)){const o=[];for(const l of i)o.push(_d(s,s.property,l));i=o}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function Sl(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const r of t)Sl(e,r);else if(typeof t=="object"&&"type"in t)t.type==="root"?Sl(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function _d(e,t,r){if(typeof r=="string"){if(e.number&&r&&!Number.isNaN(Number(r)))return Number(r);if((e.boolean||e.overloadedBoolean)&&(r===""||hs(r)===hs(t)))return!0}return r}function j6(e){const t=[];for(const[r,a]of Object.entries(e))t.push([r,a].join(": "));return t.join("; ")}function N6(e){const t=new Map;for(const r of e)t.set(r.toLowerCase(),r);return t}const S6=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","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","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],C6=vp(Cm,"div"),M6=vp(Ri,"g",S6),Oo={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function A6(e,t){return kp(e,{})||{type:"root",children:[]}}function kp(e,t){const r=T6(e,t);return r&&t.afterTransform&&t.afterTransform(e,r),r}function T6(e,t){switch(e.nodeType){case 1:return z6(e,t);case 3:return I6(e);case 8:return D6(e);case 9:return qd(e,t);case 10:return E6();case 11:return qd(e,t);default:return}}function qd(e,t){return{type:"root",children:wp(e,t)}}function E6(){return{type:"doctype"}}function I6(e){return{type:"text",value:e.nodeValue||""}}function D6(e){return{type:"comment",value:e.nodeValue||""}}function z6(e,t){const r=e.namespaceURI,a=r===Oo.svg?M6:C6,s=r===Oo.html?e.tagName.toLowerCase():e.tagName,i=r===Oo.html&&s==="template"?e.content:e,o=e.getAttributeNames(),l={};let c=-1;for(;++c<o.length;)l[o[c]]=e.getAttribute(o[c])||"";return a(s,l,wp(i,t))}function wp(e,t){const r=e.childNodes,a=[];let s=-1;for(;++s<r.length;){const i=kp(r[s],t);i!==void 0&&a.push(i)}return a}new DOMParser;function L6(e,t){const r=P6(e);return A6(r)}function P6(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const Hd=function(e,t,r){const a=Ts(r);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(a(e.children[t],t,e))return e.children[t]},pa=function(e){if(e==null)return B6;if(typeof e=="string")return F6(e);if(typeof e=="object")return R6(e);if(typeof e=="function")return F0(e);throw new Error("Expected function, string, or array as `test`")};function R6(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=pa(e[r]);return F0(a);function a(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function F6(e){return F0(t);function t(r){return r.tagName===e}}function F0(e){return t;function t(r,a,s){return!!(O6(r)&&e.call(this,r,typeof a=="number"?a:void 0,s||void 0))}}function B6(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function O6(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const Wd=/\n/g,Ud=/[\t ]+/g,Cl=pa("br"),Vd=pa(G6),$6=pa("p"),Gd=pa("tr"),_6=pa(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",V6,K6]),jp=pa(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function q6(e,t){const r=t||{},a="children"in e?e.children:[],s=jp(e),i=Cp(e,{whitespace:r.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...Sp(e,{breakBefore:!0,breakAfter:!0}));let l=-1;for(;++l<a.length;)o.push(...Np(a[l],e,{whitespace:i,breakBefore:l?void 0:s,breakAfter:l<a.length-1?Cl(a[l+1]):s}));const c=[];let d;for(l=-1;++l<o.length;){const u=o[l];typeof u=="number"?d!==void 0&&u>d&&(d=u):u&&(d!==void 0&&d>-1&&c.push(`
689
+ `.repeat(d)||" "),d=-1,c.push(u))}return c.join("")}function Np(e,t,r){return e.type==="element"?H6(e,t,r):e.type==="text"?r.whitespace==="normal"?Sp(e,r):W6(e):[]}function H6(e,t,r){const a=Cp(e,r),s=e.children||[];let i=-1,o=[];if(_6(e))return o;let l,c;for(Cl(e)||Gd(e)&&Hd(t,e,Gd)?c=`
690
+ `:$6(e)?(l=2,c=2):jp(e)&&(l=1,c=1);++i<s.length;)o=o.concat(Np(s[i],e,{whitespace:a,breakBefore:i?void 0:l,breakAfter:i<s.length-1?Cl(s[i+1]):c}));return Vd(e)&&Hd(t,e,Vd)&&o.push(" "),l&&o.unshift(l),c&&o.push(c),o}function Sp(e,t){const r=String(e.value),a=[],s=[];let i=0;for(;i<=r.length;){Wd.lastIndex=i;const c=Wd.exec(r),d=c&&"index"in c?c.index:r.length;a.push(U6(r.slice(i,d).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,d===r.length?t.breakAfter:!0)),i=d+1}let o=-1,l;for(;++o<a.length;)a[o].charCodeAt(a[o].length-1)===8203||o<a.length-1&&a[o+1].charCodeAt(0)===8203?(s.push(a[o]),l=void 0):a[o]?(typeof l=="number"&&s.push(l),s.push(a[o]),l=0):(o===0||o===a.length-1)&&s.push(0);return s}function W6(e){return[String(e.value)]}function U6(e,t,r){const a=[];let s=0,i;for(;s<e.length;){Ud.lastIndex=s;const o=Ud.exec(e);i=o?o.index:e.length,!s&&!i&&o&&!t&&a.push(""),s!==i&&a.push(e.slice(s,i)),s=o?i+o[0].length:i}return s!==i&&!r&&a.push(""),a.join(" ")}function Cp(e,t){if(e.type==="element"){const r=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function V6(e){return!!(e.properties||{}).hidden}function G6(e){return e.tagName==="td"||e.tagName==="th"}function K6(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const J6={},Y6=[];function X6(e){const t=e||J6;return function(r,a){u0(r,"element",function(s,i){const o=Array.isArray(s.properties.className)?s.properties.className:Y6,l=o.includes("language-math"),c=o.includes("math-display"),d=o.includes("math-inline");let u=c;if(!l&&!c&&!d)return;let m=i[i.length-1],h=s;if(s.tagName==="code"&&l&&m&&m.type==="element"&&m.tagName==="pre"&&(h=m,m=i[i.length-2],u=!0),!m)return;const p=q6(h,{whitespace:"pre"});let g;try{g=Od.renderToString(p,{...t,displayMode:u,throwOnError:!0})}catch(v){const w=v,S=w.name.toLowerCase();a.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:w,place:s.position,ruleId:S,source:"rehype-katex"});try{g=Od.renderToString(p,{...t,displayMode:u,strict:"ignore",throwOnError:!1})}catch{g=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(v)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=L6(g).children);const y=m.children.indexOf(h);return m.children.splice(y,1,...g),Zm})}}var $o={exports:{}},_o,Kd;function Q6(){if(Kd)return _o;Kd=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _o=e,_o}var qo,Jd;function Z6(){if(Jd)return qo;Jd=1;var e=Q6();function t(){}function r(){}return r.resetWarningCache=t,qo=function(){function a(o,l,c,d,u,m){if(m!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}a.isRequired=a;function s(){return a}var i={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:s,element:a,elementType:a,instanceOf:s,node:a,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:r,resetWarningCache:t};return i.PropTypes=i,i},qo}var Yd;function ew(){return Yd||(Yd=1,$o.exports=Z6()()),$o.exports}var tw=ew();const Tt=vs(tw);function fa(e,t,r,a){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(u){try{d(a.next(u))}catch(m){o(m)}}function c(u){try{d(a.throw(u))}catch(m){o(m)}}function d(u){u.done?i(u.value):s(u.value).then(l,c)}d((a=a.apply(e,t||[])).next())})}const rw=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function La(e,t,r){const a=nw(e),{webkitRelativePath:s}=e,i=typeof t=="string"?t:typeof s=="string"&&s.length>0?s:`./${e.name}`;return typeof a.path!="string"&&Xd(a,"path",i),Xd(a,"relativePath",i),a}function nw(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const a=t.split(".").pop().toLowerCase(),s=rw.get(a);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}function Xd(e,t,r){Object.defineProperty(e,t,{value:r,writable:!1,configurable:!1,enumerable:!0})}const aw=[".DS_Store","Thumbs.db"];function sw(e){return fa(this,void 0,void 0,function*(){return Mi(e)&&iw(e.dataTransfer)?dw(e.dataTransfer,e.type):ow(e)?lw(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?cw(e):[]})}function iw(e){return Mi(e)}function ow(e){return Mi(e)&&Mi(e.target)}function Mi(e){return typeof e=="object"&&e!==null}function lw(e){return Ml(e.target.files).map(t=>La(t))}function cw(e){return fa(this,void 0,void 0,function*(){return(yield Promise.all(e.map(r=>r.getFile()))).map(r=>La(r))})}function dw(e,t){return fa(this,void 0,void 0,function*(){if(e.items){const r=Ml(e.items).filter(s=>s.kind==="file");if(t!=="drop")return r;const a=yield Promise.all(r.map(uw));return Qd(Mp(a))}return Qd(Ml(e.files).map(r=>La(r)))})}function Qd(e){return e.filter(t=>aw.indexOf(t.name)===-1)}function Ml(e){if(e===null)return[];const t=[];for(let r=0;r<e.length;r++){const a=e[r];t.push(a)}return t}function uw(e){if(typeof e.webkitGetAsEntry!="function")return Zd(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?Ap(t):Zd(e,t)}function Mp(e){return e.reduce((t,r)=>[...t,...Array.isArray(r)?Mp(r):[r]],[])}function Zd(e,t){return fa(this,void 0,void 0,function*(){var r;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const i=yield e.getAsFileSystemHandle();if(i===null)throw new Error(`${e} is not a File`);if(i!==void 0){const o=yield i.getFile();return o.handle=i,La(o)}}const a=e.getAsFile();if(!a)throw new Error(`${e} is not a File`);return La(a,(r=t?.fullPath)!==null&&r!==void 0?r:void 0)})}function mw(e){return fa(this,void 0,void 0,function*(){return e.isDirectory?Ap(e):hw(e)})}function Ap(e){const t=e.createReader();return new Promise((r,a)=>{const s=[];function i(){t.readEntries(o=>fa(this,void 0,void 0,function*(){if(o.length){const l=Promise.all(o.map(mw));s.push(l),i()}else try{const l=yield Promise.all(s);r(l)}catch(l){a(l)}}),o=>{a(o)})}i()})}function hw(e){return fa(this,void 0,void 0,function*(){return new Promise((t,r)=>{e.file(a=>{const s=La(a,e.fullPath);t(s)},a=>{r(a)})})})}var ai={},eu;function pw(){return eu||(eu=1,ai.__esModule=!0,ai.default=function(e,t){if(e&&t){var r=Array.isArray(t)?t:t.split(",");if(r.length===0)return!0;var a=e.name||"",s=(e.type||"").toLowerCase(),i=s.replace(/\/.*$/,"");return r.some(function(o){var l=o.trim().toLowerCase();return l.charAt(0)==="."?a.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):s===l})}return!0}),ai}var fw=pw();const Ho=vs(fw);function tu(e){return bw(e)||xw(e)||Ep(e)||gw()}function gw(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
691
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xw(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bw(e){if(Array.isArray(e))return Al(e)}function ru(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,a)}return r}function nu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ru(Object(r),!0).forEach(function(a){Tp(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ru(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function Tp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bs(e,t){return kw(e)||vw(e,t)||Ep(e,t)||yw()}function yw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
692
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ep(e,t){if(e){if(typeof e=="string")return Al(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Al(e,t)}}function Al(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function vw(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var a=[],s=!0,i=!1,o,l;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(a.push(o.value),!(t&&a.length===t));s=!0);}catch(c){i=!0,l=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw l}}return a}}function kw(e){if(Array.isArray(e))return e}var ww=typeof Ho=="function"?Ho:Ho.default,jw="file-invalid-type",Nw="file-too-large",Sw="file-too-small",Cw="too-many-files",Mw=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=t.split(","),a=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:jw,message:"File type must be ".concat(a)}},au=function(t){return{code:Nw,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},su=function(t){return{code:Sw,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},Aw={code:Cw,message:"Too many files"};function Ip(e,t){var r=e.type==="application/x-moz-file"||ww(e,t);return[r,r?null:Mw(t)]}function Dp(e,t,r){if(aa(e.size))if(aa(t)&&aa(r)){if(e.size>r)return[!1,au(r)];if(e.size<t)return[!1,su(t)]}else{if(aa(t)&&e.size<t)return[!1,su(t)];if(aa(r)&&e.size>r)return[!1,au(r)]}return[!0,null]}function aa(e){return e!=null}function Tw(e){var t=e.files,r=e.accept,a=e.minSize,s=e.maxSize,i=e.multiple,o=e.maxFiles,l=e.validator;return!i&&t.length>1||i&&o>=1&&t.length>o?!1:t.every(function(c){var d=Ip(c,r),u=bs(d,1),m=u[0],h=Dp(c,a,s),p=bs(h,1),g=p[0],y=l?l(c):null;return m&&g&&!y})}function Ai(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function si(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function iu(e){e.preventDefault()}function Ew(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Iw(e){return e.indexOf("Edge/")!==-1}function Dw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Ew(e)||Iw(e)}function en(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(a){for(var s=arguments.length,i=new Array(s>1?s-1:0),o=1;o<s;o++)i[o-1]=arguments[o];return t.some(function(l){return!Ai(a)&&l&&l.apply(void 0,[a].concat(i)),Ai(a)})}}function zw(){return"showOpenFilePicker"in window}function Lw(e){if(aa(e)){var t=Object.entries(e).filter(function(r){var a=bs(r,2),s=a[0],i=a[1],o=!0;return zp(s)||(console.warn('Skipped "'.concat(s,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),o=!1),(!Array.isArray(i)||!i.every(Lp))&&(console.warn('Skipped "'.concat(s,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(r,a){var s=bs(a,2),i=s[0],o=s[1];return nu(nu({},r),{},Tp({},i,o))},{});return[{description:"Files",accept:t}]}return e}function Pw(e){if(aa(e))return Object.entries(e).reduce(function(t,r){var a=bs(r,2),s=a[0],i=a[1];return[].concat(tu(t),[s],tu(i))},[]).filter(function(t){return zp(t)||Lp(t)}).join(",")}function Rw(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Fw(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function zp(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function Lp(e){return/^.*\.[\w]+$/.test(e)}var Bw=["children"],Ow=["open"],$w=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],_w=["refKey","onChange","onClick"];function qw(e){return Uw(e)||Ww(e)||Pp(e)||Hw()}function Hw(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
693
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ww(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Uw(e){if(Array.isArray(e))return Tl(e)}function Wo(e,t){return Kw(e)||Gw(e,t)||Pp(e,t)||Vw()}function Vw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
694
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pp(e,t){if(e){if(typeof e=="string")return Tl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tl(e,t)}}function Tl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function Gw(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var a=[],s=!0,i=!1,o,l;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(a.push(o.value),!(t&&a.length===t));s=!0);}catch(c){i=!0,l=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw l}}return a}}function Kw(e){if(Array.isArray(e))return e}function ou(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,a)}return r}function $t(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(r),!0).forEach(function(a){El(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ou(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function El(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ti(e,t){if(e==null)return{};var r=Jw(e,t),a,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)a=i[s],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Jw(e,t){if(e==null)return{};var r={},a=Object.keys(e),s,i;for(i=0;i<a.length;i++)s=a[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var B0=b.forwardRef(function(e,t){var r=e.children,a=Ti(e,Bw),s=Fp(a),i=s.open,o=Ti(s,Ow);return b.useImperativeHandle(t,function(){return{open:i}},[i]),Kr.createElement(b.Fragment,null,r($t($t({},o),{},{open:i})))});B0.displayName="Dropzone";var Rp={disabled:!1,getFilesFromEvent:sw,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};B0.defaultProps=Rp;B0.propTypes={children:Tt.func,accept:Tt.objectOf(Tt.arrayOf(Tt.string)),multiple:Tt.bool,preventDropOnDocument:Tt.bool,noClick:Tt.bool,noKeyboard:Tt.bool,noDrag:Tt.bool,noDragEventsBubbling:Tt.bool,minSize:Tt.number,maxSize:Tt.number,maxFiles:Tt.number,disabled:Tt.bool,getFilesFromEvent:Tt.func,onFileDialogCancel:Tt.func,onFileDialogOpen:Tt.func,useFsAccessApi:Tt.bool,autoFocus:Tt.bool,onDragEnter:Tt.func,onDragLeave:Tt.func,onDragOver:Tt.func,onDrop:Tt.func,onDropAccepted:Tt.func,onDropRejected:Tt.func,onError:Tt.func,validator:Tt.func};var Il={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Fp(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=$t($t({},Rp),e),r=t.accept,a=t.disabled,s=t.getFilesFromEvent,i=t.maxSize,o=t.minSize,l=t.multiple,c=t.maxFiles,d=t.onDragEnter,u=t.onDragLeave,m=t.onDragOver,h=t.onDrop,p=t.onDropAccepted,g=t.onDropRejected,y=t.onFileDialogCancel,v=t.onFileDialogOpen,w=t.useFsAccessApi,S=t.autoFocus,N=t.preventDropOnDocument,I=t.noClick,F=t.noKeyboard,E=t.noDrag,R=t.noDragEventsBubbling,H=t.onError,$=t.validator,A=b.useMemo(function(){return Pw(r)},[r]),V=b.useMemo(function(){return Lw(r)},[r]),T=b.useMemo(function(){return typeof v=="function"?v:lu},[v]),U=b.useMemo(function(){return typeof y=="function"?y:lu},[y]),P=b.useRef(null),_=b.useRef(null),se=b.useReducer(Yw,Il),de=Wo(se,2),J=de[0],X=de[1],j=J.isFocused,ne=J.isFileDialogActive,ue=b.useRef(typeof window<"u"&&window.isSecureContext&&w&&zw()),M=function(){!ue.current&&ne&&setTimeout(function(){if(_.current){var Ae=_.current.files;Ae.length||(X({type:"closeDialog"}),U())}},300)};b.useEffect(function(){return window.addEventListener("focus",M,!1),function(){window.removeEventListener("focus",M,!1)}},[_,ne,U,ue]);var ie=b.useRef([]),Me=function(Ae){P.current&&P.current.contains(Ae.target)||(Ae.preventDefault(),ie.current=[])};b.useEffect(function(){return N&&(document.addEventListener("dragover",iu,!1),document.addEventListener("drop",Me,!1)),function(){N&&(document.removeEventListener("dragover",iu),document.removeEventListener("drop",Me))}},[P,N]),b.useEffect(function(){return!a&&S&&P.current&&P.current.focus(),function(){}},[P,S,a]);var Se=b.useCallback(function(we){H?H(we):console.error(we)},[H]),me=b.useCallback(function(we){we.preventDefault(),we.persist(),bt(we),ie.current=[].concat(qw(ie.current),[we.target]),si(we)&&Promise.resolve(s(we)).then(function(Ae){if(!(Ai(we)&&!R)){var q=Ae.length,G=q>0&&Tw({files:Ae,accept:A,minSize:o,maxSize:i,multiple:l,maxFiles:c,validator:$}),be=q>0&&!G;X({isDragAccept:G,isDragReject:be,isDragActive:!0,type:"setDraggedFiles"}),d&&d(we)}}).catch(function(Ae){return Se(Ae)})},[s,d,Se,R,A,o,i,l,c,$]),_e=b.useCallback(function(we){we.preventDefault(),we.persist(),bt(we);var Ae=si(we);if(Ae&&we.dataTransfer)try{we.dataTransfer.dropEffect="copy"}catch{}return Ae&&m&&m(we),!1},[m,R]),ce=b.useCallback(function(we){we.preventDefault(),we.persist(),bt(we);var Ae=ie.current.filter(function(G){return P.current&&P.current.contains(G)}),q=Ae.indexOf(we.target);q!==-1&&Ae.splice(q,1),ie.current=Ae,!(Ae.length>0)&&(X({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),si(we)&&u&&u(we))},[P,u,R]),ve=b.useCallback(function(we,Ae){var q=[],G=[];we.forEach(function(be){var Pe=Ip(be,A),st=Wo(Pe,2),he=st[0],B=st[1],ee=Dp(be,o,i),ge=Wo(ee,2),Ne=ge[0],Z=ge[1],Ce=$?$(be):null;if(he&&Ne&&!Ce)q.push(be);else{var Ze=[B,Z];Ce&&(Ze=Ze.concat(Ce)),G.push({file:be,errors:Ze.filter(function(Ct){return Ct})})}}),(!l&&q.length>1||l&&c>=1&&q.length>c)&&(q.forEach(function(be){G.push({file:be,errors:[Aw]})}),q.splice(0)),X({acceptedFiles:q,fileRejections:G,isDragReject:G.length>0,type:"setFiles"}),h&&h(q,G,Ae),G.length>0&&g&&g(G,Ae),q.length>0&&p&&p(q,Ae)},[X,l,A,o,i,c,h,p,g,$]),He=b.useCallback(function(we){we.preventDefault(),we.persist(),bt(we),ie.current=[],si(we)&&Promise.resolve(s(we)).then(function(Ae){Ai(we)&&!R||ve(Ae,we)}).catch(function(Ae){return Se(Ae)}),X({type:"reset"})},[s,ve,Se,R]),Le=b.useCallback(function(){if(ue.current){X({type:"openDialog"}),T();var we={multiple:l,types:V};window.showOpenFilePicker(we).then(function(Ae){return s(Ae)}).then(function(Ae){ve(Ae,null),X({type:"closeDialog"})}).catch(function(Ae){Rw(Ae)?(U(Ae),X({type:"closeDialog"})):Fw(Ae)?(ue.current=!1,_.current?(_.current.value=null,_.current.click()):Se(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Se(Ae)});return}_.current&&(X({type:"openDialog"}),T(),_.current.value=null,_.current.click())},[X,T,U,w,ve,Se,V,l]),rt=b.useCallback(function(we){!P.current||!P.current.isEqualNode(we.target)||(we.key===" "||we.key==="Enter"||we.keyCode===32||we.keyCode===13)&&(we.preventDefault(),Le())},[P,Le]),Ye=b.useCallback(function(){X({type:"focus"})},[]),yt=b.useCallback(function(){X({type:"blur"})},[]),mt=b.useCallback(function(){I||(Dw()?setTimeout(Le,0):Le())},[I,Le]),vt=function(Ae){return a?null:Ae},ft=function(Ae){return F?null:vt(Ae)},Ue=function(Ae){return E?null:vt(Ae)},bt=function(Ae){R&&Ae.stopPropagation()},kt=b.useMemo(function(){return function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ae=we.refKey,q=Ae===void 0?"ref":Ae,G=we.role,be=we.onKeyDown,Pe=we.onFocus,st=we.onBlur,he=we.onClick,B=we.onDragEnter,ee=we.onDragOver,ge=we.onDragLeave,Ne=we.onDrop,Z=Ti(we,$w);return $t($t(El({onKeyDown:ft(en(be,rt)),onFocus:ft(en(Pe,Ye)),onBlur:ft(en(st,yt)),onClick:vt(en(he,mt)),onDragEnter:Ue(en(B,me)),onDragOver:Ue(en(ee,_e)),onDragLeave:Ue(en(ge,ce)),onDrop:Ue(en(Ne,He)),role:typeof G=="string"&&G!==""?G:"presentation"},q,P),!a&&!F?{tabIndex:0}:{}),Z)}},[P,rt,Ye,yt,mt,me,_e,ce,He,F,E,a]),Vt=b.useCallback(function(we){we.stopPropagation()},[]),Ve=b.useMemo(function(){return function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ae=we.refKey,q=Ae===void 0?"ref":Ae,G=we.onChange,be=we.onClick,Pe=Ti(we,_w),st=El({accept:A,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:vt(en(G,He)),onClick:vt(en(be,Vt)),tabIndex:-1},q,_);return $t($t({},st),Pe)}},[_,r,l,He,a]);return $t($t({},J),{},{isFocused:j&&!a,getRootProps:kt,getInputProps:Ve,rootRef:P,inputRef:_,open:vt(Le)})}function Yw(e,t){switch(t.type){case"focus":return $t($t({},e),{},{isFocused:!0});case"blur":return $t($t({},e),{},{isFocused:!1});case"openDialog":return $t($t({},Il),{},{isFileDialogActive:!0});case"closeDialog":return $t($t({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return $t($t({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return $t($t({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"reset":return $t({},Il);default:return e}}function lu(){}const Uo=({todos:e,isResult:t=!1})=>{if(!e||!Array.isArray(e))return null;const r=i=>{switch(i){case"completed":return n.jsx(Cg,{className:"w-4 h-4 text-green-500 dark:text-green-400"});case"in_progress":return n.jsx(cs,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"});case"pending":default:return n.jsx(Ca,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"})}},a=i=>{switch(i){case"completed":return"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 border-green-200 dark:border-green-800";case"in_progress":return"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-200 border-blue-200 dark:border-blue-800";case"pending":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}},s=i=>{switch(i){case"high":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 border-red-200 dark:border-red-800";case"medium":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800";case"low":default:return"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}};return n.jsxs("div",{className:"space-y-3",children:[t&&n.jsxs("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:["Todo List (",e.length," ",e.length===1?"item":"items",")"]}),e.map((i,o)=>n.jsxs("div",{className:"flex items-start gap-3 p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md dark:shadow-gray-900/50 transition-shadow",children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r(i.status)}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[n.jsx("p",{className:`text-sm font-medium ${i.status==="completed"?"line-through text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:i.content}),n.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[n.jsx(Jr,{variant:"outline",className:`text-xs px-2 py-0.5 ${s(i.priority)}`,children:i.priority}),n.jsx(Jr,{variant:"outline",className:`text-xs px-2 py-0.5 ${a(i.status)}`,children:i.status.replace("_"," ")})]})]})})]},i.id||`todo-${o}`))]})};var Xw=Zf(),Qw=eg(),Zw=tg(),Vo={exports:{}},cu;function e7(){return cu||(cu=1,function(e,t){(function(r,a){e.exports=a()})(self,()=>(()=>{var r={6:(o,l)=>{function c(u){try{const m=new URL(u),h=m.password&&m.username?`${m.protocol}//${m.username}:${m.password}@${m.host}`:m.username?`${m.protocol}//${m.username}@${m.host}`:`${m.protocol}//${m.host}`;return u.toLocaleLowerCase().startsWith(h.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(u,m,h,p={}){this._terminal=u,this._regex=m,this._handler=h,this._options=p}provideLinks(u,m){const h=d.computeLink(u,this._regex,this._terminal,this._handler);m(this._addCallbacks(h))}_addCallbacks(u){return u.map(m=>(m.leave=this._options.leave,m.hover=(h,p)=>{if(this._options.hover){const{range:g}=m;this._options.hover(h,p,g)}},m))}};class d{static computeLink(m,h,p,g){const y=new RegExp(h.source,(h.flags||"")+"g"),[v,w]=d._getWindowedLineStrings(m-1,p),S=v.join("");let N;const I=[];for(;N=y.exec(S);){const F=N[0];if(!c(F))continue;const[E,R]=d._mapStrIdx(p,w,0,N.index),[H,$]=d._mapStrIdx(p,E,R,F.length);if(E===-1||R===-1||H===-1||$===-1)continue;const A={start:{x:R+1,y:E+1},end:{x:$,y:H+1}};I.push({range:A,text:F,activate:g})}return I}static _getWindowedLineStrings(m,h){let p,g=m,y=m,v=0,w="";const S=[];if(p=h.buffer.active.getLine(m)){const N=p.translateToString(!0);if(p.isWrapped&&N[0]!==" "){for(v=0;(p=h.buffer.active.getLine(--g))&&v<2048&&(w=p.translateToString(!0),v+=w.length,S.push(w),p.isWrapped&&w.indexOf(" ")===-1););S.reverse()}for(S.push(N),v=0;(p=h.buffer.active.getLine(++y))&&p.isWrapped&&v<2048&&(w=p.translateToString(!0),v+=w.length,S.push(w),w.indexOf(" ")===-1););}return[S,g]}static _mapStrIdx(m,h,p,g){const y=m.buffer.active,v=y.getNullCell();let w=p;for(;g;){const S=y.getLine(h);if(!S)return[-1,-1];for(let N=w;N<S.length;++N){S.getCell(N,v);const I=v.getChars();if(v.getWidth()&&(g-=I.length||1,N===S.length-1&&I==="")){const F=y.getLine(h+1);F&&F.isWrapped&&(F.getCell(0,v),v.getWidth()===2&&(g+=1))}if(g<0)return[h,N]}h++,w=0}return[h,w]}}l.LinkComputer=d}},a={};function s(o){var l=a[o];if(l!==void 0)return l.exports;var c=a[o]={exports:{}};return r[o](c,c.exports,s),c.exports}var i={};return(()=>{var o=i;Object.defineProperty(o,"__esModule",{value:!0}),o.WebLinksAddon=void 0;const l=s(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function d(u,m){const h=window.open();if(h){try{h.opener=null}catch{}h.location.href=m}else console.warn("Opening link blocked as opener could not be cleared")}o.WebLinksAddon=class{constructor(u=d,m={}){this._handler=u,this._options=m}activate(u){this._terminal=u;const m=this._options,h=m.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,h,this._handler,m))}dispose(){this._linkProvider?.dispose()}}})(),i})())}(Vo)),Vo.exports}var t7=e7();const r7=`
695
+ .xterm .xterm-screen {
696
+ outline: none !important;
697
+ }
698
+ .xterm:focus .xterm-screen {
699
+ outline: none !important;
700
+ }
701
+ .xterm-screen:focus {
702
+ outline: none !important;
703
+ }
704
+ `;if(typeof document<"u"){const e=document.createElement("style");e.type="text/css",e.innerText=r7,document.head.appendChild(e)}function O0({selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:a=!1,onProcessComplete:s,minimal:i=!1,autoConnect:o=!1}){const l=b.useRef(null),c=b.useRef(null),d=b.useRef(null),u=b.useRef(null),[m,h]=b.useState(!1),[p,g]=b.useState(!1),[y,v]=b.useState(!1),[w,S]=b.useState(null),[N,I]=b.useState(!1),F=b.useRef(e),E=b.useRef(t),R=b.useRef(r),H=b.useRef(a),$=b.useRef(s);b.useEffect(()=>{F.current=e,E.current=t,R.current=r,H.current=a,$.current=s});const A=b.useCallback(async()=>{if(!(N||m))try{let J;{const X=localStorage.getItem("auth-token");if(!X){console.error("No authentication token found for Shell WebSocket connection");return}J=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/shell?token=${encodeURIComponent(X)}`}u.current=new WebSocket(J),u.current.onopen=()=>{h(!0),I(!1),setTimeout(()=>{d.current&&c.current&&(d.current.fit(),u.current.send(JSON.stringify({type:"init",projectPath:F.current.fullPath||F.current.path,sessionId:H.current?null:E.current?.id,hasSession:H.current?!1:!!E.current,provider:H.current?"plain-shell":E.current?.__provider||"claude",cols:c.current.cols,rows:c.current.rows,initialCommand:R.current,isPlainShell:H.current})))},100)},u.current.onmessage=X=>{try{const j=JSON.parse(X.data);if(j.type==="output"){let ne=j.data;if(H.current&&$.current){const ue=ne.replace(/\x1b\[[0-9;]*m/g,"");if(ue.includes("Process exited with code 0"))$.current(0);else if(ue.match(/Process exited with code (\d+)/)){const M=parseInt(ue.match(/Process exited with code (\d+)/)[1]);M!==0&&$.current(M)}}c.current&&c.current.write(ne)}else j.type==="url_open"&&window.open(j.url,"_blank")}catch(j){console.error("[Shell] Error handling WebSocket message:",j,X.data)}},u.current.onclose=X=>{h(!1),I(!1),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H"))},u.current.onerror=X=>{h(!1),I(!1)}}catch{h(!1),I(!1)}},[N,m]),V=b.useCallback(()=>{!p||m||N||(I(!0),A())},[p,m,N,A]),T=b.useCallback(()=>{u.current&&(u.current.close(),u.current=null),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H")),h(!1),I(!1)},[]),U=b.useMemo(()=>t?t.__provider==="cursor"?t.name||"Untitled Session":t.summary||"New Session":null,[t]),P=b.useMemo(()=>U?U.slice(0,30):null,[U]),_=b.useMemo(()=>U?U.slice(0,50):null,[U]),se=()=>{v(!0),u.current&&(u.current.close(),u.current=null),c.current&&(c.current.dispose(),c.current=null,d.current=null),h(!1),g(!1),setTimeout(()=>{v(!1)},200)};return b.useEffect(()=>{const de=t?.id||null;w!==null&&w!==de&&p&&T(),S(de)},[t?.id,p,T]),b.useEffect(()=>{if(!l.current||!e||y||c.current)return;c.current=new Xw.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),d.current=new Qw.FitAddon;const de=new Zw.WebglAddon,J=new t7.WebLinksAddon;c.current.loadAddon(d.current),c.current.loadAddon(J);try{c.current.loadAddon(de)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}c.current.open(l.current),c.current.attachCustomKeyEventHandler(j=>(j.ctrlKey||j.metaKey)&&j.key==="c"&&c.current.hasSelection()?(document.execCommand("copy"),!1):(j.ctrlKey||j.metaKey)&&j.key==="v"?(navigator.clipboard.readText().then(ne=>{u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"input",data:ne}))}).catch(()=>{}),!1):!0),setTimeout(()=>{d.current&&(d.current.fit(),c.current&&u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows})))},100),g(!0),c.current.onData(j=>{u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"input",data:j}))});const X=new ResizeObserver(()=>{d.current&&c.current&&setTimeout(()=>{d.current.fit(),u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows}))},50)});return l.current&&X.observe(l.current),()=>{X.disconnect(),u.current&&(u.current.readyState===WebSocket.OPEN||u.current.readyState===WebSocket.CONNECTING)&&u.current.close(),u.current=null,c.current&&(c.current.dispose(),c.current=null)}},[e?.path||e?.fullPath,y]),b.useEffect(()=>{!o||!p||N||m||V()},[o,p,N,m,V]),e?i?n.jsx("div",{className:"h-full w-full bg-gray-900",children:n.jsx("div",{ref:l,className:"h-full w-full focus:outline-none",style:{outline:"none"}})}):n.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[n.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${m?"bg-green-500":"bg-red-500"}`}),t&&n.jsxs("span",{className:"text-xs text-blue-300",children:["(",P,"...)"]}),!t&&n.jsx("span",{className:"text-xs text-gray-400",children:"(New Session)"}),!p&&n.jsx("span",{className:"text-xs text-yellow-400",children:"(Initializing...)"}),y&&n.jsx("span",{className:"text-xs text-blue-400",children:"(Restarting...)"})]}),n.jsxs("div",{className:"flex items-center space-x-3",children:[m&&n.jsxs("button",{onClick:T,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"Disconnect from shell",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),n.jsx("span",{children:"Disconnect"})]}),n.jsxs("button",{onClick:se,disabled:y||m,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"Restart Shell (disconnect first)",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),n.jsx("span",{children:"Restart"})]})]})]})}),n.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[n.jsx("div",{ref:l,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!p&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:n.jsx("div",{className:"text-white",children:"Loading terminal..."})}),p&&!m&&!N&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:n.jsxs("div",{className:"text-center max-w-sm w-full",children:[n.jsxs("button",{onClick:V,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:"Connect to shell",children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),n.jsx("span",{children:"Continue in Shell"})]}),n.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Run ${r||"command"} in ${e.displayName}`:t?`Resume session: ${_}...`:"Start a new Claude session"})]})}),N&&n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:n.jsxs("div",{className:"text-center max-w-sm w-full",children:[n.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[n.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),n.jsx("span",{className:"text-base font-medium",children:"Connecting to shell..."})]}),n.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:a?`Running ${r||"command"} in ${e.displayName}`:`Starting Claude CLI in ${e.displayName}`})]})})]})]}):n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[n.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:n.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),n.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Select a Project"}),n.jsx("p",{children:"Choose a project to open an interactive shell in that directory"})]})})}const Bp=({task:e,onClose:t,onEdit:r,onStatusChange:a,onTaskClick:s,isOpen:i=!0,className:o=""})=>{const[l,c]=b.useState(!1),[d,u]=b.useState(e||{}),[m,h]=b.useState(!1),[p,g]=b.useState(!1),[y,v]=b.useState(!1),{currentProject:w,refreshTasks:S}=Ss();if(!i||!e)return null;const N=async()=>{if(w){h(!0);try{const A={};if(d.title!==e.title&&(A.title=d.title),d.description!==e.description&&(A.description=d.description),d.details!==e.details&&(A.details=d.details),Object.keys(A).length>0){const V=await lt.taskmaster.updateTask(w.name,e.id,A);if(V.ok)S?.(),r?.(d),c(!1);else{const T=await V.json();console.error("Failed to update task:",T),alert(`Failed to update task: ${T.message}`)}}else c(!1)}catch(A){console.error("Error updating task:",A),alert("Error updating task. Please try again.")}finally{h(!1)}}},I=()=>{navigator.clipboard.writeText(e.id.toString())},F=A=>{switch(A){case"done":return{icon:ks,color:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-950"};case"in-progress":return{icon:cs,color:"text-blue-600 dark:text-blue-400",bg:"bg-blue-50 dark:bg-blue-950"};case"review":return{icon:Li,color:"text-amber-600 dark:text-amber-400",bg:"bg-amber-50 dark:bg-amber-950"};case"deferred":return{icon:Xu,color:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800"};case"cancelled":return{icon:Mt,color:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-950"};default:return{icon:Ca,color:"text-slate-500 dark:text-slate-400",bg:"bg-slate-50 dark:bg-slate-800"}}},E=F(e.status),R=E.icon,H=A=>{switch(A){case"high":return"text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-950";case"medium":return"text-yellow-600 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-950";case"low":return"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-950";default:return"text-gray-600 dark:text-gray-400 bg-gray-50 dark:bg-gray-800"}},$=[{value:"pending",label:"Pending"},{value:"in-progress",label:"In Progress"},{value:"review",label:"Review"},{value:"done",label:"Done"},{value:"deferred",label:"Deferred"},{value:"cancelled",label:"Cancelled"}];return n.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[100] md:p-4 bg-black/50",children:n.jsxs("div",{className:Ke("bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 md:rounded-lg shadow-xl","w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",o),children:[n.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[n.jsx(R,{className:Ke("w-6 h-6",E.color)}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsxs("button",{onClick:I,className:"flex items-center gap-1 px-2 py-1 text-xs bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",title:"Click to copy task ID",children:[n.jsxs("span",{children:["Task ",e.id]}),n.jsx(Gu,{className:"w-3 h-3"})]}),e.parentId&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Subtask of Task ",e.parentId]})]}),l?n.jsx("input",{type:"text",value:d.title||"",onChange:A=>u({...d,title:A.target.value}),className:"w-full text-lg font-semibold bg-transparent border-b-2 border-blue-500 focus:outline-none text-gray-900 dark:text-white",placeholder:"Task title"}):n.jsx("h1",{className:"text-lg md:text-xl font-semibold text-gray-900 dark:text-white line-clamp-2",children:e.title})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l?n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:N,disabled:m,className:"p-2 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:m?"Saving...":"Save changes",children:n.jsx(xi,{className:Ke("w-5 h-5",m&&"animate-spin")})}),n.jsx("button",{onClick:()=>{c(!1),u(e)},disabled:m,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Cancel editing",children:n.jsx(Mt,{className:"w-5 h-5"})})]}):n.jsx("button",{onClick:()=>c(!0),className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Edit task",children:n.jsx(Ox,{className:"w-5 h-5"})}),n.jsx("button",{onClick:t,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors",title:"Close",children:n.jsx(Mt,{className:"w-5 h-5"})})]})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-6 space-y-6 min-h-0",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Status"}),n.jsx("div",{className:Ke("w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600",E.bg,E.color),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(R,{className:"w-4 h-4"}),n.jsx("span",{className:"font-medium capitalize",children:$.find(A=>A.value===e.status)?.label||e.status})]})})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Priority"}),n.jsxs("div",{className:Ke("px-3 py-2 rounded-md text-sm font-medium capitalize",H(e.priority)),children:[n.jsx(Ku,{className:"w-4 h-4 inline mr-2"}),e.priority||"Not set"]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Dependencies"}),e.dependencies&&e.dependencies.length>0?n.jsx("div",{className:"flex flex-wrap gap-1",children:e.dependencies.map(A=>n.jsxs("button",{onClick:()=>s&&s({id:A}),className:"px-2 py-1 bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded text-sm hover:bg-blue-200 dark:hover:bg-blue-800 transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50",disabled:!s,title:s?`Click to view Task ${A}`:`Task ${A}`,children:[n.jsx(Vl,{className:"w-3 h-3 inline mr-1"}),A]},A))}):n.jsx("span",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No dependencies"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Description"}),l?n.jsx("textarea",{value:d.description||"",onChange:A=>u({...d,description:A.target.value}),rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Task description"}):n.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.description||"No description provided"})]}),e.details&&n.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[n.jsxs("button",{onClick:()=>g(!p),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Implementation Details"}),p?n.jsx(Pr,{className:"w-4 h-4 text-gray-500"}):n.jsx(cn,{className:"w-4 h-4 text-gray-500"})]}),p&&n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:l?n.jsx("textarea",{value:d.details||"",onChange:A=>u({...d,details:A.target.value}),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-white",placeholder:"Implementation details"}):n.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-4",children:n.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.details})})})]}),e.testStrategy&&n.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[n.jsxs("button",{onClick:()=>v(!y),className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Test Strategy"}),y?n.jsx(Pr,{className:"w-4 h-4 text-gray-500"}):n.jsx(cn,{className:"w-4 h-4 text-gray-500"})]}),y&&n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:n.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 rounded-md p-4",children:n.jsx("p",{className:"text-gray-700 dark:text-gray-300 whitespace-pre-wrap",children:e.testStrategy})})})]}),e.subtasks&&e.subtasks.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Subtasks (",e.subtasks.length,")"]}),n.jsx("div",{className:"space-y-2",children:e.subtasks.map(A=>{const V=F(A.status),T=V.icon;return n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-md",children:[n.jsx(T,{className:Ke("w-4 h-4",V.color)}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white truncate",children:A.title}),A.description&&n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 truncate",children:A.description})]}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:A.id})]},A.id)})})]})]}),n.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:[n.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Task ID: ",e.id]}),n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("button",{onClick:t,className:"px-4 py-2 text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md transition-colors",children:"Close"})})]})]})})},du=({onShowAllTasks:e,onStartTask:t,className:r=""})=>{const{nextTask:a,tasks:s,currentProject:i,isLoadingTasks:o,projectTaskMaster:l,refreshTasks:c,refreshProjects:d}=Ss(),[u,m]=b.useState(!1),[h,p]=b.useState(!1),[g,y]=b.useState(!1),[v,w]=b.useState(!1),[S,N]=b.useState(!1),[I,F]=b.useState(!1),[E,R]=b.useState(!1),H=()=>{y(!0),p(!1)},$=()=>{w(!0),p(!1)};if(!i||o)return null;let A;if((!s||s.length===0)&&!l?.hasTaskmaster)A=n.jsxs("div",{className:Ke("bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-3 mb-4",r),children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(gi,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"TaskMaster AI is not configured"}),n.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-0.5"})]})]}),n.jsx("div",{className:"flex items-center gap-1",children:n.jsxs("button",{onClick:()=>p(!h),className:"text-xs px-2 py-1 bg-blue-600 hover:bg-blue-700 text-white rounded transition-colors flex items-center gap-1",children:[n.jsx(la,{className:"w-3 h-3"}),"Initialize TaskMaster AI"]})})]}),h&&n.jsxs("div",{className:"mt-3 pt-3 border-t border-blue-200 dark:border-blue-800",children:[!l?.hasTaskmaster&&n.jsxs("div",{className:"mb-3 p-3 bg-blue-50 dark:bg-blue-900/50 rounded-lg",children:[n.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-2",children:"🎯 What is TaskMaster?"}),n.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[n.jsxs("p",{children:["• ",n.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),n.jsx("div",{className:"flex flex-col gap-2",children:l?.hasTaskmaster?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mb-2 p-2 bg-green-50 dark:bg-green-900/30 rounded text-xs text-green-800 dark:text-green-200",children:[n.jsx("strong",{children:"Add more tasks:"})," Create additional tasks manually or generate them from a PRD template"]}),n.jsxs("button",{className:"text-xs px-3 py-2 bg-green-100 dark:bg-green-900 hover:bg-green-200 dark:hover:bg-green-800 text-green-800 dark:text-green-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:H,disabled:E,children:[n.jsx(ar,{className:"w-3 h-3"}),"Create a new task manually"]}),n.jsxs("button",{className:"text-xs px-3 py-2 bg-purple-100 dark:bg-purple-900 hover:bg-purple-200 dark:hover:bg-purple-800 text-purple-800 dark:text-purple-200 rounded transition-colors text-left flex items-center gap-2 disabled:opacity-50",onClick:$,disabled:E,children:[n.jsx(yr,{className:"w-3 h-3"}),E?"Parsing...":"Generate tasks from PRD template"]})]}):n.jsxs("button",{className:"text-xs px-3 py-2 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-800 dark:text-slate-200 rounded transition-colors text-left flex items-center gap-2",onClick:()=>N(!0),children:[n.jsx(qn,{className:"w-3 h-3"}),"Initialize TaskMaster"]})})]})]});else if(a)A=n.jsx("div",{className:Ke("bg-slate-50 dark:bg-slate-900/30 border border-slate-200 dark:border-slate-700 rounded-lg p-3 mb-4",r),children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("div",{className:"w-5 h-5 bg-blue-100 dark:bg-blue-900/50 rounded-full flex items-center justify-center flex-shrink-0",children:n.jsx(Ux,{className:"w-3 h-3 text-blue-600 dark:text-blue-400"})}),n.jsxs("span",{className:"text-xs text-slate-600 dark:text-slate-400 font-medium",children:["Task ",a.id]}),a.priority==="high"&&n.jsx("div",{className:"w-4 h-4 rounded bg-red-100 dark:bg-red-900/50 flex items-center justify-center",title:"High Priority",children:n.jsx(Qu,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})}),a.priority==="medium"&&n.jsx("div",{className:"w-4 h-4 rounded bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center",title:"Medium Priority",children:n.jsx(Ku,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})}),a.priority==="low"&&n.jsx("div",{className:"w-4 h-4 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center",title:"Low Priority",children:n.jsx(Ca,{className:"w-2.5 h-2.5 text-gray-400 dark:text-gray-500"})})]}),n.jsx("p",{className:"text-sm font-medium text-slate-900 dark:text-slate-100 line-clamp-1",children:a.title})]}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsxs("button",{onClick:()=>t?.(),className:"text-xs px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-md font-medium transition-colors shadow-sm flex items-center gap-1",children:[n.jsx(Sx,{className:"w-3 h-3"}),"Start Task"]}),n.jsx("button",{onClick:()=>F(!0),className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View task details",children:n.jsx(ws,{className:"w-3 h-3"})}),e&&n.jsx("button",{onClick:e,className:"text-xs px-2 py-1.5 border border-slate-300 dark:border-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-600 dark:text-slate-300 rounded-md transition-colors flex items-center gap-1",title:"View all tasks",children:n.jsx(gi,{className:"w-3 h-3"})})]})]})});else if(s&&s.length>0){const V=s.filter(U=>U.status==="done").length,T=s.length;A=n.jsx("div",{className:Ke("bg-purple-50 dark:bg-purple-950 border border-purple-200 dark:border-purple-800 rounded-lg p-3 mb-4",r),children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ks,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:V===T?"All done! 🎉":"No pending tasks"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:[V,"/",T]}),n.jsx("button",{onClick:e,className:"text-xs px-2 py-1 bg-purple-600 hover:bg-purple-700 text-white rounded transition-colors",children:"Review"})]})]})})}else A=null;return n.jsxs(n.Fragment,{children:[A,g&&n.jsx(n7,{currentProject:i,onClose:()=>y(!1),onTaskCreated:()=>{c(),y(!1)}}),v&&n.jsx(a7,{currentProject:i,onClose:()=>w(!1),onTemplateApplied:()=>{c(),w(!1)}}),S&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:n.jsx(qn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),n.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),n.jsx("button",{onClick:()=>N(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:n.jsx(Mt,{className:"w-5 h-5"})})]}),n.jsx("div",{className:"flex-1 p-4",children:n.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",children:n.jsx(O0,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0})})}),n.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster initialization will start automatically"}),n.jsx("button",{onClick:()=>N(!1),className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Close"})]})})]})}),I&&a&&n.jsx(Bp,{task:a,isOpen:I,onClose:()=>F(!1),onStatusChange:()=>c?.(),onTaskClick:null})]})},n7=({currentProject:e,onClose:t,onTaskCreated:r})=>{const[a,s]=b.useState({title:"",description:"",priority:"medium",useAI:!1,prompt:""}),[i,o]=b.useState(!1),l=async c=>{if(c.preventDefault(),!!e){o(!0);try{const d=a.useAI?{prompt:a.prompt,priority:a.priority}:{title:a.title,description:a.description,priority:a.priority},u=await lt.taskmaster.addTask(e.name,d);if(u.ok)r();else{const m=await u.json();console.error("Failed to create task:",m),alert(`Failed to create task: ${m.message}`)}}catch(d){console.error("Error creating task:",d),alert("Error creating task. Please try again.")}finally{o(!1)}}};return n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create New Task"}),n.jsx("button",{onClick:t,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:n.jsx(Mt,{className:"w-4 h-4"})})]}),n.jsxs("form",{onSubmit:l,className:"space-y-4",children:[n.jsx("div",{children:n.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[n.jsx("input",{type:"checkbox",checked:a.useAI,onChange:c=>s(d=>({...d,useAI:c.target.checked}))}),"Use AI to generate task details"]})}),a.useAI?n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Description (AI will generate details)"}),n.jsx("textarea",{value:a.prompt,onChange:c=>s(d=>({...d,prompt:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe what you want to accomplish...",required:!0})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Task Title"}),n.jsx("input",{type:"text",value:a.title,onChange:c=>s(d=>({...d,title:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Enter task title...",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Description"}),n.jsx("textarea",{value:a.description,onChange:c=>s(d=>({...d,description:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",rows:"3",placeholder:"Describe the task...",required:!0})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Priority"}),n.jsxs("select",{value:a.priority,onChange:c=>s(d=>({...d,priority:c.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",children:[n.jsx("option",{value:"low",children:"Low"}),n.jsx("option",{value:"medium",children:"Medium"}),n.jsx("option",{value:"high",children:"High"})]})]}),n.jsxs("div",{className:"flex gap-2 pt-4",children:[n.jsx("button",{type:"button",onClick:t,className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",disabled:i,children:"Cancel"}),n.jsx("button",{type:"submit",className:"flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded disabled:opacity-50",disabled:i||a.useAI&&!a.prompt.trim()||!a.useAI&&(!a.title.trim()||!a.description.trim()),children:i?"Creating...":"Create Task"})]})]})]})})},a7=({currentProject:e,onClose:t,onTemplateApplied:r})=>{const[a,s]=b.useState([]),[i,o]=b.useState(null),[l,c]=b.useState({}),[d,u]=b.useState("prd.txt"),[m,h]=b.useState(!0),[p,g]=b.useState(!1),[y,v]=b.useState("select");useEffect(()=>{(async()=>{try{const I=await lt.taskmaster.getTemplates();if(I.ok){const F=await I.json();s(F.templates)}}catch(I){console.error("Error loading templates:",I)}finally{h(!1)}})()},[]);const w=N=>{o(N);const I=N.content.match(/\[([^\]]+)\]/g)||[],F=[...new Set(I.map(R=>R.slice(1,-1)))],E={};F.forEach(R=>{E[R]=""}),c(E),v("customize")},S=async()=>{if(!(!i||!e)){g(!0);try{const N=await lt.taskmaster.applyTemplate(e.name,{templateId:i.id,fileName:d,customizations:l});if(!N.ok){const F=await N.json();throw new Error(F.message||"Failed to apply template")}const I=await lt.taskmaster.parsePRD(e.name,{fileName:d,numTasks:10});if(!I.ok){const F=await I.json();throw new Error(F.message||"Failed to generate tasks")}v("generate"),setTimeout(()=>{r()},2e3)}catch(N){console.error("Error applying template:",N),alert(`Error: ${N.message}`),g(!1)}}};return m?n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:n.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-md",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),n.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading templates..."})]})})}):n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-full max-w-2xl max-h-[80vh] overflow-y-auto",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:y==="select"?"Select PRD Template":y==="customize"?"Customize Template":"Generating Tasks"}),n.jsx("button",{onClick:t,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:n.jsx(Mt,{className:"w-4 h-4"})})]}),y==="select"&&n.jsx("div",{className:"space-y-3",children:a.map(N=>n.jsx("div",{className:"p-4 border border-gray-200 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer transition-colors",onClick:()=>w(N),children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white",children:N.name}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:N.description}),n.jsx("span",{className:"inline-block text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 px-2 py-1 rounded mt-2",children:N.category})]}),n.jsx(Vl,{className:"w-4 h-4 text-gray-400 mt-1"})]})},N.id))}),y==="customize"&&i&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"File Name"}),n.jsx("input",{type:"text",value:d,onChange:N=>u(N.target.value),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"prd.txt"})]}),Object.keys(l).length>0&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Customize Template"}),n.jsx("div",{className:"space-y-3",children:Object.entries(l).map(([N,I])=>n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs text-gray-600 dark:text-gray-400 mb-1",children:N.replace(/([A-Z])/g," $1").replace(/^./,F=>F.toUpperCase())}),n.jsx("input",{type:"text",value:I,onChange:F=>c(E=>({...E,[N]:F.target.value})),className:"w-full p-2 border border-gray-300 dark:border-gray-600 rounded text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",placeholder:`Enter ${N.toLowerCase()}`})]},N))})]}),n.jsxs("div",{className:"flex gap-2 pt-4",children:[n.jsx("button",{onClick:()=>v("select"),className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",children:"Back"}),n.jsx("button",{onClick:S,className:"flex-1 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded disabled:opacity-50",disabled:p,children:p?"Applying...":"Apply & Generate Tasks"})]})]}),y==="generate"&&n.jsxs("div",{className:"text-center py-8",children:[n.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900 rounded-full flex items-center justify-center mx-auto mb-4",children:n.jsx(ks,{className:"w-8 h-8 text-green-600 dark:text-green-400"})}),n.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"Template Applied Successfully!"}),n.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Your PRD has been created and tasks are being generated..."})]})]})})};function s7({status:e,onAbort:t,isLoading:r,provider:a="claude"}){const[s,i]=b.useState(0),[o,l]=b.useState(0),[c,d]=b.useState(0);if(b.useEffect(()=>{if(!r){i(0),d(0);return}const w=Date.now(),S=30+Math.random()*20,N=setInterval(()=>{const I=Math.floor((Date.now()-w)/1e3);i(I),d(Math.floor(I*S))},1e3);return()=>clearInterval(N)},[r]),b.useEffect(()=>{if(!r)return;const w=setInterval(()=>{l(S=>(S+1)%4)},500);return()=>clearInterval(w)},[r]),!r)return null;const u=["Thinking","Processing","Analyzing","Working","Computing","Reasoning"],m=Math.floor(s/3)%u.length,h=e?.text||u[m],p=e?.tokens||c,g=e?.can_interrupt!==!1,v=["✻","✹","✸","✶"][o];return n.jsx("div",{className:"w-full mb-3 sm:mb-6 animate-in slide-in-from-bottom duration-300",children:n.jsxs("div",{className:"flex items-center justify-between max-w-4xl mx-auto bg-gray-800 dark:bg-gray-900 text-white rounded-lg shadow-lg px-2.5 py-2 sm:px-4 sm:py-3 border border-gray-700 dark:border-gray-800",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[n.jsx("span",{className:Ke("text-base sm:text-xl transition-all duration-500 flex-shrink-0",o%2===0?"text-blue-400 scale-110":"text-blue-300"),children:v}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[n.jsxs("span",{className:"font-medium text-xs sm:text-sm truncate",children:[h,"..."]}),n.jsxs("span",{className:"text-gray-400 text-xs sm:text-sm flex-shrink-0",children:["(",s,"s)"]}),p>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-gray-500 hidden sm:inline",children:"·"}),n.jsxs("span",{className:"text-gray-300 text-xs sm:text-sm hidden sm:inline flex-shrink-0",children:["⚒ ",p.toLocaleString()]})]}),n.jsx("span",{className:"text-gray-500 hidden sm:inline",children:"·"}),n.jsx("span",{className:"text-gray-400 text-xs sm:text-sm hidden sm:inline",children:"esc to stop"})]})})]})}),g&&t&&n.jsxs("button",{onClick:t,className:"ml-2 sm:ml-3 text-xs bg-red-600 hover:bg-red-700 active:bg-red-800 text-white px-2 py-1 sm:px-3 sm:py-1.5 rounded-md transition-colors flex items-center gap-1 sm:gap-1.5 flex-shrink-0 font-medium",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),n.jsx("span",{className:"hidden sm:inline",children:"Stop"})]})]})})}function i7({used:e,total:t}){if(e==null||t==null||t<=0)return null;const r=Math.min(100,e/t*100),a=10,s=2*Math.PI*a,i=s-r/100*s,o=()=>r<50?"#3b82f6":r<75?"#f59e0b":"#ef4444";return n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"transform -rotate-90",children:[n.jsx("circle",{cx:"12",cy:"12",r:a,fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-gray-300 dark:text-gray-600"}),n.jsx("circle",{cx:"12",cy:"12",r:a,fill:"none",stroke:o(),strokeWidth:"2",strokeDasharray:s,strokeDashoffset:i,strokeLinecap:"round"})]}),n.jsxs("span",{title:`${e.toLocaleString()} / ${t.toLocaleString()} tokens`,children:[r.toFixed(1),"%"]})]})}async function o7(e,t){const r=new FormData,a=`recording_${Date.now()}.webm`,s=new File([e],a,{type:e.type});r.append("audio",s);const i=window.localStorage.getItem("whisperMode")||"default";r.append("mode",i);try{const o=await lt.transcribe(r);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.error||`Transcription error: ${o.status} ${o.statusText}`)}return(await o.json()).text||""}catch(o){throw o.name==="TypeError"&&o.message.includes("fetch")?new Error("Cannot connect to server. Please ensure the backend is running."):o}}function Op({onTranscript:e,className:t=""}){const[r,a]=b.useState("idle"),[s,i]=b.useState(null),[o,l]=b.useState(!0),c=b.useRef(null),d=b.useRef(null),u=b.useRef([]),m=b.useRef(0);b.useEffect(()=>{(()=>{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){l(!1),i("Microphone not supported. Please use HTTPS or a modern browser.");return}if(location.protocol!=="https:"&&location.hostname!=="localhost"){l(!1),i("Microphone requires HTTPS. Please use a secure connection.");return}l(!0),i(null)})()},[]);const h=async()=>{try{if(console.log("Starting recording..."),i(null),u.current=[],!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Microphone access not available. Please use HTTPS or a supported browser.");const N=await navigator.mediaDevices.getUserMedia({audio:!0});d.current=N;const I=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",F=new MediaRecorder(N,{mimeType:I});c.current=F,F.ondataavailable=E=>{E.data.size>0&&u.current.push(E.data)},F.onstop=async()=>{console.log("Recording stopped, creating blob...");const E=new Blob(u.current,{type:I});d.current&&(d.current.getTracks().forEach(A=>A.stop()),d.current=null),a("transcribing");const R=window.localStorage.getItem("whisperMode")||"default",H=R==="prompt"||R==="vibe"||R==="instructions"||R==="architect";let $;H&&($=setTimeout(()=>{a("processing")},2e3));try{const A=await o7(E);A&&e&&e(A)}catch(A){console.error("Transcription error:",A),i(A.message)}finally{$&&clearTimeout($),a("idle")}},F.start(),a("recording"),console.log("Recording started successfully")}catch(N){console.error("Failed to start recording:",N);let I="Microphone access failed";N.name==="NotAllowedError"?I="Microphone access denied. Please allow microphone permissions.":N.name==="NotFoundError"?I="No microphone found. Please check your audio devices.":N.name==="NotSupportedError"?I="Microphone not supported by this browser.":N.name==="NotReadableError"?I="Microphone is being used by another application.":N.message.includes("HTTPS")&&(I=N.message),i(I),a("idle")}},p=()=>{console.log("Stopping recording..."),c.current&&c.current.state==="recording"?c.current.stop():(console.log("Recorder not in recording state, forcing cleanup"),d.current&&(d.current.getTracks().forEach(N=>N.stop()),d.current=null),a("idle"))},g=N=>{if(N&&(N.preventDefault(),N.stopPropagation()),!o)return;const I=Date.now();if(I-m.current<300){console.log("Ignoring rapid tap");return}m.current=I,console.log("Button clicked, current state:",r),r==="idle"?h():r==="recording"&&p()};b.useEffect(()=>()=>{d.current&&d.current.getTracks().forEach(N=>N.stop())},[]);const y=()=>{if(!o)return{icon:n.jsx(ci,{className:"w-5 h-5"}),className:"bg-gray-400 cursor-not-allowed",disabled:!0};switch(r){case"recording":return{icon:n.jsx(ci,{className:"w-5 h-5 text-white"}),className:"bg-red-500 hover:bg-red-600 animate-pulse",disabled:!1};case"transcribing":return{icon:n.jsx(ds,{className:"w-5 h-5 animate-spin"}),className:"bg-blue-500 hover:bg-blue-600",disabled:!0};case"processing":return{icon:n.jsx(Vu,{className:"w-5 h-5 animate-pulse"}),className:"bg-purple-500 hover:bg-purple-600",disabled:!0};default:return{icon:n.jsx(ci,{className:"w-5 h-5"}),className:"bg-gray-700 hover:bg-gray-600",disabled:!1}}},{icon:v,className:w,disabled:S}=y();return n.jsxs("div",{className:"relative",children:[n.jsx("button",{type:"button",style:{backgroundColor:r==="recording"?"#ef4444":r==="transcribing"?"#3b82f6":r==="processing"?"#a855f7":"#374151"},className:`
705
+ flex items-center justify-center
706
+ w-12 h-12 rounded-full
707
+ text-white transition-all duration-200
708
+ focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500
709
+ dark:ring-offset-gray-800
710
+ touch-action-manipulation
711
+ ${S?"cursor-not-allowed opacity-75":"cursor-pointer"}
712
+ ${r==="recording"?"animate-pulse":""}
713
+ hover:opacity-90
714
+ ${t}
715
+ `,onClick:g,disabled:S,children:v}),s&&n.jsx("div",{className:`absolute top-full mt-2 left-1/2 transform -translate-x-1/2
716
+ bg-red-500 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-10
717
+ animate-fade-in`,children:s}),r==="recording"&&n.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-red-500 animate-ping pointer-events-none"}),r==="processing"&&n.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-purple-500 animate-ping pointer-events-none"})]})}function Mn(e){return Array.isArray?Array.isArray(e):qp(e)==="[object Array]"}function l7(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function c7(e){return e==null?"":l7(e)}function ln(e){return typeof e=="string"}function $p(e){return typeof e=="number"}function d7(e){return e===!0||e===!1||u7(e)&&qp(e)=="[object Boolean]"}function _p(e){return typeof e=="object"}function u7(e){return _p(e)&&e!==null}function Mr(e){return e!=null}function Go(e){return!e.trim().length}function qp(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const m7="Incorrect 'index' type",h7=e=>`Invalid value for key ${e}`,p7=e=>`Pattern length exceeds max of ${e}.`,f7=e=>`Missing ${e} property in key`,g7=e=>`Property 'weight' in key '${e}' must be a positive integer`,uu=Object.prototype.hasOwnProperty;class x7{constructor(t){this._keys=[],this._keyMap={};let r=0;t.forEach(a=>{let s=Hp(a);this._keys.push(s),this._keyMap[s.id]=s,r+=s.weight}),this._keys.forEach(a=>{a.weight/=r})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Hp(e){let t=null,r=null,a=null,s=1,i=null;if(ln(e)||Mn(e))a=e,t=mu(e),r=Dl(e);else{if(!uu.call(e,"name"))throw new Error(f7("name"));const o=e.name;if(a=o,uu.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(g7(o));t=mu(o),r=Dl(o),i=e.getFn}return{path:t,id:r,weight:s,src:a,getFn:i}}function mu(e){return Mn(e)?e:e.split(".")}function Dl(e){return Mn(e)?e.join("."):e}function b7(e,t){let r=[],a=!1;const s=(i,o,l)=>{if(Mr(i))if(!o[l])r.push(i);else{let c=o[l];const d=i[c];if(!Mr(d))return;if(l===o.length-1&&(ln(d)||$p(d)||d7(d)))r.push(c7(d));else if(Mn(d)){a=!0;for(let u=0,m=d.length;u<m;u+=1)s(d[u],o,l+1)}else o.length&&s(d,o,l+1)}};return s(e,ln(t)?t.split("."):t,0),a?r:r[0]}const y7={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},v7={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},k7={location:0,threshold:.6,distance:100},w7={useExtendedSearch:!1,getFn:b7,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var at={...v7,...y7,...k7,...w7};const j7=/[^ ]+/g;function N7(e=1,t=3){const r=new Map,a=Math.pow(10,t);return{get(s){const i=s.match(j7).length;if(r.has(i))return r.get(i);const o=1/Math.pow(i,.5*e),l=parseFloat(Math.round(o*a)/a);return r.set(i,l),l},clear(){r.clear()}}}class $0{constructor({getFn:t=at.getFn,fieldNormWeight:r=at.fieldNormWeight}={}){this.norm=N7(r,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((r,a)=>{this._keysMap[r.id]=a})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,ln(this.docs[0])?this.docs.forEach((t,r)=>{this._addString(t,r)}):this.docs.forEach((t,r)=>{this._addObject(t,r)}),this.norm.clear())}add(t){const r=this.size();ln(t)?this._addString(t,r):this._addObject(t,r)}removeAt(t){this.records.splice(t,1);for(let r=t,a=this.size();r<a;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(t,r){return t[this._keysMap[r]]}size(){return this.records.length}_addString(t,r){if(!Mr(t)||Go(t))return;let a={v:t,i:r,n:this.norm.get(t)};this.records.push(a)}_addObject(t,r){let a={i:r,$:{}};this.keys.forEach((s,i)=>{let o=s.getFn?s.getFn(t):this.getFn(t,s.path);if(Mr(o)){if(Mn(o)){let l=[];const c=[{nestedArrIndex:-1,value:o}];for(;c.length;){const{nestedArrIndex:d,value:u}=c.pop();if(Mr(u))if(ln(u)&&!Go(u)){let m={v:u,i:d,n:this.norm.get(u)};l.push(m)}else Mn(u)&&u.forEach((m,h)=>{c.push({nestedArrIndex:h,value:m})})}a.$[i]=l}else if(ln(o)&&!Go(o)){let l={v:o,n:this.norm.get(o)};a.$[i]=l}}}),this.records.push(a)}toJSON(){return{keys:this.keys,records:this.records}}}function Wp(e,t,{getFn:r=at.getFn,fieldNormWeight:a=at.fieldNormWeight}={}){const s=new $0({getFn:r,fieldNormWeight:a});return s.setKeys(e.map(Hp)),s.setSources(t),s.create(),s}function S7(e,{getFn:t=at.getFn,fieldNormWeight:r=at.fieldNormWeight}={}){const{keys:a,records:s}=e,i=new $0({getFn:t,fieldNormWeight:r});return i.setKeys(a),i.setIndexRecords(s),i}function ii(e,{errors:t=0,currentLocation:r=0,expectedLocation:a=0,distance:s=at.distance,ignoreLocation:i=at.ignoreLocation}={}){const o=t/e.length;if(i)return o;const l=Math.abs(a-r);return s?o+l/s:l?1:o}function C7(e=[],t=at.minMatchCharLength){let r=[],a=-1,s=-1,i=0;for(let o=e.length;i<o;i+=1){let l=e[i];l&&a===-1?a=i:!l&&a!==-1&&(s=i-1,s-a+1>=t&&r.push([a,s]),a=-1)}return e[i-1]&&i-a>=t&&r.push([a,i-1]),r}const sa=32;function M7(e,t,r,{location:a=at.location,distance:s=at.distance,threshold:i=at.threshold,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,includeMatches:c=at.includeMatches,ignoreLocation:d=at.ignoreLocation}={}){if(t.length>sa)throw new Error(p7(sa));const u=t.length,m=e.length,h=Math.max(0,Math.min(a,m));let p=i,g=h;const y=l>1||c,v=y?Array(m):[];let w;for(;(w=e.indexOf(t,g))>-1;){let R=ii(t,{currentLocation:w,expectedLocation:h,distance:s,ignoreLocation:d});if(p=Math.min(R,p),g=w+u,y){let H=0;for(;H<u;)v[w+H]=1,H+=1}}g=-1;let S=[],N=1,I=u+m;const F=1<<u-1;for(let R=0;R<u;R+=1){let H=0,$=I;for(;H<$;)ii(t,{errors:R,currentLocation:h+$,expectedLocation:h,distance:s,ignoreLocation:d})<=p?H=$:I=$,$=Math.floor((I-H)/2+H);I=$;let A=Math.max(1,h-$+1),V=o?m:Math.min(h+$,m)+u,T=Array(V+2);T[V+1]=(1<<R)-1;for(let P=V;P>=A;P-=1){let _=P-1,se=r[e.charAt(_)];if(y&&(v[_]=+!!se),T[P]=(T[P+1]<<1|1)&se,R&&(T[P]|=(S[P+1]|S[P])<<1|1|S[P+1]),T[P]&F&&(N=ii(t,{errors:R,currentLocation:_,expectedLocation:h,distance:s,ignoreLocation:d}),N<=p)){if(p=N,g=_,g<=h)break;A=Math.max(1,2*h-g)}}if(ii(t,{errors:R+1,currentLocation:h,expectedLocation:h,distance:s,ignoreLocation:d})>p)break;S=T}const E={isMatch:g>=0,score:Math.max(.001,N)};if(y){const R=C7(v,l);R.length?c&&(E.indices=R):E.isMatch=!1}return E}function A7(e){let t={};for(let r=0,a=e.length;r<a;r+=1){const s=e.charAt(r);t[s]=(t[s]||0)|1<<a-r-1}return t}const Ei=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class Up{constructor(t,{location:r=at.location,threshold:a=at.threshold,distance:s=at.distance,includeMatches:i=at.includeMatches,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,isCaseSensitive:c=at.isCaseSensitive,ignoreDiacritics:d=at.ignoreDiacritics,ignoreLocation:u=at.ignoreLocation}={}){if(this.options={location:r,threshold:a,distance:s,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u},t=c?t:t.toLowerCase(),t=d?Ei(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const m=(p,g)=>{this.chunks.push({pattern:p,alphabet:A7(p),startIndex:g})},h=this.pattern.length;if(h>sa){let p=0;const g=h%sa,y=h-g;for(;p<y;)m(this.pattern.substr(p,sa),p),p+=sa;if(g){const v=h-sa;m(this.pattern.substr(v),v)}}else m(this.pattern,0)}searchIn(t){const{isCaseSensitive:r,ignoreDiacritics:a,includeMatches:s}=this.options;if(t=r?t:t.toLowerCase(),t=a?Ei(t):t,this.pattern===t){let y={isMatch:!0,score:0};return s&&(y.indices=[[0,t.length-1]]),y}const{location:i,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,ignoreLocation:u}=this.options;let m=[],h=0,p=!1;this.chunks.forEach(({pattern:y,alphabet:v,startIndex:w})=>{const{isMatch:S,score:N,indices:I}=M7(t,y,v,{location:i+w,distance:o,threshold:l,findAllMatches:c,minMatchCharLength:d,includeMatches:s,ignoreLocation:u});S&&(p=!0),h+=N,S&&I&&(m=[...m,...I])});let g={isMatch:p,score:p?h/this.chunks.length:1};return p&&s&&(g.indices=m),g}}class Kn{constructor(t){this.pattern=t}static isMultiMatch(t){return hu(t,this.multiRegex)}static isSingleMatch(t){return hu(t,this.singleRegex)}search(){}}function hu(e,t){const r=e.match(t);return r?r[1]:null}class T7 extends Kn{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const r=t===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class E7 extends Kn{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const a=t.indexOf(this.pattern)===-1;return{isMatch:a,score:a?0:1,indices:[0,t.length-1]}}}class I7 extends Kn{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const r=t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class D7 extends Kn{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const r=!t.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class z7 extends Kn{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const r=t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class L7 extends Kn{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const r=!t.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class Vp extends Kn{constructor(t,{location:r=at.location,threshold:a=at.threshold,distance:s=at.distance,includeMatches:i=at.includeMatches,findAllMatches:o=at.findAllMatches,minMatchCharLength:l=at.minMatchCharLength,isCaseSensitive:c=at.isCaseSensitive,ignoreDiacritics:d=at.ignoreDiacritics,ignoreLocation:u=at.ignoreLocation}={}){super(t),this._bitapSearch=new Up(t,{location:r,threshold:a,distance:s,includeMatches:i,findAllMatches:o,minMatchCharLength:l,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Gp extends Kn{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let r=0,a;const s=[],i=this.pattern.length;for(;(a=t.indexOf(this.pattern,r))>-1;)r=a+i,s.push([a,r-1]);const o=!!s.length;return{isMatch:o,score:o?0:1,indices:s}}}const zl=[T7,Gp,I7,D7,L7,z7,E7,Vp],pu=zl.length,P7=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,R7="|";function F7(e,t={}){return e.split(R7).map(r=>{let a=r.trim().split(P7).filter(i=>i&&!!i.trim()),s=[];for(let i=0,o=a.length;i<o;i+=1){const l=a[i];let c=!1,d=-1;for(;!c&&++d<pu;){const u=zl[d];let m=u.isMultiMatch(l);m&&(s.push(new u(m,t)),c=!0)}if(!c)for(d=-1;++d<pu;){const u=zl[d];let m=u.isSingleMatch(l);if(m){s.push(new u(m,t));break}}}return s})}const B7=new Set([Vp.type,Gp.type]);class O7{constructor(t,{isCaseSensitive:r=at.isCaseSensitive,ignoreDiacritics:a=at.ignoreDiacritics,includeMatches:s=at.includeMatches,minMatchCharLength:i=at.minMatchCharLength,ignoreLocation:o=at.ignoreLocation,findAllMatches:l=at.findAllMatches,location:c=at.location,threshold:d=at.threshold,distance:u=at.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:a,includeMatches:s,minMatchCharLength:i,findAllMatches:l,ignoreLocation:o,location:c,threshold:d,distance:u},t=r?t:t.toLowerCase(),t=a?Ei(t):t,this.pattern=t,this.query=F7(this.pattern,this.options)}static condition(t,r){return r.useExtendedSearch}searchIn(t){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:a,isCaseSensitive:s,ignoreDiacritics:i}=this.options;t=s?t:t.toLowerCase(),t=i?Ei(t):t;let o=0,l=[],c=0;for(let d=0,u=r.length;d<u;d+=1){const m=r[d];l.length=0,o=0;for(let h=0,p=m.length;h<p;h+=1){const g=m[h],{isMatch:y,indices:v,score:w}=g.search(t);if(y){if(o+=1,c+=w,a){const S=g.constructor.type;B7.has(S)?l=[...l,...v]:l.push(v)}}else{c=0,o=0,l.length=0;break}}if(o){let h={isMatch:!0,score:c/o};return a&&(h.indices=l),h}}return{isMatch:!1,score:1}}}const Ll=[];function $7(...e){Ll.push(...e)}function Pl(e,t){for(let r=0,a=Ll.length;r<a;r+=1){let s=Ll[r];if(s.condition(e,t))return new s(e,t)}return new Up(e,t)}const Ii={AND:"$and",OR:"$or"},Rl={PATH:"$path",PATTERN:"$val"},Fl=e=>!!(e[Ii.AND]||e[Ii.OR]),_7=e=>!!e[Rl.PATH],q7=e=>!Mn(e)&&_p(e)&&!Fl(e),fu=e=>({[Ii.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Kp(e,t,{auto:r=!0}={}){const a=s=>{let i=Object.keys(s);const o=_7(s);if(!o&&i.length>1&&!Fl(s))return a(fu(s));if(q7(s)){const c=o?s[Rl.PATH]:i[0],d=o?s[Rl.PATTERN]:s[c];if(!ln(d))throw new Error(h7(c));const u={keyId:Dl(c),pattern:d};return r&&(u.searcher=Pl(d,t)),u}let l={children:[],operator:i[0]};return i.forEach(c=>{const d=s[c];Mn(d)&&d.forEach(u=>{l.children.push(a(u))})}),l};return Fl(e)||(e=fu(e)),a(e)}function H7(e,{ignoreFieldNorm:t=at.ignoreFieldNorm}){e.forEach(r=>{let a=1;r.matches.forEach(({key:s,norm:i,score:o})=>{const l=s?s.weight:null;a*=Math.pow(o===0&&l?Number.EPSILON:o,(l||1)*(t?1:i))}),r.score=a})}function W7(e,t){const r=e.matches;t.matches=[],Mr(r)&&r.forEach(a=>{if(!Mr(a.indices)||!a.indices.length)return;const{indices:s,value:i}=a;let o={indices:s,value:i};a.key&&(o.key=a.key.src),a.idx>-1&&(o.refIndex=a.idx),t.matches.push(o)})}function U7(e,t){t.score=e.score}function V7(e,t,{includeMatches:r=at.includeMatches,includeScore:a=at.includeScore}={}){const s=[];return r&&s.push(W7),a&&s.push(U7),e.map(i=>{const{idx:o}=i,l={item:t[o],refIndex:o};return s.length&&s.forEach(c=>{c(i,l)}),l})}class Wa{constructor(t,r={},a){this.options={...at,...r},this.options.useExtendedSearch,this._keyStore=new x7(this.options.keys),this.setCollection(t,a)}setCollection(t,r){if(this._docs=t,r&&!(r instanceof $0))throw new Error(m7);this._myIndex=r||Wp(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){Mr(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const r=[];for(let a=0,s=this._docs.length;a<s;a+=1){const i=this._docs[a];t(i,a)&&(this.removeAt(a),a-=1,s-=1,r.push(i))}return r}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:r=-1}={}){const{includeMatches:a,includeScore:s,shouldSort:i,sortFn:o,ignoreFieldNorm:l}=this.options;let c=ln(t)?ln(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return H7(c,{ignoreFieldNorm:l}),i&&c.sort(o),$p(r)&&r>-1&&(c=c.slice(0,r)),V7(c,this._docs,{includeMatches:a,includeScore:s})}_searchStringList(t){const r=Pl(t,this.options),{records:a}=this._myIndex,s=[];return a.forEach(({v:i,i:o,n:l})=>{if(!Mr(i))return;const{isMatch:c,score:d,indices:u}=r.searchIn(i);c&&s.push({item:i,idx:o,matches:[{score:d,value:i,norm:l,indices:u}]})}),s}_searchLogical(t){const r=Kp(t,this.options),a=(l,c,d)=>{if(!l.children){const{keyId:m,searcher:h}=l,p=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(c,m),searcher:h});return p&&p.length?[{idx:d,item:c,matches:p}]:[]}const u=[];for(let m=0,h=l.children.length;m<h;m+=1){const p=l.children[m],g=a(p,c,d);if(g.length)u.push(...g);else if(l.operator===Ii.AND)return[]}return u},s=this._myIndex.records,i={},o=[];return s.forEach(({$:l,i:c})=>{if(Mr(l)){let d=a(r,l,c);d.length&&(i[c]||(i[c]={idx:c,item:l,matches:[]},o.push(i[c])),d.forEach(({matches:u})=>{i[c].matches.push(...u)}))}}),o}_searchObjectList(t){const r=Pl(t,this.options),{keys:a,records:s}=this._myIndex,i=[];return s.forEach(({$:o,i:l})=>{if(!Mr(o))return;let c=[];a.forEach((d,u)=>{c.push(...this._findMatches({key:d,value:o[u],searcher:r}))}),c.length&&i.push({idx:l,item:o,matches:c})}),i}_findMatches({key:t,value:r,searcher:a}){if(!Mr(r))return[];let s=[];if(Mn(r))r.forEach(({v:i,i:o,n:l})=>{if(!Mr(i))return;const{isMatch:c,score:d,indices:u}=a.searchIn(i);c&&s.push({score:d,key:t,value:i,idx:o,norm:l,indices:u})});else{const{v:i,n:o}=r,{isMatch:l,score:c,indices:d}=a.searchIn(i);l&&s.push({score:c,key:t,value:i,norm:o,indices:d})}return s}}Wa.version="7.1.0";Wa.createIndex=Wp;Wa.parseIndex=S7;Wa.config=at;Wa.parseQuery=Kp;$7(O7);const G7=({commands:e=[],selectedIndex:t=-1,onSelect:r,onClose:a,position:s={top:0,left:0},isOpen:i=!1,frequentCommands:o=[]})=>{const l=b.useRef(null),c=b.useRef(null),u=(()=>{const S=window.innerWidth<640,N=window.innerHeight;return S?{position:"fixed",bottom:`${s.bottom||90}px`,left:"16px",right:"16px",width:"auto",maxWidth:"calc(100vw - 32px)",maxHeight:"min(50vh, 300px)"}:{position:"fixed",top:`${Math.max(16,Math.min(s.top,N-316))}px`,left:`${s.left}px`,width:"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",maxHeight:"300px"}})();if(b.useEffect(()=>{const S=N=>{l.current&&!l.current.contains(N.target)&&i&&a()};if(i)return document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[i,a]),b.useEffect(()=>{if(c.current&&l.current){const S=l.current.getBoundingClientRect(),N=c.current.getBoundingClientRect();N.bottom>S.bottom?c.current.scrollIntoView({block:"nearest",behavior:"smooth"}):N.top<S.top&&c.current.scrollIntoView({block:"nearest",behavior:"smooth"})}},[t]),!i)return null;if(e.length===0)return n.jsx("div",{ref:l,className:"command-menu command-menu-empty",style:{...u,maxHeight:"300px",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"20px",opacity:1,transform:"translateY(0)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out",textAlign:"center"},children:"No commands available"});const m=o.length>0,h=e.reduce((S,N)=>{const I=N.namespace||N.type||"other";return S[I]||(S[I]=[]),S[I].push(N),S},{});m&&(h.frequent=o);const g=(m?["frequent","builtin","project","user","other"]:["builtin","project","user","other"]).filter(S=>h[S]),y={frequent:"⭐ Frequently Used",builtin:"Built-in Commands",project:"Project Commands",user:"User Commands",other:"Other Commands"};let v=0;const w=[];return g.forEach(S=>{h[S].forEach(N=>{w.push({...N,globalIndex:v++,namespace:S})})}),n.jsxs("div",{ref:l,role:"listbox","aria-label":"Available commands",className:"command-menu",style:{...u,maxHeight:"300px",overflowY:"auto",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"8px",opacity:i?1:0,transform:i?"translateY(0)":"translateY(-10px)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out"},children:[g.map(S=>n.jsxs("div",{className:"command-group",children:[g.length>1&&n.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:"#6b7280",padding:"8px 12px 4px",letterSpacing:"0.05em"},children:y[S]||S}),h[S].map(N=>{const I=w.find(E=>E.name===N.name&&E.namespace===S),F=I&&I.globalIndex===t;return n.jsxs("div",{ref:F?c:null,role:"option","aria-selected":F,className:"command-item",onMouseEnter:()=>r&&r(N,I.globalIndex,!0),onClick:()=>r&&r(N,I.globalIndex,!1),style:{display:"flex",alignItems:"flex-start",padding:"10px 12px",borderRadius:"6px",cursor:"pointer",backgroundColor:F?"#eff6ff":"transparent",transition:"background-color 100ms ease-in-out",marginBottom:"2px"},onMouseDown:E=>E.preventDefault(),children:[n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:N.description?"4px":0},children:[n.jsxs("span",{style:{fontSize:"16px",flexShrink:0},children:[S==="builtin"&&"⚡",S==="project"&&"📁",S==="user"&&"👤",S==="other"&&"📝"]}),n.jsx("span",{style:{fontWeight:600,fontSize:"14px",color:"#111827",fontFamily:"monospace"},children:N.name}),N.metadata?.type&&n.jsx("span",{className:"command-metadata-badge",style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",fontWeight:500},children:N.metadata.type})]}),N.description&&n.jsx("div",{style:{fontSize:"13px",color:"#6b7280",marginLeft:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:N.description})]}),F&&n.jsx("span",{style:{marginLeft:"8px",color:"#3b82f6",fontSize:"12px",fontWeight:600},children:"↵"})]},`${S}-${N.name}`)})]},S)),n.jsx("style",{children:`
718
+ .command-menu {
719
+ background-color: white;
720
+ border: 1px solid #e5e7eb;
721
+ }
722
+ .command-menu-empty {
723
+ color: #6b7280;
724
+ }
725
+
726
+ @media (prefers-color-scheme: dark) {
727
+ .command-menu {
728
+ background-color: #1f2937 !important;
729
+ border: 1px solid #374151 !important;
730
+ }
731
+ .command-menu-empty {
732
+ color: #9ca3af !important;
733
+ }
734
+ .command-item[aria-selected="true"] {
735
+ background-color: #1e40af !important;
736
+ }
737
+ .command-item span:not(.command-metadata-badge) {
738
+ color: #f3f4f6 !important;
739
+ }
740
+ .command-metadata-badge {
741
+ background-color: #f3f4f6 !important;
742
+ color: #6b7280 !important;
743
+ }
744
+ .command-item div {
745
+ color: #d1d5db !important;
746
+ }
747
+ .command-group > div:first-child {
748
+ color: #9ca3af !important;
749
+ }
750
+ }
751
+ `})]})};function tn(e){return e&&e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function K7(e){if(!e||typeof e!="string")return e;try{return e.replace(/```\s*([^\n\r]+?)\s*```/g,"`$1`")}catch{return e}}function oi(e){if(!e||typeof e!="string")return e;const t=[],r="__MATH_BLOCK_",a="__";let s=e.replace(/\$\$([\s\S]*?)\$\$|\$([^\$\n]+?)\$/g,i=>{const o=t.length;return t.push(i),`${r}${o}${a}`});return s=s.replace(/\\n/g,`
752
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r"),s=s.replace(new RegExp(`${r}(\\d+)${a}`,"g"),(i,o)=>t[parseInt(o)]),s}const wa=({children:e,className:t})=>{const r=K7(String(e??"")),a=b.useMemo(()=>[c3,y6],[]),s=b.useMemo(()=>[X6],[]);return n.jsx("div",{className:t,children:n.jsx(Xy,{remarkPlugins:a,rehypePlugins:s,components:J7,children:r})})};function Bl(e){try{return typeof e!="string"?e:e.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(t,r)=>{let a=parseInt(r,10);if(!Number.isFinite(a))return t;a<1e12&&(a*=1e3);const s=new Date(a),i=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(s),o=-s.getTimezoneOffset(),l=o>=0?"+":"-",c=Math.abs(o),d=Math.floor(c/60),u=c%60,m=`GMT${l}${d}${u?":"+String(u).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,S=>S.toUpperCase()),y=g?`${m} (${g})`:m,v=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],w=`${s.getDate()} ${v[s.getMonth()]} ${s.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${i} ${y}** - ${w}`})}catch{return e}}const gr={setItem:(e,t)=>{try{if(e.startsWith("chat_messages_")&&typeof t=="string")try{const r=JSON.parse(t);if(Array.isArray(r)&&r.length>50){console.warn(`Truncating chat history for ${e} from ${r.length} to 50 messages`);const a=r.slice(-50);t=JSON.stringify(a)}}catch(r){console.warn("Could not parse chat messages for truncation:",r)}localStorage.setItem(e,t)}catch(r){if(r.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data");const a=Object.keys(localStorage),s=a.filter(o=>o.startsWith("chat_messages_")).sort();s.length>3&&s.slice(0,s.length-3).forEach(o=>{localStorage.removeItem(o),console.log(`Removed old chat data: ${o}`)}),a.filter(o=>o.startsWith("draft_input_")).forEach(o=>{localStorage.removeItem(o)});try{localStorage.setItem(e,t)}catch(o){if(console.error("Failed to save to localStorage even after cleanup:",o),e.startsWith("chat_messages_")&&typeof t=="string")try{const l=JSON.parse(t);if(Array.isArray(l)&&l.length>10){const c=l.slice(-10);localStorage.setItem(e,JSON.stringify(c)),console.warn("Saved only last 10 messages due to quota constraints")}}catch(l){console.error("Final save attempt failed:",l)}}}else console.error("localStorage error:",r)}},getItem:e=>{try{return localStorage.getItem(e)}catch(t){return console.error("localStorage getItem error:",t),null}},removeItem:e=>{try{localStorage.removeItem(e)}catch(t){console.error("localStorage removeItem error:",t)}}},J7={code:({node:e,inline:t,className:r,children:a,...s})=>{const[i,o]=Kr.useState(!1),l=Array.isArray(a)?a.join(""):String(a??""),c=/[\r\n]/.test(l);if(t||e&&e.type==="inlineCode"||!c)return n.jsx("code",{className:`font-mono text-[0.9em] px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800/60 dark:text-gray-100 dark:border-gray-700 whitespace-pre-wrap break-words ${r||""}`,...s,children:a});const m=l,h=()=>{const p=()=>{o(!0),setTimeout(()=>o(!1),1500)};try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(m).then(p).catch(()=>{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select();try{document.execCommand("copy")}catch{}document.body.removeChild(g),p()});else{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select();try{document.execCommand("copy")}catch{}document.body.removeChild(g),p()}}catch{}};return n.jsxs("div",{className:"relative group my-2",children:[n.jsx("button",{type:"button",onClick:h,className:"absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 focus:opacity-100 active:opacity-100 transition-opacity text-xs px-2 py-1 rounded-md bg-gray-700/80 hover:bg-gray-700 text-white border border-gray-600",title:i?"Copied":"Copy code","aria-label":i?"Copied":"Copy code",children:i?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Copied"]}):n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})}),n.jsx("pre",{className:"bg-gray-900 dark:bg-gray-900 border border-gray-700/40 rounded-lg p-3 overflow-x-auto",children:n.jsx("code",{className:`text-gray-100 dark:text-gray-100 text-sm font-mono ${r||""}`,...s,children:a})})]})},blockquote:({children:e})=>n.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),a:({href:e,children:t})=>n.jsx("a",{href:e,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:t}),p:({children:e})=>n.jsx("div",{className:"mb-2 last:mb-0",children:e}),table:({children:e})=>n.jsx("div",{className:"overflow-x-auto my-2",children:n.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:e})}),thead:({children:e})=>n.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e}),th:({children:e})=>n.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold border border-gray-200 dark:border-gray-700",children:e}),td:({children:e})=>n.jsx("td",{className:"px-3 py-2 align-top text-sm border border-gray-200 dark:border-gray-700",children:e})},Y7=b.memo(({message:e,index:t,prevMessage:r,createDiff:a,onFileOpen:s,onShowSettings:i,autoExpandTools:o,showRawParameters:l,showThinking:c,selectedProject:d})=>{const u=r&&r.type===e.type&&(r.type==="assistant"||r.type==="user"||r.type==="tool"||r.type==="error"),m=Kr.useRef(null),[h,p]=Kr.useState(!1);return Kr.useEffect(()=>{if(!o||!m.current||!e.isToolUse)return;const g=new IntersectionObserver(y=>{y.forEach(v=>{v.isIntersecting&&!h&&(p(!0),m.current.querySelectorAll("details").forEach(S=>{S.open=!0}))})},{threshold:.1});return g.observe(m.current),()=>{m.current&&g.unobserve(m.current)}},[o,h,e.isToolUse]),n.jsx("div",{ref:m,className:`chat-message ${e.type} ${u?"grouped":""} ${e.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:e.type==="user"?n.jsxs("div",{className:"flex items-end space-x-0 sm:space-x-3 w-full sm:w-auto sm:max-w-[85%] md:max-w-md lg:max-w-lg xl:max-w-xl",children:[n.jsxs("div",{className:"bg-blue-600 text-white rounded-2xl rounded-br-md px-3 sm:px-4 py-2 shadow-sm flex-1 sm:flex-initial",children:[n.jsx("div",{className:"text-sm whitespace-pre-wrap break-words",children:e.content}),e.images&&e.images.length>0&&n.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:e.images.map((g,y)=>n.jsx("img",{src:g.data,alt:g.name,className:"rounded-lg max-w-full h-auto cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(g.data,"_blank")},y))}),n.jsx("div",{className:"text-xs text-blue-100 mt-1 text-right",children:new Date(e.timestamp).toLocaleTimeString()})]}),!u&&n.jsx("div",{className:"hidden sm:flex w-8 h-8 bg-blue-600 rounded-full items-center justify-center text-white text-sm flex-shrink-0",children:"U"})]}):n.jsxs("div",{className:"w-full",children:[!u&&n.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.type==="error"?n.jsx("div",{className:"w-8 h-8 bg-red-600 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"!"}):e.type==="tool"?n.jsx("div",{className:"w-8 h-8 bg-gray-600 dark:bg-gray-700 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"🔧"}):n.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?n.jsx(Gr,{className:"w-full h-full"}):(localStorage.getItem("selected-provider")||"claude")==="codex"?n.jsx(an,{className:"w-full h-full"}):n.jsx(Fr,{className:"w-full h-full"})}),n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.type==="error"?"Error":e.type==="tool"?"Tool":(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":(localStorage.getItem("selected-provider")||"claude")==="codex"?"Codex":"Claude"})]}),n.jsxs("div",{className:"w-full",children:[e.isToolUse&&!["Read","TodoWrite","TodoRead"].includes(e.toolName)?["Grep","Glob"].includes(e.toolName)?n.jsx(n.Fragment,{children:n.jsx("div",{className:"group relative bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-blue-400 dark:border-blue-500 pl-3 py-2 my-2",children:n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 flex-1 min-w-0",children:[n.jsx("svg",{className:"w-3.5 h-3.5 text-blue-500 dark:text-blue-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),n.jsx("span",{className:"font-medium flex-shrink-0",children:e.toolName}),n.jsx("span",{className:"text-gray-400 dark:text-gray-500 flex-shrink-0",children:"•"}),e.toolInput&&(()=>{try{const y=JSON.parse(e.toolInput);return n.jsxs("span",{className:"font-mono truncate flex-1 min-w-0",children:[y.pattern&&n.jsxs("span",{children:["pattern: ",n.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:y.pattern})]}),y.path&&n.jsxs("span",{className:"ml-2",children:["in: ",y.path]})]})}catch{return null}})()]}),e.toolResult&&n.jsxs("a",{href:`#tool-result-${e.toolId}`,className:"flex-shrink-0 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors flex items-center gap-1",children:[n.jsx("span",{children:"results"}),n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]})})}):n.jsxs("div",{className:"group relative bg-gradient-to-br from-blue-50/50 to-indigo-50/50 dark:from-blue-950/20 dark:to-indigo-950/20 border border-blue-100/30 dark:border-blue-800/30 rounded-lg p-3 mb-2",children:[n.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-500/3 to-indigo-500/3 dark:from-blue-400/3 dark:to-indigo-400/3 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),n.jsxs("div",{className:"relative flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"relative w-8 h-8 bg-gradient-to-br from-blue-500 to-indigo-600 dark:from-blue-400 dark:to-indigo-500 rounded-lg flex items-center justify-center shadow-lg shadow-blue-500/20 dark:shadow-blue-400/20",children:[n.jsxs("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),n.jsx("div",{className:"absolute inset-0 rounded-lg bg-blue-500 dark:bg-blue-400 animate-pulse opacity-20"})]}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"font-semibold text-gray-900 dark:text-white text-sm",children:e.toolName}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:e.toolId})]})]}),i&&n.jsx("button",{onClick:y=>{y.stopPropagation(),i()},className:"p-2 rounded-lg hover:bg-white/60 dark:hover:bg-gray-800/60 transition-all duration-200 group/btn backdrop-blur-sm",title:"Tool Settings",children:n.jsxs("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-400 group-hover/btn:text-blue-600 dark:group-hover/btn:text-blue-400 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]}),e.toolInput&&e.toolName==="Edit"&&(()=>{try{const y=JSON.parse(e.toolInput);if(y.file_path&&y.old_string&&y.new_string)return n.jsxs("details",{className:"relative mt-3 group/details",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/details:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),n.jsx("span",{className:"flex items-center gap-2",children:n.jsx("span",{children:"View edit diff for"})}),n.jsx("button",{onClick:async v=>{if(v.preventDefault(),v.stopPropagation(),!!s)try{const w=await lt.readFile(d?.name,y.file_path),S=await w.json();if(!w.ok||S.error){console.error("Failed to fetch file:",S.error),s(y.file_path);return}const N=S.content||"",I=N.replace(y.new_string,y.old_string);s(y.file_path,{old_string:I,new_string:N})}catch(w){console.error("Error preparing diff:",w),s(y.file_path)}},className:"px-2.5 py-1 rounded-md bg-white/60 dark:bg-gray-800/60 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 font-mono text-xs font-medium transition-all duration-200 shadow-sm",children:y.file_path.split("/").pop()})]}),n.jsxs("div",{className:"mt-3 pl-6",children:[n.jsxs("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden shadow-sm",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gradient-to-r from-gray-50 to-gray-100/50 dark:from-gray-800/80 dark:to-gray-800/40 border-b border-gray-200/60 dark:border-gray-700/60 backdrop-blur-sm",children:[n.jsx("button",{onClick:async()=>{if(s)try{const v=await lt.readFile(d?.name,y.file_path),w=await v.json();if(!v.ok||w.error){console.error("Failed to fetch file:",w.error),s(y.file_path);return}const S=w.content||"",N=S.replace(y.new_string,y.old_string);s(y.file_path,{old_string:N,new_string:S})}catch(v){console.error("Error preparing diff:",v),s(y.file_path)}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate cursor-pointer font-medium transition-colors",children:y.file_path}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium px-2 py-0.5 bg-gray-100 dark:bg-gray-700/50 rounded",children:"Diff"})]}),n.jsx("div",{className:"text-xs font-mono",children:a(y.old_string,y.new_string).map((v,w)=>n.jsxs("div",{className:"flex",children:[n.jsx("span",{className:`w-8 text-center border-r ${v.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:v.type==="removed"?"-":"+"}),n.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${v.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:v.content})]},w))})]}),l&&n.jsxs("details",{className:"relative mt-3 pl-6 group/raw",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),n.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}return n.jsxs("details",{className:"relative mt-3 group/params",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/params:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View input parameters"]}),n.jsx("pre",{className:"mt-3 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})})(),e.toolInput&&e.toolName!=="Edit"&&(()=>{if(e.toolName==="Write")try{let y;if(typeof e.toolInput=="string"?y=JSON.parse(e.toolInput):y=e.toolInput,y.file_path&&y.content!==void 0)return n.jsxs("details",{className:"relative mt-3 group/details",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/details:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-lg leading-none",children:"📄"}),n.jsx("span",{children:"Creating new file:"})]}),n.jsx("button",{onClick:async v=>{if(v.preventDefault(),v.stopPropagation(),!!s)try{const w=await lt.readFile(d?.name,y.file_path),S=await w.json(),N=w.ok&&!S.error?S.content||"":y.content||"";s(y.file_path,{old_string:"",new_string:N})}catch(w){console.error("Error preparing diff:",w),s(y.file_path,{old_string:"",new_string:y.content||""})}},className:"px-2.5 py-1 rounded-md bg-white/60 dark:bg-gray-800/60 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 font-mono text-xs font-medium transition-all duration-200 shadow-sm",children:y.file_path.split("/").pop()})]}),n.jsxs("div",{className:"mt-3 pl-6",children:[n.jsxs("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden shadow-sm",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gradient-to-r from-gray-50 to-gray-100/50 dark:from-gray-800/80 dark:to-gray-800/40 border-b border-gray-200/60 dark:border-gray-700/60 backdrop-blur-sm",children:[n.jsx("button",{onClick:async()=>{if(s)try{const v=await lt.readFile(d?.name,y.file_path),w=await v.json(),S=v.ok&&!w.error?w.content||"":y.content||"";s(y.file_path,{old_string:"",new_string:S})}catch(v){console.error("Error preparing diff:",v),s(y.file_path,{old_string:"",new_string:y.content||""})}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 truncate cursor-pointer font-medium transition-colors",children:y.file_path}),n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium px-2 py-0.5 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded",children:"New File"})]}),n.jsx("div",{className:"text-xs font-mono",children:a("",y.content).map((v,w)=>n.jsxs("div",{className:"flex",children:[n.jsx("span",{className:`w-8 text-center border-r ${v.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:v.type==="removed"?"-":"+"}),n.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${v.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:v.content})]},w))})]}),l&&n.jsxs("details",{className:"relative mt-3 pl-6 group/raw",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),n.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}if(e.toolName==="TodoWrite")try{const y=JSON.parse(e.toolInput);if(y.todos&&Array.isArray(y.todos))return n.jsxs("details",{className:"relative mt-3 group/todo",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/todo:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-lg leading-none",children:"✓"}),n.jsx("span",{children:"Updating Todo List"})]})]}),n.jsxs("div",{className:"mt-3",children:[n.jsx(Uo,{todos:y.todos}),l&&n.jsxs("details",{className:"relative mt-3 group/raw",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-xs font-medium text-gray-600 dark:text-gray-400 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-3 h-3 transition-transform duration-200 group-open/raw:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View raw parameters"]}),n.jsx("pre",{className:"mt-2 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg overflow-x-auto text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})]})]})}catch{}if(e.toolName==="Bash")try{const y=JSON.parse(e.toolInput);return n.jsxs("div",{className:"my-2",children:[n.jsxs("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-md px-3 py-2 font-mono text-sm",children:[n.jsx("span",{className:"text-green-400",children:"$"}),n.jsx("span",{className:"text-gray-100 ml-2",children:y.command})]}),y.description&&n.jsx("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400 italic ml-1",children:y.description})]})}catch{}if(e.toolName==="Read")try{const y=JSON.parse(e.toolInput);if(y.file_path){const v=y.file_path.split("/").pop();return n.jsxs("div",{className:"mt-2 text-sm text-blue-700 dark:text-blue-300",children:["Read"," ",n.jsx("button",{onClick:()=>s&&s(y.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-mono",children:v})]})}}catch{}if(e.toolName==="exit_plan_mode")try{const y=JSON.parse(e.toolInput);if(y.plan){const v=y.plan.replace(/\\n/g,`
753
+ `);return n.jsxs("details",{className:"mt-2",open:o,children:[n.jsxs("summary",{className:"text-sm text-blue-700 dark:text-blue-300 cursor-pointer hover:text-blue-800 dark:hover:text-blue-200 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"📋 View implementation plan"]}),n.jsx(wa,{className:"mt-3 prose prose-sm max-w-none dark:prose-invert",children:v})]})}}catch{}return n.jsxs("details",{className:"relative mt-3 group/params",open:o,children:[n.jsxs("summary",{className:"flex items-center gap-2 text-sm font-medium text-gray-700 dark:text-gray-300 cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200 p-2.5 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/50",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform duration-200 group-open/params:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View input parameters"]}),n.jsx("pre",{className:"mt-3 text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-3 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-700 dark:text-gray-300 font-mono",children:e.toolInput})]})})(),e.toolResult&&(!e.toolResult.isError&&(e.toolName==="Edit"||e.toolName==="Write"||e.toolName==="ApplyPatch"||e.toolName==="Bash")?null:n.jsxs("div",{id:`tool-result-${e.toolId}`,className:`relative mt-4 p-4 rounded-lg border backdrop-blur-sm scroll-mt-4 ${e.toolResult.isError?"bg-gradient-to-br from-red-50 to-rose-50 dark:from-red-950/20 dark:to-rose-950/20 border-red-200/60 dark:border-red-800/60":"bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-950/20 dark:to-emerald-950/20 border-green-200/60 dark:border-green-800/60"}`,children:[n.jsx("div",{className:`absolute inset-0 rounded-lg opacity-50 ${e.toolResult.isError?"bg-gradient-to-br from-red-500/5 to-rose-500/5 dark:from-red-400/5 dark:to-rose-400/5":"bg-gradient-to-br from-green-500/5 to-emerald-500/5 dark:from-green-400/5 dark:to-emerald-400/5"}`}),n.jsxs("div",{className:"relative flex items-center gap-2.5 mb-3",children:[n.jsx("div",{className:`w-6 h-6 rounded-lg flex items-center justify-center shadow-md ${e.toolResult.isError?"bg-gradient-to-br from-red-500 to-rose-600 dark:from-red-400 dark:to-rose-500 shadow-red-500/20":"bg-gradient-to-br from-green-500 to-emerald-600 dark:from-green-400 dark:to-emerald-500 shadow-green-500/20"}`,children:n.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.toolResult.isError?n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"}):n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})}),n.jsx("span",{className:`text-sm font-semibold ${e.toolResult.isError?"text-red-800 dark:text-red-200":"text-green-800 dark:text-green-200"}`,children:e.toolResult.isError?"Tool Error":"Tool Result"})]}),n.jsx("div",{className:`relative text-sm ${e.toolResult.isError?"text-red-900 dark:text-red-100":"text-green-900 dark:text-green-100"}`,children:(()=>{const v=String(e.toolResult.content||"");if((e.toolName==="TodoWrite"||e.toolName==="TodoRead")&&(v.includes("Todos have been modified successfully")||v.includes("Todo list")||v.startsWith("[")&&v.includes('"content"')&&v.includes('"status"')))try{let N=null;if(v.startsWith("["))N=JSON.parse(v);else if(v.includes("Todos have been modified successfully"))return n.jsx("div",{children:n.jsx("div",{className:"flex items-center gap-2 mb-2",children:n.jsx("span",{className:"font-medium",children:"Todo list has been updated successfully"})})});if(N&&Array.isArray(N))return n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsx("span",{className:"font-medium",children:"Current Todo List"})}),n.jsx(Uo,{todos:N,isResult:!0})]})}catch{}if(e.toolName==="exit_plan_mode")try{const N=JSON.parse(v);if(N.plan){const I=N.plan.replace(/\\n/g,`
754
+ `);return n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsx("span",{className:"font-medium",children:"Implementation Plan"})}),n.jsx(wa,{className:"prose prose-sm max-w-none dark:prose-invert",children:I})]})}}catch{}if((e.toolName==="Grep"||e.toolName==="Glob")&&e.toolResult?.toolUseResult){const N=e.toolResult.toolUseResult;if(N.filenames&&Array.isArray(N.filenames)&&N.filenames.length>0)return n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("span",{className:"font-medium",children:["Found ",N.numFiles||N.filenames.length," ",N.numFiles===1||N.filenames.length===1?"file":"files"]})}),n.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:N.filenames.map((I,F)=>{const E=I.split("/").pop(),R=I.substring(0,I.lastIndexOf("/"));return n.jsxs("div",{onClick:()=>{s&&s(I)},className:"group flex items-center gap-2 px-2 py-1.5 rounded hover:bg-green-100/50 dark:hover:bg-green-800/20 cursor-pointer transition-colors",children:[n.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"font-mono text-sm font-medium text-green-800 dark:text-green-200 truncate group-hover:text-green-900 dark:group-hover:text-green-100",children:E}),n.jsx("div",{className:"font-mono text-xs text-green-600/70 dark:text-green-400/70 truncate",children:R})]}),n.jsx("svg",{className:"w-4 h-4 text-green-600 dark:text-green-400 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]},F)})})]})}if(v.includes("Do you want to proceed?")&&e.toolName==="Bash"){const N=v.split(`
755
+ `),I=N.findIndex(V=>V.includes("Do you want to proceed?")),F=N.slice(0,I).join(`
756
+ `),E=N.slice(I),R=E.find(V=>V.includes("Do you want to proceed?"))||"",H=[];E.forEach(V=>{const T=V.match(/^\s*(\d+)\.\s+(.+)$/);T&&H.push({number:T[1],text:T[2].trim()})});const $=v.match(/>\s*(\d+)/),A=$?$[1]:null;return n.jsxs("div",{className:"space-y-3",children:[F&&n.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:n.jsx("pre",{className:"whitespace-pre-wrap break-words",children:F})}),n.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:n.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-2",children:"Interactive Prompt"}),n.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:R}),n.jsx("div",{className:"space-y-2 mb-4",children:H.map(V=>n.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${A===V.number?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700 hover:border-amber-400 dark:hover:border-amber-600 hover:shadow-sm"} ${A?"cursor-default":"cursor-not-allowed opacity-75"}`,disabled:!0,children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${A===V.number?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:V.number}),n.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:V.text}),A===V.number&&n.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]})},V.number))}),A&&n.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[n.jsxs("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:["✓ Claude selected option ",A]}),n.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"In the CLI, you would select this option interactively using arrow keys or by typing the number."})]})]})]})})]})}const w=v.match(/The file (.+?) has been updated\./);if(w)return n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center gap-2 mb-2",children:n.jsx("span",{className:"font-medium",children:"File updated successfully"})}),n.jsx("button",{onClick:async()=>{if(s)try{const I=await(await je(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(w[1])}`)).json();!I.error&&I.oldContent!==void 0&&I.currentContent!==void 0?s(w[1],{old_string:I.oldContent||"",new_string:I.currentContent||""}):s(w[1])}catch(N){console.error("Error fetching file diff:",N),s(w[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:w[1]})]});const S=v.match(/(?:The file|File) (.+?) has been (?:created|written)(?: successfully)?\.?/);return S?n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center gap-2 mb-2",children:n.jsx("span",{className:"font-medium",children:"File created successfully"})}),n.jsx("button",{onClick:async()=>{if(s)try{const I=await(await je(`/api/git/file-with-diff?project=${encodeURIComponent(d?.name)}&file=${encodeURIComponent(S[1])}`)).json();!I.error&&I.oldContent!==void 0&&I.currentContent!==void 0?s(S[1],{old_string:I.oldContent||"",new_string:I.currentContent||""}):s(S[1])}catch(N){console.error("Error fetching file diff:",N),s(S[1])}},className:"text-xs font-mono bg-green-100 dark:bg-green-800/30 px-2 py-1 rounded text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline cursor-pointer",children:S[1]})]}):e.toolName==="Write"&&!e.toolResult.isError?n.jsxs("div",{className:"text-green-700 dark:text-green-300",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsx("span",{className:"font-medium",children:"File written successfully"})]}),n.jsx("p",{className:"text-xs mt-1 text-green-600 dark:text-green-400",children:"The file content is displayed in the diff view above"})]}):v.includes("cat -n")&&v.includes("→")?n.jsxs("details",{open:o,children:[n.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View file content"]}),n.jsx("div",{className:"mt-2 bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:n.jsx("div",{className:"text-xs font-mono p-3 whitespace-pre-wrap break-words overflow-hidden",children:v})})]}):v.length>300?n.jsxs("details",{open:o,children:[n.jsxs("summary",{className:"text-sm text-green-700 dark:text-green-300 cursor-pointer hover:text-green-800 dark:hover:text-green-200 mb-2 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 transition-transform details-chevron",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"View full output (",v.length," chars)"]}),n.jsx(wa,{className:"mt-2 prose prose-sm max-w-none prose-green dark:prose-invert",children:v})]}):n.jsx(wa,{className:"prose prose-sm max-w-none prose-green dark:prose-invert",children:v})})()})]}))]}):e.isInteractivePrompt?n.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:n.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-3",children:"Interactive Prompt"}),(()=>{const g=e.content.split(`
757
+ `).filter(w=>w.trim()),y=g.find(w=>w.includes("?"))||g[0]||"",v=[];return g.forEach(w=>{const S=w.match(/[❯\s]*(\d+)\.\s+(.+)/);if(S){const N=w.includes("❯");v.push({number:S[1],text:S[2].trim(),isSelected:N})}}),n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:y}),n.jsx("div",{className:"space-y-2 mb-4",children:v.map(w=>n.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${w.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${w.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:w.number}),n.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:w.text}),w.isSelected&&n.jsx("span",{className:"text-lg",children:"❯"})]})},w.number))}),n.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[n.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"⏳ Waiting for your response in the CLI"}),n.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"Please select an option in your terminal where Claude is running."})]})]})})()]})]})}):e.isToolUse&&e.toolName==="Read"?(()=>{try{const g=JSON.parse(e.toolInput);if(g.file_path){const y=g.file_path.split("/").pop();return n.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[n.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),n.jsx("span",{className:"font-medium",children:"Read"}),n.jsx("button",{onClick:()=>s&&s(g.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-mono transition-colors",children:y})]})})}}catch{return n.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[n.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),n.jsx("span",{className:"font-medium",children:"Read file"})]})})}})():e.isToolUse&&e.toolName==="TodoWrite"?(()=>{try{const g=JSON.parse(e.toolInput);if(g.todos&&Array.isArray(g.todos))return n.jsxs("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400 mb-2",children:[n.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),n.jsx("span",{className:"font-medium",children:"Update todo list"})]}),n.jsx(Uo,{todos:g.todos})]})}catch{return n.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[n.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),n.jsx("span",{className:"font-medium",children:"Update todo list"})]})})}})():e.isToolUse&&e.toolName==="TodoRead"?n.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[n.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),n.jsx("span",{className:"font-medium",children:"Read todo list"})]})}):e.isThinking?n.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:n.jsxs("details",{className:"group",children:[n.jsxs("summary",{className:"cursor-pointer text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 font-medium flex items-center gap-2",children:[n.jsx("svg",{className:"w-3 h-3 transition-transform group-open:rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),n.jsx("span",{children:"💭 Thinking..."})]}),n.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 text-sm",children:n.jsx(wa,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:e.content})})]})}):n.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:[c&&e.reasoning&&n.jsxs("details",{className:"mb-3",children:[n.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 font-medium",children:"💭 Thinking..."}),n.jsx("div",{className:"mt-2 pl-4 border-l-2 border-gray-300 dark:border-gray-600 italic text-gray-600 dark:text-gray-400 text-sm",children:n.jsx("div",{className:"whitespace-pre-wrap",children:e.reasoning})})]}),(()=>{const g=Bl(String(e.content||"")),y=g.trim();if((y.startsWith("{")||y.startsWith("["))&&(y.endsWith("}")||y.endsWith("]")))try{const v=JSON.parse(y),w=JSON.stringify(v,null,2);return n.jsxs("div",{className:"my-2",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),n.jsx("span",{className:"font-medium",children:"JSON Response"})]}),n.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:n.jsx("pre",{className:"p-4 overflow-x-auto",children:n.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:w})})})]})}catch{}return e.type==="assistant"?n.jsx(wa,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:g}):n.jsx("div",{className:"whitespace-pre-wrap",children:g})})()]}),n.jsx("div",{className:`text-xs text-gray-500 dark:text-gray-400 mt-1 ${u?"opacity-0 group-hover:opacity-100":""}`,children:new Date(e.timestamp).toLocaleTimeString()})]})]})})}),X7=({file:e,onRemove:t,uploadProgress:r,error:a})=>{const[s,i]=b.useState(null);return b.useEffect(()=>{const o=URL.createObjectURL(e);return i(o),()=>URL.revokeObjectURL(o)},[e]),n.jsxs("div",{className:"relative group",children:[n.jsx("img",{src:s,alt:e.name,className:"w-20 h-20 object-cover rounded"}),r!==void 0&&r<100&&n.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:n.jsxs("div",{className:"text-white text-xs",children:[r,"%"]})}),a&&n.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:n.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),n.jsx("button",{onClick:t,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function Q7({selectedProject:e,selectedSession:t,ws:r,sendMessage:a,messages:s,onFileOpen:i,onInputFocusChange:o,onSessionActive:l,onSessionInactive:c,onSessionProcessing:d,onSessionNotProcessing:u,processingSessions:m,onReplaceTemporarySession:h,onNavigateToSession:p,onShowSettings:g,autoExpandTools:y,showRawParameters:v,showThinking:w,autoScrollToBottom:S,sendByCtrlEnter:N,externalMessageUpdate:I,onTaskClick:F,onShowAllTasks:E}){const{tasksEnabled:R,isTaskMasterInstalled:H}=Cs(),[$,A]=b.useState(()=>typeof window<"u"&&e&&gr.getItem(`draft_input_${e.name}`)||""),[V,T]=b.useState(()=>{if(typeof window<"u"&&e){const z=gr.getItem(`chat_messages_${e.name}`);return z?JSON.parse(z):[]}return[]}),[U,P]=b.useState(!1),[_,se]=b.useState(t?.id||null),[de,J]=b.useState(!1),[X,j]=b.useState([]),[ne,ue]=b.useState(!1),[M,ie]=b.useState(!1),[Me,Se]=b.useState(0),[me,_e]=b.useState(!1),[ce,ve]=b.useState(0),He=20,[Le,rt]=b.useState(!1),[Ye,yt]=b.useState("default"),[mt,vt]=b.useState([]),[ft,Ue]=b.useState(new Map),[bt,kt]=b.useState(new Map),Vt=b.useRef(null),Ve=b.useRef(null),we=b.useRef(null),Ae=b.useRef(null),q=b.useRef(!1),G=b.useRef(""),be=b.useRef(null),Pe=b.useRef(null),[st,he]=b.useState(""),[B,ee]=b.useState(!1),[ge,Ne]=b.useState([]),[Z,Ce]=b.useState([]),[Ze,Ct]=b.useState(-1),[At,Zt]=b.useState(0),[Xr,Qr]=b.useState(-1),[Dn,er]=b.useState(!1),[fr,sr]=b.useState(!1),Pt=b.useRef({height:0,top:0}),[qr,lr]=b.useState(!1),[Gt,Q]=b.useState([]),[le,Je]=b.useState([]),[St,Wt]=b.useState(""),[nr,Nr]=b.useState(!1),[ga,pn]=b.useState(null),[Ua,Hr]=b.useState(-1),[Ls,zr]=b.useState(-1),[Zr,Ps]=b.useState(100),[Ji,fn]=b.useState(null),[wt,Jn]=b.useState(()=>localStorage.getItem("selected-provider")||"claude"),[gn,Va]=b.useState(()=>localStorage.getItem("cursor-model")||"gpt-5"),[Yn,Yi]=b.useState(()=>localStorage.getItem("claude-model")||"sonnet"),[xa,Xi]=b.useState(()=>localStorage.getItem("codex-model")||"gpt-5.2");b.useEffect(()=>{if(t?.id){const z=localStorage.getItem(`permissionMode-${t.id}`);yt(z||"default")}},[t?.id]),b.useEffect(()=>{t&&t.__provider&&t.__provider!==wt&&(Jn(t.__provider),localStorage.setItem("selected-provider",t.__provider))},[t]),b.useEffect(()=>{wt==="cursor"&&je("/api/cursor/config").then(z=>z.json()).then(z=>{if(z.success&&z.config?.model?.modelId){const re={"gpt-5":"gpt-5","claude-4-sonnet":"sonnet-4","sonnet-4":"sonnet-4","claude-4-opus":"opus-4.1","opus-4.1":"opus-4.1"}[z.config.model.modelId]||z.config.model.modelId;localStorage.getItem("cursor-model")||Va(re)}}).catch(z=>console.error("Error loading Cursor config:",z))},[wt]),b.useEffect(()=>{(async()=>{if(e)try{const te=await je("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.path})});if(!te.ok)throw new Error("Failed to fetch commands");const re=await te.json(),Y=[...(re.builtIn||[]).map(Xe=>({...Xe,type:"built-in"})),...(re.custom||[]).map(Xe=>({...Xe,type:"custom"}))];Q(Y);const oe=`command_history_${e.name}`,Fe=gr.getItem(oe);if(Fe)try{const Xe=JSON.parse(Fe),ot=Y.sort((De,ut)=>{const Dt=Xe[De.name]||0;return(Xe[ut.name]||0)-Dt});Q(ot)}catch(Xe){console.error("Error parsing command history:",Xe)}}catch(te){console.error("Error fetching slash commands:",te),Q([])}})()},[e]);const Ga=b.useMemo(()=>Gt.length?new Wa(Gt,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[Gt]);b.useEffect(()=>{if(!St){Je(Gt);return}if(!Ga){Je([]);return}const z=Ga.search(St);Je(z.map(te=>te.item))},[St,Gt,Ga]);const Xn=b.useMemo(()=>{if(!e||Gt.length===0)return[];const z=`command_history_${e.name}`,te=gr.getItem(z);if(!te)return[];try{const re=JSON.parse(te);return Gt.map(oe=>({...oe,usageCount:re[oe.name]||0})).filter(oe=>oe.usageCount>0).sort((oe,Fe)=>Fe.usageCount-oe.usageCount).slice(0,5)}catch(re){return console.error("Error parsing command history:",re),[]}},[e,Gt]),Rs=b.useCallback((z,te,re)=>{if(!z||!e)return;if(re){Hr(te);return}const Y=`command_history_${e.name}`,oe=gr.getItem(Y);let Fe={};try{Fe=oe?JSON.parse(oe):{}}catch(Xe){console.error("Error parsing command history:",Xe)}Fe[z.name]=(Fe[z.name]||0)+1,gr.setItem(Y,JSON.stringify(Fe)),Fs(z)},[e]),Qi=b.useCallback(z=>{const{action:te,data:re}=z;switch(te){case"clear":T([]),j([]);break;case"help":T(Y=>[...Y,{role:"assistant",content:re.content,timestamp:Date.now()}]);break;case"model":T(Y=>[...Y,{role:"assistant",content:`**Current Model**: ${re.current.model}
758
+
759
+ **Available Models**:
760
+
761
+ Claude: ${re.available.claude.join(", ")}
762
+
763
+ Cursor: ${re.available.cursor.join(", ")}`,timestamp:Date.now()}]);break;case"cost":{const Y=`**Token Usage**: ${re.tokenUsage.used.toLocaleString()} / ${re.tokenUsage.total.toLocaleString()} (${re.tokenUsage.percentage}%)
764
+
765
+ **Estimated Cost**:
766
+ - Input: $${re.cost.input}
767
+ - Output: $${re.cost.output}
768
+ - **Total**: $${re.cost.total}
769
+
770
+ **Model**: ${re.model}`;T(oe=>[...oe,{role:"assistant",content:Y,timestamp:Date.now()}]);break}case"status":{const Y=`**System Status**
771
+
772
+ - Version: ${re.version}
773
+ - Uptime: ${re.uptime}
774
+ - Model: ${re.model}
775
+ - Provider: ${re.provider}
776
+ - Node.js: ${re.nodeVersion}
777
+ - Platform: ${re.platform}`;T(oe=>[...oe,{role:"assistant",content:Y,timestamp:Date.now()}]);break}case"memory":re.error?T(Y=>[...Y,{role:"assistant",content:`⚠️ ${re.message}`,timestamp:Date.now()}]):(T(Y=>[...Y,{role:"assistant",content:`📝 ${re.message}
778
+
779
+ Path: \`${re.path}\``,timestamp:Date.now()}]),re.exists&&i&&i(re.path));break;case"config":g&&g();break;case"rewind":re.error?T(Y=>[...Y,{role:"assistant",content:`⚠️ ${re.message}`,timestamp:Date.now()}]):(T(Y=>Y.slice(0,-re.steps*2)),T(Y=>[...Y,{role:"assistant",content:`⏪ ${re.message}`,timestamp:Date.now()}]));break;default:console.warn("Unknown built-in command action:",te)}},[i,g]),Ka=b.useRef(null),Zi=b.useCallback(async(z,te)=>{const{content:re,hasBashCommands:Y,hasFileIncludes:oe}=z;if(Y&&!window.confirm("This command contains bash commands that will be executed. Do you want to proceed?")){T(Xe=>[...Xe,{role:"assistant",content:"❌ Command execution cancelled",timestamp:Date.now()}]);return}A(re),setTimeout(()=>{if(Ka.current){const Fe={preventDefault:()=>{}};Ka.current(Fe)}},50)},[]),Fs=b.useCallback(async z=>{if(!(!z||!e))try{const te=$.match(new RegExp(`${z.name}\\s*(.*)`)),re=te&&te[1]?te[1].trim().split(/\s+/):[],Y={projectPath:e.path,projectName:e.name,sessionId:_,provider:wt,model:wt==="cursor"?gn:Yn,tokenUsage:ga},oe=await je("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandName:z.name,commandPath:z.path,args:re,context:Y})});if(!oe.ok)throw new Error("Failed to execute command");const Fe=await oe.json();Fe.type==="builtin"?Qi(Fe):Fe.type==="custom"&&await Zi(Fe,re),A(""),lr(!1),zr(-1),Wt(""),Hr(-1)}catch(te){console.error("Error executing command:",te),T(re=>[...re,{role:"assistant",content:`Error executing command: ${te.message}`,timestamp:Date.now()}])}},[$,e,_,wt,gn,ga]),Qn=b.useMemo(()=>{const z=new Map;return(te,re)=>{const Y=`${te.length}-${re.length}-${te.slice(0,50)}`;if(z.has(Y))return z.get(Y);const oe=Ee(te,re);if(z.set(Y,oe),z.size>100){const Fe=z.keys().next().value;z.delete(Fe)}return oe}},[]),W=b.useCallback(async(z,te,re=!1,Y="claude")=>{if(!z||!te)return[];const oe=!re;oe?ue(!0):ie(!0);try{const Fe=re?Me:0,Xe=await lt.sessionMessages(z,te,He,Fe,Y);if(!Xe.ok)throw new Error("Failed to load session messages");const ot=await Xe.json();if(oe&&ot.tokenUsage&&pn(ot.tokenUsage),ot.hasMore!==void 0)return _e(ot.hasMore),ve(ot.total),Se(Fe+(ot.messages?.length||0)),ot.messages||[];{const De=ot.messages||[];return _e(!1),ve(De.length),De}}catch(Fe){return console.error("Error loading session messages:",Fe),[]}finally{oe?ue(!1):ie(!1)}},[Me]),ae=b.useCallback(async(z,te)=>{if(!z||!te)return[];ue(!0);try{const re=`/api/cursor/sessions/${encodeURIComponent(te)}?projectPath=${encodeURIComponent(z)}`,Y=await je(re);if(!Y.ok)return[];const Fe=(await Y.json())?.session?.messages||[],Xe=[],ot={};for(let De=0;De<Fe.length;De++){const ut=Fe[De],Dt=ut.content;let Rt="",fe="assistant",Ge=null;try{if(Dt?.role&&Dt?.content){if(Dt.role==="system")continue;if(Dt.role==="tool"){if(Array.isArray(Dt.content)){for(const Qe of Dt.content)if(Qe?.type==="tool-result"){let $e=Qe.toolName||"Unknown Tool";$e==="ApplyPatch"&&($e="Edit");const gt=Qe.toolCallId||Dt.id,Ft=Qe.result||"";ot[gt]?ot[gt].toolResult={content:Ft,isError:!1}:Xe.push({type:"assistant",content:"",timestamp:new Date(Date.now()+De*1e3),blobId:ut.id,sequence:ut.sequence,rowid:ut.rowid,isToolUse:!0,toolName:$e,toolId:gt,toolInput:null,toolResult:{content:Ft,isError:!1}})}}continue}else if(fe=Dt.role==="user"?"user":"assistant",Array.isArray(Dt.content)){const Qe=[];for(const $e of Dt.content)if($e?.type==="text"&&$e?.text)Qe.push(tn($e.text));else if($e?.type==="reasoning"&&$e?.text)Ge=tn($e.text);else if($e?.type==="tool-call"){(Qe.length>0||Ge)&&(Xe.push({type:fe,content:Qe.join(`
780
+ `),reasoning:Ge,timestamp:new Date(Date.now()+De*1e3),blobId:ut.id,sequence:ut.sequence,rowid:ut.rowid}),Qe.length=0,Ge=null);let gt=$e.toolName||"Unknown Tool";gt==="ApplyPatch"&&(gt="Edit");const Ft=$e.toolCallId||`tool_${De}`;let Wr=$e.args;if(gt==="Edit"&&$e.args)if($e.args.patch){const Ur=$e.args.patch.split(`
781
+ `);let Ja=[],ro=[],Y0=!1;for(const zn of Ur)zn.startsWith("@@")?Y0=!0:Y0&&(zn.startsWith("-")?Ja.push(zn.substring(1)):zn.startsWith("+")?ro.push(zn.substring(1)):zn.startsWith(" ")&&(Ja.push(zn.substring(1)),ro.push(zn.substring(1))));const $s=$e.args.file_path;Wr={file_path:$s&&!$s.startsWith("/")?`${z}/${$s}`:$s,old_string:Ja.join(`
782
+ `)||$e.args.patch,new_string:ro.join(`
783
+ `)||$e.args.patch}}else Wr=$e.args;else if(gt==="Read"&&$e.args){const Ur=$e.args.path||$e.args.file_path;Wr={file_path:Ur&&!Ur.startsWith("/")?`${z}/${Ur}`:Ur}}else if(gt==="Write"&&$e.args){const Ur=$e.args.path||$e.args.file_path;Wr={file_path:Ur&&!Ur.startsWith("/")?`${z}/${Ur}`:Ur,content:$e.args.contents||$e.args.content}}const J0={type:"assistant",content:"",timestamp:new Date(Date.now()+De*1e3),blobId:ut.id,sequence:ut.sequence,rowid:ut.rowid,isToolUse:!0,toolName:gt,toolId:Ft,toolInput:Wr?JSON.stringify(Wr):null,toolResult:null};Xe.push(J0),ot[Ft]=J0}else if($e?.type==="tool_use"){(Qe.length>0||Ge)&&(Xe.push({type:fe,content:Qe.join(`
784
+ `),reasoning:Ge,timestamp:new Date(Date.now()+De*1e3),blobId:ut.id,sequence:ut.sequence,rowid:ut.rowid}),Qe.length=0,Ge=null);const gt=$e.name||"Unknown Tool",Ft=$e.id||`tool_${De}`,Wr={type:"assistant",content:"",timestamp:new Date(Date.now()+De*1e3),blobId:ut.id,sequence:ut.sequence,rowid:ut.rowid,isToolUse:!0,toolName:gt,toolId:Ft,toolInput:$e.input?JSON.stringify($e.input):null,toolResult:null};Xe.push(Wr),ot[Ft]=Wr}else typeof $e=="string"&&Qe.push($e);Qe.length>0?(Rt=Qe.join(`
785
+ `),Ge&&!Rt&&(Xe.push({type:fe,content:"",reasoning:Ge,timestamp:new Date(Date.now()+De*1e3),blobId:ut.id,sequence:ut.sequence,rowid:ut.rowid}),Rt="")):Rt=""}else typeof Dt.content=="string"&&(Rt=Dt.content)}else if(Dt?.message?.role&&Dt?.message?.content){if(Dt.message.role==="system")continue;fe=Dt.message.role==="user"?"user":"assistant",Array.isArray(Dt.message.content)?Rt=Dt.message.content.map(Qe=>typeof Qe=="string"?Qe:Qe?.text||"").filter(Boolean).join(`
786
+ `):typeof Dt.message.content=="string"&&(Rt=Dt.message.content)}}catch(Qe){console.log("Error parsing blob content:",Qe)}if(Rt&&Rt.trim()){const Qe={type:fe,content:Rt,timestamp:new Date(Date.now()+De*1e3),blobId:ut.id,sequence:ut.sequence,rowid:ut.rowid};Ge&&(Qe.reasoning=Ge),Xe.push(Qe)}}return Xe.sort((De,ut)=>De.sequence!==void 0&&ut.sequence!==void 0?De.sequence-ut.sequence:De.rowid!==void 0&&ut.rowid!==void 0?De.rowid-ut.rowid:new Date(De.timestamp)-new Date(ut.timestamp)),Xe}catch(re){return console.error("Error loading Cursor session messages:",re),[]}finally{ue(!1)}},[]),Ee=(z,te)=>{const re=z.split(`
787
+ `),Y=te.split(`
788
+ `),oe=[];let Fe=0,Xe=0;for(;Fe<re.length||Xe<Y.length;){const ot=re[Fe],De=Y[Xe];Fe>=re.length?(oe.push({type:"added",content:De,lineNum:Xe+1}),Xe++):Xe>=Y.length?(oe.push({type:"removed",content:ot,lineNum:Fe+1}),Fe++):ot===De?(Fe++,Xe++):(oe.push({type:"removed",content:ot,lineNum:Fe+1}),oe.push({type:"added",content:De,lineNum:Xe+1}),Fe++,Xe++)}return oe},it=z=>{const te=[],re=new Map;for(const Y of z)if(Y.message?.role==="user"&&Array.isArray(Y.message?.content))for(const oe of Y.message.content)oe.type==="tool_result"&&re.set(oe.tool_use_id,{content:oe.content,isError:oe.is_error,timestamp:new Date(Y.timestamp||Date.now()),toolUseResult:Y.toolUseResult||null});for(const Y of z)if(Y.message?.role==="user"&&Y.message?.content){let oe="",Fe="user";if(Array.isArray(Y.message.content)){const ot=[];for(const De of Y.message.content)De.type==="text"&&ot.push(tn(De.text));oe=ot.join(`
789
+ `)}else typeof Y.message.content=="string"?oe=tn(Y.message.content):oe=tn(String(Y.message.content));!oe||oe.startsWith("<command-name>")||oe.startsWith("<command-message>")||oe.startsWith("<command-args>")||oe.startsWith("<local-command-stdout>")||oe.startsWith("<system-reminder>")||oe.startsWith("Caveat:")||oe.startsWith("This session is being continued from a previous")||oe.startsWith("[Request interrupted")||(oe=oi(oe),te.push({type:Fe,content:oe,timestamp:Y.timestamp||new Date().toISOString()}))}else if(Y.type==="thinking"&&Y.message?.content)te.push({type:"assistant",content:oi(Y.message.content),timestamp:Y.timestamp||new Date().toISOString(),isThinking:!0});else if(Y.type==="tool_use"&&Y.toolName)te.push({type:"assistant",content:"",timestamp:Y.timestamp||new Date().toISOString(),isToolUse:!0,toolName:Y.toolName,toolInput:Y.toolInput||"",toolCallId:Y.toolCallId});else if(Y.type==="tool_result"){for(let oe=te.length-1;oe>=0;oe--)if(te[oe].isToolUse&&!te[oe].toolResult&&(!Y.toolCallId||te[oe].toolCallId===Y.toolCallId)){te[oe].toolResult={content:Y.output||"",isError:!1};break}}else if(Y.message?.role==="assistant"&&Y.message?.content){if(Array.isArray(Y.message.content)){for(const oe of Y.message.content)if(oe.type==="text"){let Fe=oe.text;typeof Fe=="string"&&(Fe=oi(Fe)),te.push({type:"assistant",content:Fe,timestamp:Y.timestamp||new Date().toISOString()})}else if(oe.type==="tool_use"){const Fe=re.get(oe.id);te.push({type:"assistant",content:"",timestamp:Y.timestamp||new Date().toISOString(),isToolUse:!0,toolName:oe.name,toolInput:JSON.stringify(oe.input),toolResult:Fe?{content:typeof Fe.content=="string"?Fe.content:JSON.stringify(Fe.content),isError:Fe.isError,toolUseResult:Fe.toolUseResult}:null,toolError:Fe?.isError||!1,toolResultTimestamp:Fe?.timestamp||new Date})}}else if(typeof Y.message.content=="string"){let oe=Y.message.content;oe=oi(oe),te.push({type:"assistant",content:oe,timestamp:Y.timestamp||new Date().toISOString()})}}return te},tr=b.useMemo(()=>it(X),[X]),rr=b.useCallback(()=>{Ae.current&&(Ae.current.scrollTop=Ae.current.scrollHeight)},[]),Bs=b.useCallback(()=>{if(!Ae.current)return!1;const{scrollTop:z,scrollHeight:te,clientHeight:re}=Ae.current;return te-z-re<50},[]),eo=b.useCallback(async()=>{if(Ae.current){const z=Ae.current,te=Bs();sr(!te);const re=z.scrollTop<100,Y=localStorage.getItem("selected-provider")||"claude";if(re&&me&&!M&&t&&e&&Y!=="cursor"){const oe=z.scrollHeight,Fe=z.scrollTop,Xe=await W(e.name,t.id,!0,t.__provider||"claude");Xe.length>0&&(j(ot=>[...Xe,...ot]),setTimeout(()=>{if(Ae.current){const De=Ae.current.scrollHeight-oe;Ae.current.scrollTop=Fe+De}},0))}}},[Bs,me,M,t,e,W]);b.useEffect(()=>{(async()=>{if(t&&e){const te=localStorage.getItem("selected-provider")||"claude";if(q.current=!0,_!==null&&_!==t.id?(Se(0),_e(!1),ve(0),pn(null),P(!1),r&&a&&a({type:"check-session-status",sessionId:t.id,provider:te})):_===null&&(Se(0),_e(!1),ve(0),r&&a&&a({type:"check-session-status",sessionId:t.id,provider:te})),te==="cursor")if(se(t.id),sessionStorage.setItem("cursorSessionId",t.id),Le)rt(!1);else{const Y=e.fullPath||e.path,oe=await ae(Y,t.id);j([]),T(oe)}else if(se(t.id),Le)rt(!1);else{const Y=await W(e.name,t.id,!1,t.__provider||"claude");j(Y)}}else!Le&&!U&&(T([]),j([])),se(null),sessionStorage.removeItem("cursorSessionId"),Se(0),_e(!1),ve(0);setTimeout(()=>{q.current=!1},250)})()},[t,e,ae,rr,Le]),b.useEffect(()=>{I>0&&t&&e&&(async()=>{try{if((localStorage.getItem("selected-provider")||"claude")==="cursor"){const re=e.fullPath||e.path,Y=await ae(re,t.id);j([]),T(Y)}else{const re=await W(e.name,t.id,!1,t.__provider||"claude");j(re),Bs&&S&&setTimeout(()=>rr(),200)}}catch(te){console.error("Error reloading messages from external update:",te)}})()},[I,t,e,ae,W,Bs,S,rr]),b.useEffect(()=>{X.length>0&&T(tr)},[tr,X]),b.useEffect(()=>{o&&o(de)},[de,o]),b.useEffect(()=>{e&&$!==""?gr.setItem(`draft_input_${e.name}`,$):e&&$===""&&gr.removeItem(`draft_input_${e.name}`)},[$,e]),b.useEffect(()=>{e&&V.length>0&&gr.setItem(`chat_messages_${e.name}`,JSON.stringify(V))},[V,e]),b.useEffect(()=>{if(e){const z=gr.getItem(`draft_input_${e.name}`)||"";z!==$&&A(z)}},[e?.name]),b.useEffect(()=>{_&&U&&d&&d(_)},[U,_,d]),b.useEffect(()=>{_&&m&&m.has(_)&&!U&&(P(!0),er(!0))},[_,m]),b.useEffect(()=>{if(s.length>0){const z=s[s.length-1];if(!["projects_updated","taskmaster-project-updated","session-created","claude-complete","codex-complete"].includes(z.type)&&z.sessionId&&_&&z.sessionId!==_){console.log("⏭️ Skipping message for different session:",z.sessionId,"current:",_);return}switch(z.type){case"session-created":z.sessionId&&!_&&(sessionStorage.setItem("pendingSessionId",z.sessionId),h&&h(z.sessionId));break;case"token-budget":z.data&&pn(z.data);break;case"claude-response":const Y=z.data.message||z.data;if(Y&&typeof Y=="object"&&Y.type){if(Y.type==="content_block_delta"&&Y.delta?.text){const fe=tn(Y.delta.text);G.current+=fe,be.current||(be.current=setTimeout(()=>{const Ge=G.current;G.current="",be.current=null,Ge&&T(Qe=>{const $e=[...Qe],gt=$e[$e.length-1];return gt&&gt.type==="assistant"&&!gt.isToolUse&&gt.isStreaming?gt.content=(gt.content||"")+Ge:$e.push({type:"assistant",content:Ge,timestamp:new Date,isStreaming:!0}),$e})},100));return}if(Y.type==="content_block_stop"){be.current&&(clearTimeout(be.current),be.current=null);const fe=G.current;G.current="",fe&&T(Ge=>{const Qe=[...Ge],$e=Qe[Qe.length-1];return $e&&$e.type==="assistant"&&!$e.isToolUse&&$e.isStreaming?$e.content=($e.content||"")+fe:Qe.push({type:"assistant",content:fe,timestamp:new Date,isStreaming:!0}),Qe}),T(Ge=>{const Qe=[...Ge],$e=Qe[Qe.length-1];return $e&&$e.type==="assistant"&&$e.isStreaming&&($e.isStreaming=!1),Qe});return}}if(z.data.type==="system"&&z.data.subtype==="init"&&z.data.session_id&&_&&z.data.session_id!==_){console.log("🔄 Claude CLI session duplication detected:",{originalSession:_,newSession:z.data.session_id}),rt(!0),p&&p(z.data.session_id);return}if(z.data.type==="system"&&z.data.subtype==="init"&&z.data.session_id&&!_){console.log("🔄 New session init detected:",{newSession:z.data.session_id}),rt(!0),p&&p(z.data.session_id);return}if(z.data.type==="system"&&z.data.subtype==="init"&&z.data.session_id&&_&&z.data.session_id===_){console.log("🔄 System init message for current session, ignoring");return}if(Array.isArray(Y.content)){for(const fe of Y.content)if(fe.type==="tool_use"){const Ge=fe.input?JSON.stringify(fe.input,null,2):"";T(Qe=>[...Qe,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:fe.name,toolInput:Ge,toolId:fe.id,toolResult:null}])}else if(fe.type==="text"&&fe.text?.trim()){let Ge=tn(fe.text);Ge=Bl(Ge),T(Qe=>[...Qe,{type:"assistant",content:Ge,timestamp:new Date}])}}else if(typeof Y.content=="string"&&Y.content.trim()){let fe=tn(Y.content);fe=Bl(fe),T(Ge=>[...Ge,{type:"assistant",content:fe,timestamp:new Date}])}if(Y.role==="user"&&Array.isArray(Y.content))for(const fe of Y.content)fe.type==="tool_result"&&T(Ge=>Ge.map(Qe=>Qe.isToolUse&&Qe.toolId===fe.tool_use_id?{...Qe,toolResult:{content:fe.content,isError:fe.is_error,timestamp:new Date}}:Qe));break;case"claude-output":{const fe=String(z.data||"");fe.trim()&&(G.current+=G.current?`
790
+ ${fe}`:fe,be.current||(be.current=setTimeout(()=>{const Ge=G.current;G.current="",be.current=null,Ge&&T(Qe=>{const $e=[...Qe],gt=$e[$e.length-1];return gt&&gt.type==="assistant"&&!gt.isToolUse&&gt.isStreaming?gt.content=gt.content?`${gt.content}
791
+ ${Ge}`:Ge:$e.push({type:"assistant",content:Ge,timestamp:new Date,isStreaming:!0}),$e})},100)))}break;case"claude-interactive-prompt":T(fe=>[...fe,{type:"assistant",content:z.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-error":T(fe=>[...fe,{type:"error",content:`Error: ${z.error}`,timestamp:new Date}]);break;case"cursor-system":try{const fe=z.data;if(fe&&fe.type==="system"&&fe.subtype==="init"&&fe.session_id){if(_&&fe.session_id!==_){console.log("🔄 Cursor session switch detected:",{originalSession:_,newSession:fe.session_id}),rt(!0),p&&p(fe.session_id);return}if(!_){console.log("🔄 Cursor new session init detected:",{newSession:fe.session_id}),rt(!0),p&&p(fe.session_id);return}}}catch(fe){console.warn("Error handling cursor-system message:",fe)}break;case"cursor-user":break;case"cursor-tool-use":T(fe=>[...fe,{type:"assistant",content:`Using tool: ${z.tool} ${z.input?`with ${z.input}`:""}`,timestamp:new Date,isToolUse:!0,toolName:z.tool,toolInput:z.input}]);break;case"cursor-error":T(fe=>[...fe,{type:"error",content:`Cursor error: ${z.error||"Unknown error"}`,timestamp:new Date}]);break;case"cursor-result":const oe=z.sessionId||_;if(oe===_&&(P(!1),er(!1),fn(null)),oe&&(c&&c(oe),u&&u(oe)),oe===_)try{const fe=z.data||{},Ge=typeof fe.result=="string"?fe.result:"";be.current&&(clearTimeout(be.current),be.current=null);const Qe=G.current;G.current="",T($e=>{const gt=[...$e],Ft=gt[gt.length-1];if(Ft&&Ft.type==="assistant"&&!Ft.isToolUse&&Ft.isStreaming){const Wr=Ge&&Ge.trim()?Ge:(Ft.content||"")+(Qe||"");Ft.content=Wr,Ft.isStreaming=!1}else Ge&&Ge.trim()&&gt.push({type:fe.is_error?"error":"assistant",content:Ge,timestamp:new Date,isStreaming:!1});return gt})}catch(fe){console.warn("Error handling cursor-result message:",fe)}const Fe=sessionStorage.getItem("pendingSessionId");oe&&!_&&oe===Fe&&(se(oe),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects(),500));break;case"cursor-output":try{const Ge=String(z.data??"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").trim();Ge&&(G.current+=G.current?`
792
+ ${Ge}`:Ge,be.current||(be.current=setTimeout(()=>{const Qe=G.current;G.current="",be.current=null,Qe&&T($e=>{const gt=[...$e],Ft=gt[gt.length-1];return Ft&&Ft.type==="assistant"&&!Ft.isToolUse&&Ft.isStreaming?Ft.content=Ft.content?`${Ft.content}
793
+ ${Qe}`:Qe:gt.push({type:"assistant",content:Qe,timestamp:new Date,isStreaming:!0}),gt})},100)))}catch(fe){console.warn("Error handling cursor-output message:",fe)}break;case"claude-complete":const Xe=z.sessionId||_||sessionStorage.getItem("pendingSessionId");(Xe===_||!_)&&(P(!1),er(!1),fn(null)),Xe&&(c&&c(Xe),u&&u(Xe));const ot=sessionStorage.getItem("pendingSessionId");ot&&!_&&z.exitCode===0&&(se(ot),sessionStorage.removeItem("pendingSessionId"),console.log("✅ New session complete, ID set to:",ot)),e&&z.exitCode===0&&gr.removeItem(`chat_messages_${e.name}`);break;case"codex-response":const De=z.data;if(De){if(De.type==="item")switch(De.itemType){case"agent_message":if(De.message?.content?.trim()){const fe=tn(De.message.content);T(Ge=>[...Ge,{type:"assistant",content:fe,timestamp:new Date}])}break;case"reasoning":if(De.message?.content?.trim()){const fe=tn(De.message.content);T(Ge=>[...Ge,{type:"assistant",content:fe,timestamp:new Date,isThinking:!0}])}break;case"command_execution":De.command&&T(fe=>[...fe,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:"Bash",toolInput:De.command,toolResult:De.output||null,exitCode:De.exitCode}]);break;case"file_change":if(De.changes?.length>0){const fe=De.changes.map(Ge=>`${Ge.kind}: ${Ge.path}`).join(`
794
+ `);T(Ge=>[...Ge,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:"FileChanges",toolInput:fe,toolResult:`Status: ${De.status}`}])}break;case"mcp_tool_call":T(fe=>[...fe,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:`${De.server}:${De.tool}`,toolInput:JSON.stringify(De.arguments,null,2),toolResult:De.result?JSON.stringify(De.result,null,2):De.error?.message||null}]);break;case"error":De.message?.content&&T(fe=>[...fe,{type:"error",content:De.message.content,timestamp:new Date}]);break;default:console.log("[Codex] Unhandled item type:",De.itemType,De)}De.type==="turn_complete"&&P(!1),De.type==="turn_failed"&&(P(!1),T(fe=>[...fe,{type:"error",content:De.error?.message||"Turn failed",timestamp:new Date}]))}break;case"codex-complete":const ut=z.sessionId||_||sessionStorage.getItem("pendingSessionId");(ut===_||!_)&&(P(!1),er(!1),fn(null)),ut&&(c&&c(ut),u&&u(ut));const Dt=sessionStorage.getItem("pendingSessionId");Dt&&!_&&(se(Dt),sessionStorage.removeItem("pendingSessionId"),console.log("Codex session complete, ID set to:",Dt)),e&&gr.removeItem(`chat_messages_${e.name}`);break;case"codex-error":P(!1),er(!1),T(fe=>[...fe,{type:"error",content:z.error||"An error occurred with Codex",timestamp:new Date}]);break;case"session-aborted":{const fe=z.sessionId||_;fe===_&&(P(!1),er(!1),fn(null)),fe&&(c&&c(fe),u&&u(fe)),T(Ge=>[...Ge,{type:"assistant",content:"Session interrupted by user.",timestamp:new Date}]);break}case"session-status":{const fe=z.sessionId;(fe===_||t&&fe===t.id)&&z.isProcessing&&(P(!0),er(!0),d&&d(fe));break}case"claude-status":const Rt=z.data;if(Rt){let fe={text:"Working...",tokens:0,can_interrupt:!0};Rt.message?fe.text=Rt.message:Rt.status?fe.text=Rt.status:typeof Rt=="string"&&(fe.text=Rt),Rt.tokens?fe.tokens=Rt.tokens:Rt.token_count&&(fe.tokens=Rt.token_count),Rt.can_interrupt!==void 0&&(fe.can_interrupt=Rt.can_interrupt),fn(fe),P(!0),er(fe.can_interrupt)}break}}},[s]),b.useEffect(()=>{e&&bf()},[e]);const bf=async()=>{try{const z=await lt.getFiles(e.name);if(z.ok){const te=await z.json(),re=V0(te);Ne(re)}}catch(z){console.error("Error fetching files:",z)}},V0=(z,te="")=>{let re=[];for(const Y of z){const oe=te?`${te}/${Y.name}`:Y.name;Y.type==="directory"&&Y.children?re=re.concat(V0(Y.children,oe)):Y.type==="file"&&re.push({name:Y.name,path:oe,relativePath:Y.path})}return re};b.useEffect(()=>{const z=$.slice(0,At),te=z.lastIndexOf("@");if(te!==-1){const re=z.slice(te+1);if(re.includes(" "))ee(!1),Qr(-1);else{Qr(te),ee(!0);const Y=ge.filter(oe=>oe.name.toLowerCase().includes(re.toLowerCase())||oe.path.toLowerCase().includes(re.toLowerCase())).slice(0,10);Ce(Y),Ct(-1)}}else ee(!1),Qr(-1)},[$,At,ge]),b.useEffect(()=>{const z=setTimeout(()=>{he($)},150);return()=>clearTimeout(z)},[$]);const G0=b.useMemo(()=>V.length<=Zr?V:V.slice(-Zr),[V,Zr]);b.useEffect(()=>{if(!S&&Ae.current){const z=Ae.current;Pt.current={height:z.scrollHeight,top:z.scrollTop}}}),b.useEffect(()=>{if(Ae.current&&V.length>0)if(S)fr||setTimeout(()=>rr(),50);else{const z=Ae.current,te=Pt.current.height,re=Pt.current.top,oe=z.scrollHeight-te;oe>0&&re>0&&(z.scrollTop=re+oe)}},[V.length,fr,rr,S]),b.useEffect(()=>{Ae.current&&V.length>0&&!q.current&&(sr(!1),setTimeout(()=>{rr()},200))},[t?.id,e?.name]),b.useEffect(()=>{const z=Ae.current;if(z)return z.addEventListener("scroll",eo),()=>z.removeEventListener("scroll",eo)},[eo]),b.useEffect(()=>{if(Ve.current){Ve.current.style.height="auto",Ve.current.style.height=Ve.current.scrollHeight+"px";const z=parseInt(window.getComputedStyle(Ve.current).lineHeight),te=Ve.current.scrollHeight>z*2;Nr(te)}},[]),b.useEffect(()=>{Ve.current&&!$.trim()&&(Ve.current.style.height="auto",Nr(!1))},[$]),b.useEffect(()=>{if(!e||!t?.id||t.id.startsWith("new-session-")){pn(null);return}if((t.__provider||"claude")!=="claude")return;(async()=>{try{const re=`/api/projects/${e.name}/sessions/${t.id}/token-usage`,Y=await je(re);if(Y.ok){const oe=await Y.json();pn(oe)}else pn(null)}catch(re){console.error("Failed to fetch initial token usage:",re)}})()},[t?.id,t?.__provider,e?.path]);const yf=b.useCallback(z=>{z.trim()&&A(te=>{const re=te.trim()?`${te} ${z}`:z;return setTimeout(()=>{if(Ve.current){Ve.current.style.height="auto",Ve.current.style.height=Ve.current.scrollHeight+"px";const Y=parseInt(window.getComputedStyle(Ve.current).lineHeight),oe=Ve.current.scrollHeight>Y*2;Nr(oe)}},0),re})},[]),vf=b.useCallback(()=>{Ps(z=>z+100)},[]),Os=b.useCallback(z=>{const te=z.filter(re=>{try{if(!re||typeof re!="object")return console.warn("Invalid file object:",re),!1;if(!re.type||!re.type.startsWith("image/"))return!1;if(!re.size||re.size>5242880){const Y=re.name||"Unknown file";return kt(oe=>{const Fe=new Map(oe);return Fe.set(Y,"File too large (max 5MB)"),Fe}),!1}return!0}catch(Y){return console.error("Error validating file:",Y,re),!1}});te.length>0&&vt(re=>[...re,...te].slice(0,5))},[]),kf=b.useCallback(async z=>{const te=Array.from(z.clipboardData.items);for(const re of te)if(re.type.startsWith("image/")){const Y=re.getAsFile();Y&&Os([Y])}if(te.length===0&&z.clipboardData.files.length>0){const Y=Array.from(z.clipboardData.files).filter(oe=>oe.type.startsWith("image/"));Y.length>0&&Os(Y)}},[Os]),{getRootProps:wf,getInputProps:jf,isDragActive:Nf,open:Sf}=Fp({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:Os,noClick:!0,noKeyboard:!0}),Zn=b.useCallback(async z=>{if(z.preventDefault(),!$.trim()||U||!e)return;let te=[];if(mt.length>0){const ot=new FormData;mt.forEach(De=>{ot.append("images",De)});try{const De=await je(`/api/projects/${e.name}/upload-images`,{method:"POST",headers:{},body:ot});if(!De.ok)throw new Error("Failed to upload images");te=(await De.json()).images}catch(De){console.error("Image upload failed:",De),T(ut=>[...ut,{type:"error",content:`Failed to upload images: ${De.message}`,timestamp:new Date}]);return}}const re={type:"user",content:$,images:te,timestamp:new Date};T(ot=>[...ot,re]),P(!0),er(!0),fn({text:"Processing",tokens:0,can_interrupt:!0}),sr(!1),setTimeout(()=>rr(),100);const Y=_||t?.id||sessionStorage.getItem("cursorSessionId"),oe=Y||`new-session-${Date.now()}`;l&&l(oe);const Xe=(()=>{try{const ot=wt==="cursor"?"cursor-tools-settings":wt==="codex"?"codex-settings":"claude-settings",De=gr.getItem(ot);if(De)return JSON.parse(De)}catch(ot){console.error("Error loading tools settings:",ot)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();a(wt==="cursor"?{type:"cursor-command",command:$,sessionId:Y,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:Y,resume:!!Y,model:gn,skipPermissions:Xe?.skipPermissions||!1,toolsSettings:Xe}}:wt==="codex"?{type:"codex-command",command:$,sessionId:Y,options:{cwd:e.fullPath||e.path,projectPath:e.fullPath||e.path,sessionId:Y,resume:!!Y,model:xa,permissionMode:Ye==="plan"?"default":Ye}}:{type:"claude-command",command:$,options:{projectPath:e.path,cwd:e.fullPath,sessionId:_,resume:!!_,toolsSettings:Xe,permissionMode:Ye,model:Yn,images:te}}),A(""),vt([]),Ue(new Map),kt(new Map),Nr(!1),Ve.current&&(Ve.current.style.height="auto"),e&&gr.removeItem(`draft_input_${e.name}`)},[$,U,e,mt,_,t,wt,Ye,l,gn,Yn,xa,a,A,vt,Ue,kt,Nr,Ve,T,P,er,fn,sr,rr]);b.useEffect(()=>{Ka.current=Zn},[Zn]);const K0=z=>{if(!z)return;const te=$.slice(0,Ls),re=$.slice(Ls),Y=re.indexOf(" "),oe=Y!==-1?re.slice(Y):"",Fe=te+z.name+" "+oe;A(Fe),lr(!1),zr(-1),Wt(""),Hr(-1),Pe.current&&clearTimeout(Pe.current),Fs(z)},Cf=z=>{if(qr&&le.length>0){if(z.key==="ArrowDown"){z.preventDefault(),Hr(te=>te<le.length-1?te+1:0);return}if(z.key==="ArrowUp"){z.preventDefault(),Hr(te=>te>0?te-1:le.length-1);return}if(z.key==="Tab"||z.key==="Enter"){z.preventDefault(),Ua>=0?K0(le[Ua]):le.length>0&&K0(le[0]);return}if(z.key==="Escape"){z.preventDefault(),lr(!1),zr(-1),Wt(""),Hr(-1),Pe.current&&clearTimeout(Pe.current);return}}if(B&&Z.length>0){if(z.key==="ArrowDown"){z.preventDefault(),Ct(te=>te<Z.length-1?te+1:0);return}if(z.key==="ArrowUp"){z.preventDefault(),Ct(te=>te>0?te-1:Z.length-1);return}if(z.key==="Tab"||z.key==="Enter"){z.preventDefault(),Ze>=0?to(Z[Ze]):Z.length>0&&to(Z[0]);return}if(z.key==="Escape"){z.preventDefault(),ee(!1);return}}if(z.key==="Tab"&&!B&&!qr){z.preventDefault();const te=wt==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],Y=(te.indexOf(Ye)+1)%te.length,oe=te[Y];yt(oe),t?.id&&localStorage.setItem(`permissionMode-${t.id}`,oe);return}if(z.key==="Enter"){if(z.nativeEvent.isComposing)return;(z.ctrlKey||z.metaKey)&&!z.shiftKey?(z.preventDefault(),Zn(z)):!z.shiftKey&&!z.ctrlKey&&!z.metaKey&&(N||(z.preventDefault(),Zn(z)))}},to=z=>{const te=$.slice(0,Xr),re=$.slice(Xr),Y=re.indexOf(" "),oe=Y!==-1?re.slice(Y):"",Fe=te+"@"+z.path+" "+oe,Xe=te.length+1+z.path.length+1;Ve.current&&!Ve.current.matches(":focus")&&Ve.current.focus(),A(Fe),Zt(Xe),ee(!1),Qr(-1),Ve.current&&requestAnimationFrame(()=>{Ve.current&&(Ve.current.setSelectionRange(Xe,Xe),Ve.current.matches(":focus")||Ve.current.focus())})},Mf=z=>{const te=z.target.value,re=z.target.selectionStart;if(!_&&te.trim(),A(te),Zt(re),!te.trim()){z.target.style.height="auto",Nr(!1),lr(!1),zr(-1),Wt("");return}const Y=te.slice(0,re);if((Y.match(/```/g)||[]).length%2===1){lr(!1),zr(-1),Wt("");return}const Xe=/(^|\s)\/(\S*)$/,ot=Y.match(Xe);if(ot){const De=ot.index+ot[1].length,ut=ot[2];zr(De),lr(!0),Hr(-1),Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(()=>{Wt(ut)},150)}else lr(!1),zr(-1),Wt(""),Pe.current&&clearTimeout(Pe.current)},Af=z=>{Zt(z.target.selectionStart)},Tf=()=>{_&&Dn&&a({type:"abort-session",sessionId:_,provider:wt})},Ef=()=>{const z=wt==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],re=(z.indexOf(Ye)+1)%z.length,Y=z[re];yt(Y),t?.id&&localStorage.setItem(`permissionMode-${t.id}`,Y)};return e?n.jsxs(n.Fragment,{children:[n.jsx("style",{children:`
795
+ details[open] .details-chevron {
796
+ transform: rotate(180deg);
797
+ }
798
+ `}),n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsxs("div",{ref:Ae,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[ne&&V.length===0?n.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:n.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[n.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),n.jsx("p",{children:"Loading session messages..."})]})}):V.length===0?n.jsxs("div",{className:"flex items-center justify-center h-full",children:[!t&&!_&&n.jsxs("div",{className:"text-center px-6 sm:px-4 py-8",children:[n.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:"Choose Your AI Assistant"}),n.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:"Select a provider to start a new conversation"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center mb-8",children:[n.jsxs("button",{onClick:()=>{Jn("claude"),localStorage.setItem("selected-provider","claude"),setTimeout(()=>Ve.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${wt==="claude"?"border-blue-500 shadow-lg ring-2 ring-blue-500/20":"border-gray-200 dark:border-gray-700 hover:border-blue-400"}`,children:[n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[n.jsx(Fr,{className:"w-10 h-10"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Claude"}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"by Anthropic"})]})]}),wt==="claude"&&n.jsx("div",{className:"absolute top-2 right-2",children:n.jsx("div",{className:"w-5 h-5 bg-blue-500 rounded-full flex items-center justify-center",children:n.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),n.jsxs("button",{onClick:()=>{Jn("cursor"),localStorage.setItem("selected-provider","cursor"),setTimeout(()=>Ve.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${wt==="cursor"?"border-purple-500 shadow-lg ring-2 ring-purple-500/20":"border-gray-200 dark:border-gray-700 hover:border-purple-400"}`,children:[n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[n.jsx(Gr,{className:"w-10 h-10"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Cursor"}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"AI Code Editor"})]})]}),wt==="cursor"&&n.jsx("div",{className:"absolute top-2 right-2",children:n.jsx("div",{className:"w-5 h-5 bg-purple-500 rounded-full flex items-center justify-center",children:n.jsx("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]}),n.jsxs("button",{onClick:()=>{Jn("codex"),localStorage.setItem("selected-provider","codex"),setTimeout(()=>Ve.current?.focus(),100)},className:`group relative w-64 h-32 bg-white dark:bg-gray-800 rounded-xl border-2 transition-all duration-200 hover:scale-105 hover:shadow-xl ${wt==="codex"?"border-gray-800 dark:border-gray-300 shadow-lg ring-2 ring-gray-800/20 dark:ring-gray-300/20":"border-gray-200 dark:border-gray-700 hover:border-gray-500 dark:hover:border-gray-400"}`,children:[n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[n.jsx(an,{className:"w-10 h-10"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-semibold text-gray-900 dark:text-white",children:"Codex"}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"by OpenAI"})]})]}),wt==="codex"&&n.jsx("div",{className:"absolute top-2 right-2",children:n.jsx("div",{className:"w-5 h-5 bg-gray-800 dark:bg-gray-300 rounded-full flex items-center justify-center",children:n.jsx("svg",{className:"w-3 h-3 text-white dark:text-gray-800",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})})]})]}),n.jsxs("div",{className:`mb-6 transition-opacity duration-200 ${wt?"opacity-100":"opacity-0 pointer-events-none"}`,children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Select Model"}),wt==="claude"?n.jsxs("select",{value:Yn,onChange:z=>{const te=z.target.value;Yi(te),localStorage.setItem("claude-model",te)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",children:[n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"haiku",children:"Haiku"}),n.jsx("option",{value:"opusplan",children:"Opus Plan"}),n.jsx("option",{value:"sonnet[1m]",children:"Sonnet [1M]"})]}):wt==="codex"?n.jsxs("select",{value:xa,onChange:z=>{const te=z.target.value;Xi(te),localStorage.setItem("codex-model",te)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-gray-500 focus:border-gray-500 min-w-[140px]",children:[n.jsx("option",{value:"gpt-5.2",children:"GPT-5.2"}),n.jsx("option",{value:"gpt-5.1-codex-max",children:"GPT-5.1 Codex Max"}),n.jsx("option",{value:"o3",children:"O3"}),n.jsx("option",{value:"o4-mini",children:"O4-mini"})]}):n.jsxs("select",{value:gn,onChange:z=>{const te=z.target.value;Va(te),localStorage.setItem("cursor-model",te)},className:"pl-4 pr-10 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 min-w-[140px]",disabled:wt!=="cursor",children:[n.jsx("option",{value:"gpt-5.2-high",children:"GPT-5.2 High"}),n.jsx("option",{value:"gemini-3-pro",children:"Gemini 3 Pro"}),n.jsx("option",{value:"opus-4.5-thinking",children:"Claude 4.5 Opus (Thinking)"}),n.jsx("option",{value:"gpt-5.2",children:"GPT-5.2"}),n.jsx("option",{value:"gpt-5.1",children:"GPT-5.1"}),n.jsx("option",{value:"gpt-5.1-high",children:"GPT-5.1 High"}),n.jsx("option",{value:"composer-1",children:"Composer 1"}),n.jsx("option",{value:"auto",children:"Auto"}),n.jsx("option",{value:"sonnet-4.5",children:"Claude 4.5 Sonnet"}),n.jsx("option",{value:"sonnet-4.5-thinking",children:"Claude 4.5 Sonnet (Thinking)"}),n.jsx("option",{value:"opus-4.5",children:"Claude 4.5 Opus"}),n.jsx("option",{value:"gpt-5.1-codex",children:"GPT-5.1 Codex"}),n.jsx("option",{value:"gpt-5.1-codex-high",children:"GPT-5.1 Codex High"}),n.jsx("option",{value:"gpt-5.1-codex-max",children:"GPT-5.1 Codex Max"}),n.jsx("option",{value:"gpt-5.1-codex-max-high",children:"GPT-5.1 Codex Max High"}),n.jsx("option",{value:"opus-4.1",children:"Claude 4.1 Opus"}),n.jsx("option",{value:"grok",children:"Grok"})]})]}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:wt==="claude"?`Ready to use Claude with ${Yn}. Start typing your message below.`:wt==="cursor"?`Ready to use Cursor with ${gn}. Start typing your message below.`:wt==="codex"?`Ready to use Codex with ${xa}. Start typing your message below.`:"Select a provider above to begin"}),wt&&R&&H&&n.jsx("div",{className:"mt-4 px-4 sm:px-0",children:n.jsx(du,{onStartTask:()=>A("Start the next task"),onShowAllTasks:E})})]}),t&&n.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[n.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:"Continue your conversation"}),n.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:"Ask questions about your code, request changes, or get help with development tasks"}),R&&H&&n.jsx("div",{className:"mt-4 px-4 sm:px-0",children:n.jsx(du,{onStartTask:()=>A("Start the next task"),onShowAllTasks:E})})]})]}):n.jsxs(n.Fragment,{children:[M&&n.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:n.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[n.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),n.jsx("p",{className:"text-sm",children:"Loading older messages..."})]})}),me&&!M&&n.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:ce>0&&n.jsxs("span",{children:["Showing ",X.length," of ",ce," messages •",n.jsx("span",{className:"text-xs",children:"Scroll up to load more"})]})}),!me&&V.length>Zr&&n.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:["Showing last ",Zr," messages (",V.length," total) •",n.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:vf,children:"Load earlier messages"})]}),G0.map((z,te)=>{const re=te>0?G0[te-1]:null;return n.jsx(Y7,{message:z,index:te,prevMessage:re,createDiff:Qn,onFileOpen:i,onShowSettings:g,autoExpandTools:y,showRawParameters:v,showThinking:w,selectedProject:e},te)})]}),U&&n.jsx("div",{className:"chat-message assistant",children:n.jsxs("div",{className:"w-full",children:[n.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?n.jsx(Gr,{className:"w-full h-full"}):(localStorage.getItem("selected-provider")||"claude")==="codex"?n.jsx(an,{className:"w-full h-full"}):n.jsx(Fr,{className:"w-full h-full"})}),n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:(localStorage.getItem("selected-provider")||"claude")==="cursor"?"Cursor":(localStorage.getItem("selected-provider")||"claude")==="codex"?"Codex":"Claude"})]}),n.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:n.jsxs("div",{className:"flex items-center space-x-1",children:[n.jsx("div",{className:"animate-pulse",children:"●"}),n.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"●"}),n.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"●"}),n.jsx("span",{className:"ml-2",children:"Thinking..."})]})})]})}),n.jsx("div",{ref:Vt})]}),n.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 pb-2 sm:pb-4 md:pb-6",children:[n.jsx("div",{className:"flex-1",children:n.jsx(s7,{status:Ji,isLoading:U,onAbort:Tf,provider:wt,showThinking:w})}),n.jsx("div",{ref:we,className:"max-w-4xl mx-auto mb-3",children:n.jsxs("div",{className:"flex items-center justify-center gap-3",children:[n.jsx("button",{type:"button",onClick:Ef,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${Ye==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":Ye==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":Ye==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:"Click to change permission mode (or press Tab in input)",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${Ye==="default"?"bg-gray-500":Ye==="acceptEdits"?"bg-green-500":Ye==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),n.jsxs("span",{children:[Ye==="default"&&"Default Mode",Ye==="acceptEdits"&&"Accept Edits",Ye==="bypassPermissions"&&"Bypass Permissions",Ye==="plan"&&"Plan Mode"]})]})}),n.jsx(i7,{used:ga?.used||0,total:ga?.total||parseInt("160000")||16e4}),n.jsxs("button",{type:"button",onClick:()=>{const z=!qr;lr(z),Wt(""),Hr(-1),z&&Je(Gt),Ve.current&&Ve.current.focus()},className:"relative w-8 h-8 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"Show all commands",children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),Gt.length>0&&n.jsx("span",{className:"absolute -top-1 -right-1 bg-blue-600 text-white text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",style:{fontSize:"10px"},children:Gt.length})]}),$.trim()&&n.jsx("button",{type:"button",onClick:z=>{z.preventDefault(),z.stopPropagation(),A(""),Ve.current&&(Ve.current.style.height="auto",Ve.current.focus()),Nr(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"Clear input",children:n.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),fr&&V.length>0&&n.jsx("button",{onClick:rr,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"Scroll to bottom",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})}),n.jsxs("form",{onSubmit:Zn,className:"relative max-w-4xl mx-auto",children:[Nf&&n.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[n.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),n.jsx("p",{className:"text-sm font-medium",children:"Drop images here"})]})}),mt.length>0&&n.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:n.jsx("div",{className:"flex flex-wrap gap-2",children:mt.map((z,te)=>n.jsx(X7,{file:z,onRemove:()=>{vt(re=>re.filter((Y,oe)=>oe!==te))},uploadProgress:ft.get(z.name),error:bt.get(z.name)},te))})}),B&&Z.length>0&&n.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:Z.map((z,te)=>n.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${te===Ze?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:re=>{re.preventDefault(),re.stopPropagation()},onClick:re=>{re.preventDefault(),re.stopPropagation(),to(z)},children:[n.jsx("div",{className:"font-medium text-sm",children:z.name}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:z.path})]},z.path))}),n.jsx(G7,{commands:le,selectedIndex:Ua,onSelect:Rs,onClose:()=>{lr(!1),zr(-1),Wt(""),Hr(-1)},position:{top:Ve.current?Math.max(16,Ve.current.getBoundingClientRect().top-316):0,left:Ve.current?Ve.current.getBoundingClientRect().left:16,bottom:Ve.current?window.innerHeight-Ve.current.getBoundingClientRect().top+8:90},isOpen:qr,frequentCommands:St?[]:Xn}),n.jsxs("div",{...wf(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${nr?"chat-input-expanded":""}`,children:[n.jsx("input",{...jf()}),n.jsx("textarea",{ref:Ve,value:$,onChange:Mf,onClick:Af,onKeyDown:Cf,onPaste:kf,onFocus:()=>J(!0),onBlur:()=>J(!1),onInput:z=>{z.target.style.height="auto",z.target.style.height=z.target.scrollHeight+"px",Zt(z.target.selectionStart);const te=parseInt(window.getComputedStyle(z.target).lineHeight),re=z.target.scrollHeight>te*2;Nr(re)},placeholder:`Type / for commands, @ for files, or ask ${wt==="cursor"?"Cursor":"Claude"} anything...`,disabled:U,className:"chat-input-placeholder block w-full pl-12 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-sm sm:text-base leading-[21px] sm:leading-6 transition-all duration-200",style:{height:"50px"}}),n.jsx("button",{type:"button",onClick:Sf,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",title:"Attach images",children:n.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),n.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:n.jsx(Op,{onTranscript:yf,className:"w-10 h-10 sm:w-10 sm:h-10"})}),n.jsx("button",{type:"submit",disabled:!$.trim()||U,onMouseDown:z=>{z.preventDefault(),Zn(z)},onTouchStart:z=>{z.preventDefault(),Zn(z)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:n.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})}),n.jsx("div",{className:`absolute bottom-1 left-12 right-14 sm:right-40 text-xs text-gray-400 dark:text-gray-500 pointer-events-none hidden sm:block transition-opacity duration-200 ${$.trim()?"opacity-0":"opacity-100"}`,children:N?"Ctrl+Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands":"Enter to send • Shift+Enter for new line • Tab to change modes • / for slash commands"})]})]})]})]})]}):n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:n.jsx("p",{children:"Select a project to start chatting with Claude"})})})}const Z7=Kr.memo(Q7);class Jt{constructor(t,r,a,s){this.fromA=t,this.toA=r,this.fromB=a,this.toB=s}offset(t,r=t){return new Jt(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function ua(e,t,r,a,s,i){if(e==a)return[];let o=q0(e,t,r,a,s,i),l=H0(e,t+o,r,a,s+o,i);t+=o,r-=l,s+=o,i-=l;let c=r-t,d=i-s;if(!c||!d)return[new Jt(t,r,s,i)];if(c>d){let m=e.slice(t,r).indexOf(a.slice(s,i));if(m>-1)return[new Jt(t,t+m,s,s),new Jt(t+m+d,r,i,i)]}else if(d>c){let m=a.slice(s,i).indexOf(e.slice(t,r));if(m>-1)return[new Jt(t,t,s,s+m),new Jt(r,r,s+m+c,i)]}if(c==1||d==1)return[new Jt(t,r,s,i)];let u=Xp(e,t,r,a,s,i);if(u){let[m,h,p]=u;return ua(e,t,m,a,s,h).concat(ua(e,m+p,r,a,h+p,i))}return e8(e,t,r,a,s,i)}let rs=1e9,ns=0,_0=!1;function e8(e,t,r,a,s,i){let o=r-t,l=i-s;if(rs<1e9&&Math.min(o,l)>rs*16||ns>0&&Date.now()>ns)return Math.min(o,l)>rs*64?[new Jt(t,r,s,i)]:gu(e,t,r,a,s,i);let c=Math.ceil((o+l)/2);Ko.reset(c),Jo.reset(c);let d=(p,g)=>e.charCodeAt(t+p)==a.charCodeAt(s+g),u=(p,g)=>e.charCodeAt(r-p-1)==a.charCodeAt(i-g-1),m=(o-l)%2!=0?Jo:null,h=m?null:Ko;for(let p=0;p<c;p++){if(p>rs||ns>0&&!(p&63)&&Date.now()>ns)return gu(e,t,r,a,s,i);let g=Ko.advance(p,o,l,c,m,!1,d)||Jo.advance(p,o,l,c,h,!0,u);if(g)return t8(e,t,r,t+g[0],a,s,i,s+g[1])}return[new Jt(t,r,s,i)]}class Jp{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,a,s,i,o,l){for(let c=-t+this.start;c<=t-this.end;c+=2){let d=s+c,u=c==-t||c!=t&&this.vec[d-1]<this.vec[d+1]?this.vec[d+1]:this.vec[d-1]+1,m=u-c;for(;u<r&&m<a&&l(u,m);)u++,m++;if(this.vec[d]=u,u>r)this.end+=2;else if(m>a)this.start+=2;else if(i){let h=s+(r-a)-c;if(h>=0&&h<this.len&&i.vec[h]!=-1)if(o){let p=i.vec[h];if(p>=r-u)return[p,s+p-h]}else{let p=r-i.vec[h];if(u>=p)return[u,m]}}}return null}}const Ko=new Jp,Jo=new Jp;function t8(e,t,r,a,s,i,o,l){let c=!1;return!Pa(e,a)&&++a==r&&(c=!0),!Pa(s,l)&&++l==o&&(c=!0),c?[new Jt(t,r,i,o)]:ua(e,t,a,s,i,l).concat(ua(e,a,r,s,l,o))}function Yp(e,t){let r=1,a=Math.min(e,t);for(;r<a;)r=r<<1;return r}function q0(e,t,r,a,s,i){if(t==r||t==i||e.charCodeAt(t)!=a.charCodeAt(s))return 0;let o=Yp(r-t,i-s);for(let l=t,c=s;;){let d=l+o,u=c+o;if(d>r||u>i||e.slice(l,d)!=a.slice(c,u)){if(o==1)return l-t-(Pa(e,l)?0:1);o=o>>1}else{if(d==r||u==i)return d-t;l=d,c=u}}}function H0(e,t,r,a,s,i){if(t==r||s==i||e.charCodeAt(r-1)!=a.charCodeAt(i-1))return 0;let o=Yp(r-t,i-s);for(let l=r,c=i;;){let d=l-o,u=c-o;if(d<t||u<s||e.slice(d,l)!=a.slice(u,c)){if(o==1)return r-l-(Pa(e,l)?0:1);o=o>>1}else{if(d==t||u==s)return r-d;l=d,c=u}}}function Ol(e,t,r,a,s,i,o,l){let c=a.slice(s,i),d=null;for(;;){if(d||o<l)return d;for(let u=t+o;;){Pa(e,u)||u++;let m=u+o;if(Pa(e,m)||(m+=m==u+1?1:-1),m>=r)break;let h=e.slice(u,m),p=-1;for(;(p=c.indexOf(h,p+1))!=-1;){let g=q0(e,m,r,a,s+p+h.length,i),y=H0(e,t,u,a,s,s+p),v=h.length+g+y;(!d||d[2]<v)&&(d=[u-y,s+p-y,v])}u=m}if(l<0)return d;o=o>>1}}function Xp(e,t,r,a,s,i){let o=r-t,l=i-s;if(o<l){let c=Xp(a,s,i,e,t,r);return c&&[c[1],c[0],c[2]]}return o<4||l*2<o?null:Ol(e,t,r,a,s,i,Math.floor(o/4),-1)}function gu(e,t,r,a,s,i){_0=!0;let o=r-t,l=i-s,c;if(o<l){let h=Ol(a,s,i,e,t,r,Math.floor(o/6),50);c=h&&[h[1],h[0],h[2]]}else c=Ol(e,t,r,a,s,i,Math.floor(l/6),50);if(!c)return[new Jt(t,r,s,i)];let[d,u,m]=c;return ua(e,t,d,a,s,u).concat(ua(e,d+m,r,a,u+m,i))}function Qp(e,t){for(let r=1;r<e.length;r++){let a=e[r-1],s=e[r];a.toA>s.fromA-t&&a.toB>s.fromB-t&&(e[r-1]=new Jt(a.fromA,s.toA,a.fromB,s.toB),e.splice(r--,1))}}function r8(e,t,r){for(;;){Qp(r,1);let a=!1;for(let s=0;s<r.length;s++){let i=r[s],o,l;(o=q0(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=r[s]=new Jt(i.fromA+o,i.toA,i.fromB+o,i.toB)),(l=H0(e,i.fromA,i.toA,t,i.fromB,i.toB))&&(i=r[s]=new Jt(i.fromA,i.toA-l,i.fromB,i.toB-l));let c=i.toA-i.fromA,d=i.toB-i.fromB;if(c&&d)continue;let u=i.fromA-(s?r[s-1].toA:0),m=(s<r.length-1?r[s+1].fromA:e.length)-i.toA;if(!u||!m)continue;let h=c?e.slice(i.fromA,i.toA):t.slice(i.fromB,i.toB);u<=h.length&&e.slice(i.fromA-u,i.fromA)==h.slice(h.length-u)?(r[s]=new Jt(i.fromA-u,i.toA-u,i.fromB-u,i.toB-u),a=!0):m<=h.length&&e.slice(i.toA,i.toA+m)==h.slice(0,m)&&(r[s]=new Jt(i.fromA+m,i.toA+m,i.fromB+m,i.toB+m),a=!0)}if(!a)break}return r}function n8(e,t,r){for(let a=0,s=0;s<e.length;s++){let i=e[s],o=i.toA-i.fromA,l=i.toB-i.fromB;if(o&&l||o>3||l>3){let c=s==e.length-1?t.length:e[s+1].fromA,d=i.fromA-a,u=c-i.toA,m=bu(t,i.fromA,d),h=xu(t,i.toA,u),p=i.fromA-m,g=h-i.toA;if((!o||!l)&&p&&g){let y=Math.max(o,l),[v,w,S]=o?[t,i.fromA,i.toA]:[r,i.fromB,i.toB];y>p&&t.slice(m,i.fromA)==v.slice(S-p,S)?(i=e[s]=new Jt(m,m+o,i.fromB-p,i.toB-p),m=i.fromA,h=xu(t,i.toA,c-i.toA)):y>g&&t.slice(i.toA,h)==v.slice(w,w+g)&&(i=e[s]=new Jt(h-o,h,i.fromB+g,i.toB+g),h=i.toA,m=bu(t,i.fromA,i.fromA-a)),p=i.fromA-m,g=h-i.toA}if(p||g)i=e[s]=new Jt(i.fromA-p,i.toA+g,i.fromB-p,i.toB+g);else if(o){if(!l){let y=vu(t,i.fromA,i.toA),v,w=y<0?-1:yu(t,i.toA,i.fromA);y>-1&&(v=y-i.fromA)<=u&&t.slice(i.fromA,y)==t.slice(i.toA,i.toA+v)?i=e[s]=i.offset(v):w>-1&&(v=i.toA-w)<=d&&t.slice(i.fromA-v,i.fromA)==t.slice(w,i.toA)&&(i=e[s]=i.offset(-v))}}else{let y=vu(r,i.fromB,i.toB),v,w=y<0?-1:yu(r,i.toB,i.fromB);y>-1&&(v=y-i.fromB)<=u&&r.slice(i.fromB,y)==r.slice(i.toB,i.toB+v)?i=e[s]=i.offset(v):w>-1&&(v=i.toB-w)<=d&&r.slice(i.fromB-v,i.fromB)==r.slice(w,i.toB)&&(i=e[s]=i.offset(-v))}}a=i.toA}return Qp(e,3),e}let oa;try{oa=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Zp(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function ef(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?Zp(r)?1:0:oa?!nf(r)||t==e.length-1?oa.test(String.fromCharCode(r))?1:0:oa.test(e.slice(t,t+2))?2:0:0}function tf(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?Zp(r)?1:0:oa?!af(r)||t==1?oa.test(String.fromCharCode(r))?1:0:oa.test(e.slice(t-2,t))?2:0:0}const rf=8;function xu(e,t,r){if(t==e.length||!tf(e,t))return t;for(let a=t,s=t+r,i=0;i<rf;i++){let o=ef(e,a);if(!o||a+o>s)return a;a+=o}return t}function bu(e,t,r){if(!t||!ef(e,t))return t;for(let a=t,s=t-r,i=0;i<rf;i++){let o=tf(e,a);if(!o||a-o<s)return a;a-=o}return t}function yu(e,t,r){for(;t!=r;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function vu(e,t,r){for(;t!=r;t++)if(e.charCodeAt(t)==10)return t;return-1}const nf=e=>e>=55296&&e<=56319,af=e=>e>=56320&&e<=57343;function Pa(e,t){return!t||t==e.length||!nf(e.charCodeAt(t-1))||!af(e.charCodeAt(t))}function a8(e,t,r){var a;return rs=((a=r?.scanLimit)!==null&&a!==void 0?a:1e9)>>1,ns=r?.timeout?Date.now()+r.timeout:0,_0=!1,r8(e,t,ua(e,0,e.length,t,0,t.length))}function sf(){return!_0}function of(e,t,r){return n8(a8(e,t,r),e,t)}const An=Di.define({combine:e=>e[0]}),s8=Hl.define(),lf=Di.define(),_r=ys.define({create(e){return null},update(e,t){for(let r of t.effects)r.is(s8)&&(e=r.value);for(let r of t.state.facet(lf))e=r(e,t);return e}});function Yo(e){let t=e.field(_r,!1);if(!t)return null;let r=e.facet(An);return{chunks:t,side:r?r.side:null}}class Ta{constructor(t,r,a,s,i,o=!0){this.changes=t,this.fromA=r,this.toA=a,this.fromB=s,this.toB=i,this.precise=o}offset(t,r){return t||r?new Ta(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,r,a){let s=of(t.toString(),r.toString(),a);return cf(s,t,r,0,0,sf())}static updateA(t,r,a,s,i){return Su(Nu(t,s,!0,a.length),t,r,a,i)}static updateB(t,r,a,s,i){return Su(Nu(t,s,!1,r.length),t,r,a,i)}}function ku(e,t,r,a){let s=r.lineAt(e),i=a.lineAt(t);return s.to==e&&i.to==t&&e<r.length&&t<a.length?[e+1,t+1]:[s.from,i.from]}function wu(e,t,r,a){let s=r.lineAt(e),i=a.lineAt(t);return s.from==e&&i.from==t?[e,t]:[s.to+1,i.to+1]}function cf(e,t,r,a,s,i){let o=[];for(let l=0;l<e.length;l++){let c=e[l],[d,u]=ku(c.fromA+a,c.fromB+s,t,r),[m,h]=wu(c.toA+a,c.toB+s,t,r),p=[c.offset(-d+a,-u+s)];for(;l<e.length-1;){let g=e[l+1],[y,v]=ku(g.fromA+a,g.fromB+s,t,r);if(y>m+1&&v>h+1)break;p.push(g.offset(-d+a,-u+s)),[m,h]=wu(g.toA+a,g.toB+s,t,r),l++}o.push(new Ta(p,d,Math.max(d,m),u,Math.max(u,h),i))}return o}const li=1e3;function ju(e,t,r,a){let s=0,i=e.length;for(;;){if(s==i){let u=0,m=0;s&&({toA:u,toB:m}=e[s-1]);let h=t-(r?u:m);return[u+h,m+h]}let o=s+i>>1,l=e[o],[c,d]=r?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>t)i=o;else if(d<=t)s=o+1;else return a?[l.fromA,l.fromB]:[l.toA,l.toB]}}function Nu(e,t,r,a){let s=[];return t.iterChangedRanges((i,o,l,c)=>{let d=0,u=r?t.length:a,m=0,h=r?a:t.length;i>li&&([d,m]=ju(e,i-li,r,!0)),o<t.length-li&&([u,h]=ju(e,o+li,r,!1));let p=c-l-(o-i),g,[y,v]=r?[p,0]:[0,p];s.length&&(g=s[s.length-1]).toA>=d?s[s.length-1]={fromA:g.fromA,fromB:g.fromB,toA:u,toB:h,diffA:g.diffA+y,diffB:g.diffB+v}:s.push({fromA:d,toA:u,fromB:m,toB:h,diffA:y,diffB:v})}),s}function Su(e,t,r,a,s){if(!e.length)return t;let i=[];for(let o=0,l=0,c=0,d=0;;o++){let u=o==e.length?null:e[o],m=u?u.fromA+l:r.length,h=u?u.fromB+c:a.length;for(;d<t.length;){let v=t[d];if(v.toA+l>m||v.toB+c>h)break;i.push(v.offset(l,c)),d++}if(!u)break;let p=u.toA+l+u.diffA,g=u.toB+c+u.diffB,y=of(r.sliceString(m,p),a.sliceString(h,g),s);for(let v of cf(y,r,a,m,h,sf()))i.push(v);for(l+=u.diffA,c+=u.diffB;d<t.length;){let v=t[d];if(v.fromA+l>p&&v.fromB+c>g)break;d++}}return i}const i8={scanLimit:500},df=zi.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Au(e))}update(e){(e.docChanged||e.viewportChanged||o8(e.startState,e.state)||l8(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Au(e.view))}},{decorations:e=>e.deco});function o8(e,t){return e.field(_r,!1)!=t.field(_r,!1)}function l8(e,t){return e.facet(An)!=t.facet(An)}const Cu=Tn.line({class:"cm-changedLine"}),uf=Tn.mark({class:"cm-changedText"}),c8=Tn.mark({tagName:"ins",class:"cm-insertedLine"}),d8=Tn.mark({tagName:"del",class:"cm-deletedLine"}),Mu=new class extends Wl{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function u8(e,t,r,a,s,i){let o=r?e.fromA:e.fromB,l=r?e.toA:e.toB,c=0;if(o!=l){s.add(o,o,Cu),s.add(o,l,r?d8:c8),i&&i.add(o,o,Mu);for(let d=t.iterRange(o,l-1),u=o;!d.next().done;){if(d.lineBreak){u++,s.add(u,u,Cu),i&&i.add(u,u,Mu);continue}let m=u+d.value.length;if(a)for(;c<e.changes.length;){let h=e.changes[c],p=o+(r?h.fromA:h.fromB),g=o+(r?h.toA:h.toB),y=Math.max(u,p),v=Math.min(m,g);if(y<v&&s.add(y,v,uf),g<m)c++;else break}u=m}}}function Au(e){let t=e.state.field(_r),{side:r,highlightChanges:a,markGutter:s,overrideChunk:i}=e.state.facet(An),o=r=="a",l=new hi,c=s?new hi:null,{from:d,to:u}=e.viewport;for(let m of t){if((o?m.fromA:m.fromB)>=u)break;(o?m.toA:m.toB)>d&&(!i||!i(e.state,m,l,c))&&u8(m,e.state.doc,o,a,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}const $l=Hl.define({map:(e,t)=>t.mapPos(e)});class m8 extends Ul{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",a=>{let s=t.posAtDOM(a.target);t.dispatch({effects:$l.of(s)});let{side:i,sibling:o}=t.state.facet(An);o&&o().dispatch({effects:$l.of(h8(s,t.state.field(_r),i=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function h8(e,t,r){let a=0,s=0;for(let i=0;;i++){let o=i<t.length?t[i]:null;if(!o||(r?o.fromA:o.fromB)>=e)return s+(e-a);[a,s]=r?[o.toA,o.toB]:[o.toB,o.toA]}}const p8=ys.define({create(e){return Tn.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is($l)&&(e=e.update({filter:a=>a!=r.value}));return e},provide:e=>Rr.decorations.from(e)});function f8({margin:e=3,minSize:t=4}){return p8.init(r=>g8(r,e,t))}function g8(e,t,r){let a=new hi,s=e.facet(An).side=="a",i=e.field(_r),o=1;for(let l=0;;l++){let c=l<i.length?i[l]:null,d=l?o+t:1,u=c?e.doc.lineAt(s?c.fromA:c.fromB).number-1-t:e.doc.lines,m=u-d+1;if(m>=r&&a.add(e.doc.line(d).from,e.doc.line(u).to,Tn.replace({widget:new m8(m),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,s?c.toA:c.toB)).number}return a.finish()}const x8=Rr.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),b8=new class extends Wl{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},y8=Bu.low(If({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(df))===null||t===void 0?void 0:t.gutter)||Df.empty},widgetMarker:(e,t)=>t instanceof mf?b8:null}));function v8(e){var t;let r=typeof e.original=="string"?Fu.of(e.original.split(/\r?\n/)):e.original,a=e.diffConfig||i8;return[Bu.low(df),N8,x8,Rr.editorAttributes.of({class:"cm-merge-b"}),lf.of((s,i)=>{let o=i.effects.find(l=>l.is(W0));return o&&(s=Ta.updateA(s,o.value.doc,i.startState.doc,o.value.changes,a)),i.docChanged&&(s=Ta.updateB(s,i.state.field(Ra),i.newDoc,i.changes,a)),s}),An.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(t=e.mergeControls)!==null&&t!==void 0?t:!0,overrideChunk:e.allowInlineDiffs?A8:void 0,side:"b"}),Ra.init(()=>r),e.gutter!==!1?y8:[],e.collapseUnchanged?f8(e.collapseUnchanged):[],_r.init(s=>Ta.build(r,s.doc,a))]}const W0=Hl.define(),Ra=ys.define({create:()=>Fu.empty,update(e,t){for(let r of t.effects)r.is(W0)&&(e=r.value.doc);return e}}),Tu=new WeakMap;class mf extends Ul{constructor(t){super(),this.buildDOM=t,this.dom=null}eq(t){return this.dom==t.dom}toDOM(t){return this.dom||(this.dom=this.buildDOM(t))}}function k8(e,t,r){let a=Tu.get(t.changes);if(a)return a;let s=o=>{let{highlightChanges:l,syntaxHighlightDeletions:c,syntaxHighlightDeletionsMaxLength:d,mergeControls:u}=e.facet(An),m=document.createElement("div");if(m.className="cm-deletedChunk",u){let I=m.appendChild(document.createElement("div"));I.className="cm-chunkButtons";let F=R=>{R.preventDefault(),w8(o,o.posAtDOM(m))},E=R=>{R.preventDefault(),j8(o,o.posAtDOM(m))};if(typeof u=="function")I.appendChild(u("accept",F)),I.appendChild(u("reject",E));else{let R=I.appendChild(document.createElement("button"));R.name="accept",R.textContent=e.phrase("Accept"),R.onmousedown=F;let H=I.appendChild(document.createElement("button"));H.name="reject",H.textContent=e.phrase("Reject"),H.onmousedown=E}}if(r||t.fromA>=t.toA)return m;let h=o.state.field(Ra).sliceString(t.fromA,t.endA),p=c&&e.facet(Ou),g=S(),y=t.changes,v=0,w=!1;function S(){let I=m.appendChild(document.createElement("div"));return I.className="cm-deletedLine",I.appendChild(document.createElement("del"))}function N(I,F,E){for(let R=I;R<F;){if(h.charAt(R)==`
799
+ `){g.firstChild||g.appendChild(document.createElement("br")),g=S(),R++;continue}let H=F,$=E+(w?" cm-deletedText":""),A=!1,V=h.indexOf(`
800
+ `,R);if(V>-1&&V<F&&(H=V),l&&v<y.length){let T=Math.max(0,w?y[v].toA:y[v].fromA);T<=H&&(H=T,w&&v++,A=!0)}if(H>R){let T=document.createTextNode(h.slice(R,H));if($){let U=g.appendChild(document.createElement("span"));U.className=$,U.appendChild(T)}else g.appendChild(T);R=H}A&&(w=!w)}}if(p&&t.toA-t.fromA<=d){let I=p.parser.parse(h),F=0;Zo(I,{style:E=>$u(e,E)},(E,R,H)=>{E>F&&N(F,E,""),N(E,R,H),F=R}),N(F,h.length,"")}else N(0,h.length,"");return g.firstChild||g.appendChild(document.createElement("br")),m},i=Tn.widget({block:!0,side:-1,widget:new mf(s)});return Tu.set(t.changes,i),i}function w8(e,t){let{state:r}=e,a=t??r.selection.main.head,s=e.state.field(_r).find(c=>c.fromB<=a&&c.endB>=a);if(!s)return!1;let i=e.state.sliceDoc(s.fromB,Math.max(s.fromB,s.toB-1)),o=e.state.field(Ra);s.fromB!=s.toB&&s.toA<=o.length&&(i+=e.state.lineBreak);let l=zf.of({from:s.fromA,to:Math.min(o.length,s.toA),insert:i},o.length);return e.dispatch({effects:W0.of({doc:l.apply(o),changes:l}),userEvent:"accept"}),!0}function j8(e,t){let{state:r}=e,a=t??r.selection.main.head,s=r.field(_r).find(l=>l.fromB<=a&&l.endB>=a);if(!s)return!1;let o=r.field(Ra).sliceString(s.fromA,Math.max(s.fromA,s.toA-1));return s.fromA!=s.toA&&s.toB<=r.doc.length&&(o+=r.lineBreak),e.dispatch({changes:{from:s.fromB,to:Math.min(r.doc.length,s.toB),insert:o},userEvent:"revert"}),!0}function Eu(e){let t=new hi;for(let r of e.field(_r)){let a=e.facet(An).overrideChunk&&hf(e,r);t.add(r.fromB,r.fromB,k8(e,r,!!a))}return t.finish()}const N8=ys.define({create:e=>Eu(e),update(e,t){return t.state.field(_r,!1)!=t.startState.field(_r,!1)?Eu(t.state):e},provide:e=>Rr.decorations.from(e)}),Iu=new WeakMap;function hf(e,t){let r=Iu.get(t);if(r!==void 0)return r;r=null;let a=e.field(Ra),s=e.doc,i=a.lineAt(t.endA).number-a.lineAt(t.fromA).number+1,o=s.lineAt(t.endB).number-s.lineAt(t.fromB).number+1;e:if(i==o&&i<10){let l=[],c=0,d=t.fromA,u=t.fromB;for(let m of t.changes){if(m.fromA<m.toA){c+=m.toA-m.fromA;let h=a.sliceString(d+m.fromA,d+m.toA);if(/\n/.test(h))break e;l.push(Tn.widget({widget:new S8(h),side:-1}).range(u+m.fromB))}m.fromB<m.toB&&l.push(uf.range(u+m.fromB,u+m.toB))}c<t.endA-t.fromA-i*2&&(r=l)}return Iu.set(t,r),r}class S8 extends Ul{constructor(t){super(),this.text=t}eq(t){return this.text==t.text}toDOM(t){let r=document.createElement("del");return r.className="cm-deletedText",r.textContent=this.text,r}}const C8=new class extends Wl{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},M8=Tn.line({class:"cm-inlineChangedLine"});function A8(e,t,r,a){let s=hf(e,t),i=0;if(!s)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(a&&a.add(o.from,o.from,C8),r.add(o.from,o.from,M8);i<s.length&&s[i].to<=o.to;){let l=s[i++];r.add(l.from,l.to,l.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var T8=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(r[a[s]]=e[a[s]]);return r};const hr=Di.define({combine:e=>{const t=[];for(let r of e){if(!r)continue;const{create:a,gutters:s}=r,i=T8(r,["create","gutters"]);t.push(Object.assign(Object.assign({},i),{enabled:!0,gutters:s?s.filter(o=>Object.keys(o).length>0):void 0}))}return Lf(t,{enabled:t.length>0,displayText:"characters",eventHandlers:{},showOverlay:"always",gutters:[]})}}),Cr={PixelMultiplier:2,SizeRatio:4,MaxWidth:120},E8=Rr.theme({".cm-minimap-overlay-container":{position:"absolute",top:0,height:"100%",width:"100%","&.cm-minimap-overlay-mouse-over":{opacity:0,transition:"visibility 0s linear 300ms, opacity 300ms"},"&.cm-minimap-overlay-mouse-over:hover":{opacity:1,transition:"visibility 0s linear 0ms, opacity 300ms"},"&.cm-minimap-overlay-off":{display:"none"},"& .cm-minimap-overlay":{background:"rgb(121, 121, 121)",opacity:"0.2",position:"absolute",right:0,top:0,width:"100%",transition:"top 0s ease-in 0ms","&:hover":{opacity:"0.3"}},"&.cm-minimap-overlay-active":{opacity:1,visibility:"visible",transition:"visibility 0s linear 0ms, opacity 300ms","& .cm-minimap-overlay":{opacity:"0.4"}}}}),Bn=Cr.PixelMultiplier*Cr.SizeRatio,I8=zi.fromClass(class{constructor(e){this.view=e,this._isDragging=!1,e.state.facet(hr).enabled&&this.create(e)}create(e){this.container=Ea("div",{class:"cm-minimap-overlay-container"}),this.dom=Ea("div",{class:"cm-minimap-overlay"}),this.container.appendChild(this.dom),this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),window.addEventListener("mouseup",this.onMouseUp.bind(this)),window.addEventListener("mousemove",this.onMouseMove.bind(this));const t=e.dom.querySelector(".cm-minimap-inner");t&&t.appendChild(this.container),this.computeShowOverlay(),this.computeHeight(),this.computeTop()}remove(){this.container&&(this.container.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),this.container.remove())}update(e){const t=e.startState.facet(hr).enabled,r=e.state.facet(hr).enabled;if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.computeShowOverlay(),e.geometryChanged&&(this.computeHeight(),this.computeTop()))}computeHeight(){if(!this.dom)return;const e=this.view.dom.clientHeight/Bn;this.dom.style.height=e+"px"}computeTop(){if(!this._isDragging&&this.dom){const{clientHeight:e,scrollHeight:t,scrollTop:r}=this.view.scrollDOM,a=t-e,s=r/Bn,i=e/Bn,o=e-i;let l=r/a;isNaN(l)&&(l=0);const c=o*l,d=Math.min(c,s);this.dom.style.top=d+"px"}}computeShowOverlay(){if(!this.container)return;const{showOverlay:e}=this.view.state.facet(hr);e==="mouse-over"?this.container.classList.add("cm-minimap-overlay-mouse-over"):this.container.classList.remove("cm-minimap-overlay-mouse-over");const{clientHeight:t,scrollHeight:r}=this.view.scrollDOM;t===r?this.container.classList.add("cm-minimap-overlay-off"):this.container.classList.remove("cm-minimap-overlay-off")}onMouseDown(e){if(!this.container||e.button===2)return;const{clientY:t,target:r}=e;if(r===this.dom){this._dragStartY=e.clientY,this._isDragging=!0,this.container.classList.add("cm-minimap-overlay-active");return}const{clientHeight:a,scrollHeight:s,scrollTop:i}=this.view.scrollDOM,o=r.getBoundingClientRect().top,l=(t-o)*Bn,c=i/(s-a),u=(a*Bn-a)*c,m=Math.max(0,i-u);this.view.scrollDOM.scrollTop=m+l-a/2}onMouseUp(e){this._isDragging&&this.container&&(this._dragStartY=void 0,this._isDragging=!1,this.container.classList.remove("cm-minimap-overlay-active"))}onMouseMove(e){if(!this._isDragging||!this.dom)return;if(e.preventDefault(),e.stopPropagation(),!this._dragStartY){this._dragStartY=e.clientY;return}const t=e.clientY-this._dragStartY,r=t<0,a=t>0;this._dragStartY=e.clientY;const s=this.dom.getBoundingClientRect().height,i=this.dom.getBoundingClientRect().y,o=i+s,l=parseFloat(this.dom.style.top),c=this.view.scrollDOM.scrollTop,d=this.view.scrollDOM.clientHeight,u=this.view.scrollDOM.scrollHeight,m=c===0,h=Math.round(c)>=Math.round(u-d);if(m&&r||m&&e.clientY<i||h&&a||h&&e.clientY>o)return;const p=this.view.scrollDOM.scrollHeight,g=this.view.scrollDOM.clientHeight,y=(p-g)/Bn,v=g-g/Bn,w=l+t,S=w/v,N=(p-g)*S,I=w*Bn;this.view.scrollDOM.scrollTop=Math.max(N,I);const F=Math.min(Math.max(0,w),Math.min(v,y));this.dom.style.top=F+"px"}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.computeTop())}}}),D8=[E8,I8];class U0{constructor(t){this.map=new Map,this.view=t}get(t){return this.map.get(t)}set(t,r){this.map.set(t,r)}}function Du(e){var t;if(!e.facet(hr).enabled)return[];const r=[],a=e.doc.iterLines(),s=Pf(e).iter();let i=0;for(a.next();!a.done;){const o=a.value;let l=i,c=l+o.length;for(;s.value&&s.to<l;)s.next();const{from:d,to:u}=s,m=l>=d&&l<u,h=c>d&&c<=u;if(m){let p=(t=r.pop())!==null&&t!==void 0?t:[],g=p.pop();g&&g.folded&&(g.to=u),g&&p.push(g),(!g||!g.folded)&&p.push({from:d,to:u,folded:!0}),h||p.push({from:u,to:c,folded:!1}),r.push(p)}else h?r.push([{from:l,to:d,folded:!1},{from:d,to:u,folded:!0}]):r.push([{from:l,to:c,folded:!1}]);i=c+1,a.next()}return r}const Fa=ys.define({create:e=>Du(e),update:(e,t)=>Ki([t])||t.docChanged?Du(t.state):e});function Ki(e){return e.find(t=>t.effects.find(r=>r.is(Rf)||r.is(Ff)))}class z8 extends U0{constructor(t){super(t),this.count=void 0}shouldUpdate(t){if(!t.state.facet(hr).enabled)return!1;if(t.docChanged)return!0;for(const r of t.transactions)for(const a of r.effects)if(a.is(Bf))return!0;return!!(Ki(t.transactions)||this.count===void 0)}update(t){if(!this.shouldUpdate(t))return;this.map.clear();const r=t.state.field(Fa);this.count=Of(t.state),$f(t.state,(a,s,i)=>{const o=this.findLine(s,r),l=this.findLine(i,r);let c=a.severity;for(let d=o;d<=l;d++){const u=this.get(d);u&&(c=[c,u].sort(this.sort.bind(this)).slice(0,1)[0]),this.set(d,c)}})}drawLine(t,r){const{context:a,lineHeight:s,offsetX:i,offsetY:o}=t,l=this.get(r);l&&(a.globalAlpha=.65,a.beginPath(),a.rect(i,o,a.canvas.width-i,s),a.fillStyle=this.color(l),a.fill())}findLine(t,r){return r.findIndex(s=>{const i=s.slice(0,1)[0],o=s.slice(-1)[0];return!i||!o?!1:i.from<=t&&t<=o.to})+1}color(t){return t==="error"?"#d11":t==="warning"?"orange":"#999"}sort(t,r){return this.score(r)-this.score(t)}score(t){switch(t){case"error":return 3;case"warning":return 2;default:return 1}}}function L8(e){return new z8(e)}class P8 extends U0{constructor(t){super(t),this.getDrawInfo(),this._themeClasses=t.dom.classList.value}shouldUpdate(t){return t.state.facet(hr).enabled?!!(t.docChanged||t.selectionSet||this._themeClasses!==this.view.dom.classList.value||Ki(t.transactions)):!1}update(t){if(!this.shouldUpdate(t))return;this.map.clear(),this._themeClasses!==this.view.dom.classList.value&&(this._drawInfo=void 0,this._themeClasses=this.view.dom.classList.value);const{ranges:r}=t.state.selection;let a=0;for(const[s,i]of t.state.field(Fa).entries()){const o=[];let l=0;for(const d of i){do{if(a>=r.length||d.to<r[a].from)continue;if(r[a].from===r[a].to){a++;continue}const u=r[a],m={from:l+Math.max(d.from,u.from)-d.from,to:l+Math.min(d.to,u.to)-d.from,extends:u.to>d.to},h=o.slice(-1)[0];if(h&&h.to===m.from){let{to:p}=m;d.folded&&m.extends?p=m.from+1:d.folded&&!m.extends&&(p=h.to),o[o.length-1]=Object.assign(Object.assign({},h),{to:p,extends:m.extends})}else d.folded||o.push(m);if(m.extends)break;a++}while(a<r.length&&d.to>=r[a].from);l+=d.folded?1:d.to-d.from}if(o.length===0)continue;const c=s+1;this.map.set(c,o)}}drawLine(t,r){let{context:a,lineHeight:s,charWidth:i,offsetX:o,offsetY:l}=t;const c=this.get(r);if(c)for(const d of c){const u=o+d.from*i,m=(d.to-d.from)*i,h=a.canvas.width-u;d.extends&&(a.globalAlpha=.65,a.beginPath(),a.rect(u,l,h,s),a.fillStyle=this.getDrawInfo().backgroundColor,a.fill()),a.globalAlpha=1,a.beginPath(),a.rect(u,l,m,s),a.fillStyle=this.getDrawInfo().backgroundColor,a.fill()}}getDrawInfo(){if(this._drawInfo)return this._drawInfo;const t=document.createElement("span");t.setAttribute("class","cm-selectionBackground"),this.view.dom.appendChild(t);const a={backgroundColor:window.getComputedStyle(t).backgroundColor};return this._drawInfo=a,this.view.dom.removeChild(t),a}}function R8(e){return new P8(e)}class F8 extends U0{constructor(t){super(t),this._fontInfoMap=new Map,this._themeClasses=new Set(t.dom.classList.values()),t.state.facet(hr).enabled&&this.updateImpl(t.state)}shouldUpdate(t){return!!(t.docChanged||t.state.facet(hr)!==t.startState.facet(hr)||this.themeChanged()||Ki(t.transactions))}update(t){this.shouldUpdate(t)&&(this._highlightingCallbackId&&(typeof window.requestIdleCallback<"u"?cancelIdleCallback(this._highlightingCallbackId):clearTimeout(this._highlightingCallbackId)),this.updateImpl(t.state,t.changes))}updateImpl(t,r){var a;this.map.clear(),this._displayText=t.facet(hr).displayText,this.themeChanged()&&this._fontInfoMap.clear();let s;if(this._previousTree&&r){const m=X0.addTree(this._previousTree),h=[];r.iterChangedRanges((p,g,y,v)=>h.push({fromA:p,toA:g,fromB:y,toB:v})),s=X0.applyChanges(m,h)}const i=t.doc.toString(),o=(a=t.facet(Ou))===null||a===void 0?void 0:a.parser,l=o?o.parse(i,s):void 0;this._previousTree=l;const c={style:m=>$u(t,m)};let d=[];if(l){const m=t.doc.lineAt(this.view.viewport.from).number,h=t.doc.lineAt(this.view.viewport.to).number,p=h-m,g=m/(t.doc.lines-p),{SizeRatio:y,PixelMultiplier:v}=Cr,w=p*y*v,S=g*w,N=Math.max(1,Math.floor(m-S)),I=Math.min(h+Math.floor(w-S),t.doc.lines);Zo(l,c,(F,E,R)=>{d.push({from:F,to:E,tags:R})},t.doc.line(N).from,t.doc.line(I).to)}this.updateMapImpl(t,d),d=[];const u=()=>{l&&(Zo(l,c,(m,h,p)=>{d.push({from:m,to:h,tags:p})}),this.updateMapImpl(t,d),this._highlightingCallbackId=void 0)};this._highlightingCallbackId=typeof window.requestIdleCallback<"u"?requestIdleCallback(u):setTimeout(u)}updateMapImpl(t,r){this.map.clear();const a=t.doc.toString(),s=r.values();let i=s.next();for(const[o,l]of t.field(Fa).entries()){const c=[];for(const u of l){if(u.from===u.to)continue;if(u.folded){c.push({text:"…",tags:""});continue}let m=u.from;for(;!i.done&&i.value.from<u.to;){const{from:h,to:p,tags:g}=i.value;if(p<m){i=s.next();continue}h>m&&c.push({text:a.slice(m,h),tags:""});const y=Math.max(h,u.from),v=Math.min(p,u.to);if(c.push({text:a.slice(y,v),tags:g}),m=v,p>v)break;i=s.next()}m!==u.to&&c.push({text:a.slice(m,u.to),tags:""})}const d=o+1;this.map.set(d,c)}}measure(t){const{color:r,font:a,lineHeight:s}=this.getFontInfo("");return t.textBaseline="ideographic",t.fillStyle=r,t.font=a,{charWidth:t.measureText("_").width,lineHeight:s}}beforeDraw(){this._fontInfoMap.clear()}drawLine(t,r){const a=this.get(r);if(!a)return;let{context:s,charWidth:i,lineHeight:o,offsetX:l,offsetY:c}=t,d;s.textBaseline="ideographic";for(const u of a){const m=this.getFontInfo(u.tags);switch((!d||d.color!==m.color)&&(s.fillStyle=m.color),(!d||d.font!==m.font)&&(s.font=m.font),d=m,o=Math.max(o,m.lineHeight),this._displayText){case"characters":{s.fillText(u.text,l,c+o),l+=u.text.length*i;break}case"blocks":{const h=/\S+/g;let p;for(;(p=h.exec(u.text))!==null;){const g=l+p.index*i;let y=(h.lastIndex-p.index)*i;if(g>s.canvas.width)break;g+y>s.canvas.width&&(y=s.canvas.width-g);const v=2/Cr.SizeRatio,w=o-v;s.fillStyle=m.color,s.globalAlpha=.65,s.beginPath(),s.rect(g,c,y,w),s.fill()}l+=u.text.length*i;break}}}}getFontInfo(t){const r=this._fontInfoMap.get(t);if(r)return r;const a=Ea("span",{class:t}),s=Ea("div",{class:"cm-line",style:"display: none"},a);this.view.contentDOM.appendChild(s);const i=window.getComputedStyle(a),o=parseFloat(i.lineHeight)/Cr.SizeRatio,l={color:i.color,font:`${i.fontStyle} ${i.fontWeight} ${o}px ${i.fontFamily}`,lineHeight:o};return this._fontInfoMap.set(t,l),this.view.contentDOM.removeChild(s),l}themeChanged(){const t=this._themeClasses,r=new Set(this.view.dom.classList.values());if(this._themeClasses=r,!t||(t.delete("cm-focused"),r.delete("cm-focused"),t.size!==r.size))return!0;let a=!0;return t.forEach(s=>{r.has(s)||(a=!1)}),!a}}function B8(e){return new F8(e)}const pf=4;function O8(e,t,r){const a=e[r];a&&(t.context.fillStyle=a,t.context.globalAlpha=1,t.context.beginPath(),t.context.rect(t.offsetX,t.offsetY,pf,t.lineHeight),t.context.fill())}const $8=Rr.theme({"&":{height:"100%",overflowY:"auto"},"& .cm-minimap-gutter":{borderRight:0,flexShrink:0,left:"unset",position:"sticky",right:0,top:0},"& .cm-minimap-inner":{height:"100%",position:"absolute",right:0,top:0,overflowY:"hidden","& canvas":{display:"block"}},"& .cm-minimap-box-shadow":{boxShadow:"12px 0px 20px 5px #6c6c6c"}}),zu=6,_8=zi.fromClass(class{constructor(e){this.view=e,this.text=B8(e),this.selection=R8(e),this.diagnostic=L8(e),e.state.facet(as)&&this.create(e)}create(e){const t=e.state.facet(as);if(!t)throw Error("Expected nonnull");this.inner=Ea("div",{class:"cm-minimap-inner"}),this.canvas=Ea("canvas"),this.dom=t.create(e).dom,this.dom.classList.add("cm-gutters"),this.dom.classList.add("cm-minimap-gutter"),this.inner.appendChild(this.canvas),this.dom.appendChild(this.inner),this.view.scrollDOM.insertBefore(this.dom,this.view.contentDOM.nextSibling);for(const r in this.view.state.facet(hr).eventHandlers){const a=this.view.state.facet(hr).eventHandlers[r];a&&this.dom.addEventListener(r,s=>a(s,this.view))}}remove(){this.dom&&this.dom.remove()}update(e){const t=e.startState.facet(as),r=e.state.facet(as);if(t&&!r){this.remove();return}!t&&r&&this.create(e.view),r&&(this.text.update(e),this.selection.update(e),this.diagnostic.update(e),this.render())}getWidth(){const e=this.view.dom.clientWidth;if(e<=Cr.MaxWidth*zu){const t=e/(Cr.MaxWidth*zu);return Cr.MaxWidth*t}return Cr.MaxWidth}render(){if(!this.dom||!this.canvas||!this.inner)return;this.text.beforeDraw(),this.updateBoxShadow(),this.dom.style.width=this.getWidth()+"px",this.canvas.style.maxWidth=this.getWidth()+"px",this.canvas.width=this.getWidth()*Cr.PixelMultiplier;const e=this.view.dom.getBoundingClientRect().height;this.inner.style.minHeight=e+"px",this.canvas.height=e*Cr.PixelMultiplier,this.canvas.style.height=e+"px";const t=this.canvas.getContext("2d");if(!t)return;t.clearRect(0,0,this.canvas.width,this.canvas.height);const{charWidth:r,lineHeight:a}=this.text.measure(t);let{startIndex:s,endIndex:i,offsetY:o}=this.canvasStartAndEndIndex(t,a);const l=this.view.state.facet(hr).gutters;for(let c=s;c<i;c++){const d=this.view.state.field(Fa);if(c>=d.length)break;const u={offsetX:0,offsetY:o,context:t,lineHeight:a,charWidth:r};if(l.length){u.offsetX+=2;for(let m of l)O8(m,u,c+1),u.offsetX+=pf;u.offsetX+=2}this.text.drawLine(u,c+1),this.selection.drawLine(u,c+1),this.diagnostic.drawLine(u,c+1),o+=a}t.restore()}canvasStartAndEndIndex(e,t){let{top:r,bottom:a}=this.view.documentPadding;r/=Cr.SizeRatio,a/=Cr.SizeRatio;const s=e.canvas.height,{clientHeight:i,scrollHeight:o,scrollTop:l}=this.view.scrollDOM;let c=l/(o-i);isNaN(c)&&(c=0);const d=this.view.state.field(Fa).length,u=r+a+d*t,m=Math.max(0,c*(u-s)),h=Math.max(0,r-m),p=Math.round(Math.max(0,m-r)/t),g=Math.round((s-h)/t);return{startIndex:p,endIndex:p+g,offsetY:h}}updateBoxShadow(){if(!this.canvas)return;const{clientWidth:e,scrollWidth:t,scrollLeft:r}=this.view.scrollDOM;e+r<t?this.canvas.classList.add("cm-minimap-box-shadow"):this.canvas.classList.remove("cm-minimap-box-shadow")}destroy(){this.remove()}},{eventHandlers:{scroll(){requestAnimationFrame(()=>this.render())}},provide:e=>Rr.scrollMargins.of(t=>{var r;const a=(r=t.plugin(e))===null||r===void 0?void 0:r.getWidth();return a?{right:a}:null})}),as=Di.define({combine:e=>{var t;return(t=e.find(r=>r!==null))!==null&&t!==void 0?t:null},enables:e=>[[hr.compute([e],t=>t.facet(e)),$8,Fa,_8,D8]]});function _l({file:e,onClose:t,projectPath:r,isSidebar:a=!1,isExpanded:s=!1,onToggleExpand:i=null}){const[o,l]=b.useState(""),[c,d]=b.useState(!0),[u,m]=b.useState(!1),[h,p]=b.useState(!1),[g,y]=b.useState(()=>{const j=localStorage.getItem("codeEditorTheme");return j?j==="dark":!0}),[v,w]=b.useState(!1),[S,N]=b.useState(!!e.diffInfo),[I,F]=b.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[E,R]=b.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[H,$]=b.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[A,V]=b.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),T=b.useRef(null),U=b.useMemo(()=>{if(!e.diffInfo||!S||!E)return[];const j={};return[as.compute(["doc"],ne=>{const M=Yo(ne)?.chunks||[];return Object.keys(j).forEach(ie=>delete j[ie]),M.forEach(ie=>{const Me=ne.doc.lineAt(ie.fromB).number,Se=ne.doc.lineAt(Math.min(ie.toB,ne.doc.length)).number;for(let me=Me;me<=Se;me++)j[me]=g?"rgba(34, 197, 94, 0.8)":"rgba(34, 197, 94, 1)"}),{create:()=>({dom:document.createElement("div")}),displayText:"blocks",showOverlay:"always",gutters:[j]}})]},[e.diffInfo,S,E,g]),P=b.useMemo(()=>!e.diffInfo||!S?[]:[zi.fromClass(class{constructor(j){setTimeout(()=>{const ue=Yo(j.state)?.chunks||[];if(ue.length>0){const M=ue[0];j.dispatch({effects:Rr.scrollIntoView(M.fromB,{y:"center"})})}},100)}update(){}destroy(){}})],[e.diffInfo,S]),_=b.useMemo(()=>{const j=ne=>{const ue=document.createElement("div");ue.className="cm-editor-toolbar-panel";let M=0;const ie=()=>{const Me=e.diffInfo&&S,me=(Me?Yo(ne.state):null)?.chunks||[],_e=me.length;let ce='<div style="display: flex; align-items: center; justify-content: space-between; width: 100%;">';if(ce+='<div style="display: flex; align-items: center; gap: 8px;">',Me&&(ce+=`
801
+ <span style="font-weight: 500;">${_e>0?`${M+1}/${_e}`:"0"} changes</span>
802
+ <button class="cm-diff-nav-btn cm-diff-nav-prev" title="Previous change" ${_e===0?"disabled":""}>
803
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
804
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7" />
805
+ </svg>
806
+ </button>
807
+ <button class="cm-diff-nav-btn cm-diff-nav-next" title="Next change" ${_e===0?"disabled":""}>
808
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
809
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
810
+ </svg>
811
+ </button>
812
+ `),ce+="</div>",ce+='<div style="display: flex; align-items: center; gap: 4px;">',e.diffInfo&&(ce+=`
813
+ <button class="cm-toolbar-btn cm-toggle-diff-btn" title="${S?"Hide diff highlighting":"Show diff highlighting"}">
814
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
815
+ ${S?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />'}
816
+ </svg>
817
+ </button>
818
+ `),ce+=`
819
+ <button class="cm-toolbar-btn cm-settings-btn" title="Editor Settings">
820
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
821
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
822
+ </svg>
823
+ </button>
824
+ `,a&&i&&(ce+=`
825
+ <button class="cm-toolbar-btn cm-expand-btn" title="${s?"Collapse editor":"Expand editor to full width"}">
826
+ <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
827
+ ${s?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" />'}
828
+ </svg>
829
+ </button>
830
+ `),ce+="</div>",ce+="</div>",ue.innerHTML=ce,Me){const He=ue.querySelector(".cm-diff-nav-prev"),Le=ue.querySelector(".cm-diff-nav-next");He?.addEventListener("click",()=>{if(me.length===0)return;M=M>0?M-1:me.length-1;const rt=me[M];rt&&ne.dispatch({effects:Rr.scrollIntoView(rt.fromB,{y:"center"})}),ie()}),Le?.addEventListener("click",()=>{if(me.length===0)return;M=M<me.length-1?M+1:0;const rt=me[M];rt&&ne.dispatch({effects:Rr.scrollIntoView(rt.fromB,{y:"center"})}),ie()})}e.diffInfo&&ue.querySelector(".cm-toggle-diff-btn")?.addEventListener("click",()=>{N(!S)}),ue.querySelector(".cm-settings-btn")?.addEventListener("click",()=>{window.openSettings&&window.openSettings("appearance")}),a&&i&&ue.querySelector(".cm-expand-btn")?.addEventListener("click",()=>{i()})};return ie(),{top:!0,dom:ue,update:ie}};return[_f.of(j)]},[e.diffInfo,S,a,s,i]),se=j=>{const ne=j.split(".").pop()?.toLowerCase();switch(ne){case"js":case"jsx":case"ts":case"tsx":return[Vf({jsx:!0,typescript:ne.includes("ts")})];case"py":return[Uf()];case"html":case"htm":return[Wf()];case"css":case"scss":case"less":return[Hf()];case"json":return[qf()];case"md":case"markdown":return[Hu()];default:return[]}};b.useEffect(()=>{(async()=>{try{if(d(!0),e.diffInfo&&e.diffInfo.new_string!==void 0&&e.diffInfo.old_string!==void 0){l(e.diffInfo.new_string),d(!1);return}const ne=await lt.readFile(e.projectName,e.path);if(!ne.ok)throw new Error(`Failed to load file: ${ne.status} ${ne.statusText}`);const ue=await ne.json();l(ue.content)}catch(ne){console.error("Error loading file:",ne),l(`// Error loading file: ${ne.message}
831
+ // File: ${e.name}
832
+ // Path: ${e.path}`)}finally{d(!1)}})()},[e,r]);const de=async()=>{m(!0);try{console.log("Saving file:",{projectName:e.projectName,path:e.path,contentLength:o?.length});const j=await lt.saveFile(e.projectName,e.path,o);if(console.log("Save response:",{status:j.status,ok:j.ok,contentType:j.headers.get("content-type")}),!j.ok){const ue=j.headers.get("content-type");if(ue&&ue.includes("application/json")){const M=await j.json();throw new Error(M.error||`Save failed: ${j.status}`)}else{const M=await j.text();throw console.error("Non-JSON error response:",M),new Error(`Save failed: ${j.status} ${j.statusText}`)}}const ne=await j.json();console.log("Save successful:",ne),w(!0),setTimeout(()=>w(!1),2e3)}catch(j){console.error("Error saving file:",j),alert(`Error saving file: ${j.message}`)}finally{m(!1)}},J=()=>{const j=new Blob([o],{type:"text/plain"}),ne=URL.createObjectURL(j),ue=document.createElement("a");ue.href=ne,ue.download=e.name,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),URL.revokeObjectURL(ne)},X=()=>{p(!h)};return b.useEffect(()=>{localStorage.setItem("codeEditorTheme",g?"dark":"light")},[g]),b.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",I.toString())},[I]),b.useEffect(()=>{const j=()=>{const ne=localStorage.getItem("codeEditorTheme");ne&&y(ne==="dark");const ue=localStorage.getItem("codeEditorWordWrap");ue!==null&&F(ue==="true");const M=localStorage.getItem("codeEditorShowMinimap");M!==null&&R(M!=="false");const ie=localStorage.getItem("codeEditorLineNumbers");ie!==null&&$(ie!=="false");const Me=localStorage.getItem("codeEditorFontSize");Me&&V(Me)};return window.addEventListener("storage",j),window.addEventListener("codeEditorSettingsChanged",j),()=>{window.removeEventListener("storage",j),window.removeEventListener("codeEditorSettingsChanged",j)}},[]),b.useEffect(()=>{const j=ne=>{(ne.ctrlKey||ne.metaKey)&&(ne.key==="s"?(ne.preventDefault(),de()):ne.key==="Escape"&&(ne.preventDefault(),t()))};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o]),c?n.jsxs(n.Fragment,{children:[n.jsx("style",{children:`
833
+ .code-editor-loading {
834
+ background-color: ${g?"#111827":"#ffffff"} !important;
835
+ }
836
+ .code-editor-loading:hover {
837
+ background-color: ${g?"#111827":"#ffffff"} !important;
838
+ }
839
+ `}),a?n.jsx("div",{className:"w-full h-full flex items-center justify-center bg-background",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),n.jsxs("span",{className:"text-gray-900 dark:text-white",children:["Loading ",e.name,"..."]})]})}):n.jsx("div",{className:"fixed inset-0 z-40 md:bg-black/50 md:flex md:items-center md:justify-center",children:n.jsx("div",{className:"code-editor-loading w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),n.jsxs("span",{className:"text-gray-900 dark:text-white",children:["Loading ",e.name,"..."]})]})})})]}):n.jsxs(n.Fragment,{children:[n.jsx("style",{children:`
840
+ /* Light background for full line changes */
841
+ .cm-deletedChunk {
842
+ background-color: ${g?"rgba(239, 68, 68, 0.15)":"rgba(255, 235, 235, 1)"} !important;
843
+ border-left: 3px solid ${g?"rgba(239, 68, 68, 0.6)":"rgb(239, 68, 68)"} !important;
844
+ padding-left: 4px !important;
845
+ }
846
+
847
+ .cm-insertedChunk {
848
+ background-color: ${g?"rgba(34, 197, 94, 0.15)":"rgba(230, 255, 237, 1)"} !important;
849
+ border-left: 3px solid ${g?"rgba(34, 197, 94, 0.6)":"rgb(34, 197, 94)"} !important;
850
+ padding-left: 4px !important;
851
+ }
852
+
853
+ /* Override linear-gradient underline and use solid darker background for partial changes */
854
+ .cm-editor.cm-merge-b .cm-changedText {
855
+ background: ${g?"rgba(34, 197, 94, 0.4)":"rgba(34, 197, 94, 0.3)"} !important;
856
+ padding-top: 2px !important;
857
+ padding-bottom: 2px !important;
858
+ margin-top: -2px !important;
859
+ margin-bottom: -2px !important;
860
+ }
861
+
862
+ .cm-editor .cm-deletedChunk .cm-changedText {
863
+ background: ${g?"rgba(239, 68, 68, 0.4)":"rgba(239, 68, 68, 0.3)"} !important;
864
+ padding-top: 2px !important;
865
+ padding-bottom: 2px !important;
866
+ margin-top: -2px !important;
867
+ margin-bottom: -2px !important;
868
+ }
869
+
870
+ /* Minimap gutter styling */
871
+ .cm-gutter.cm-gutter-minimap {
872
+ background-color: ${g?"#1e1e1e":"#f5f5f5"};
873
+ }
874
+
875
+ /* Editor toolbar panel styling */
876
+ .cm-editor-toolbar-panel {
877
+ padding: 8px 12px;
878
+ background-color: ${g?"#1f2937":"#ffffff"};
879
+ border-bottom: 1px solid ${g?"#374151":"#e5e7eb"};
880
+ color: ${g?"#d1d5db":"#374151"};
881
+ font-size: 14px;
882
+ }
883
+
884
+ .cm-diff-nav-btn,
885
+ .cm-toolbar-btn {
886
+ padding: 4px;
887
+ background: transparent;
888
+ border: none;
889
+ cursor: pointer;
890
+ border-radius: 4px;
891
+ display: inline-flex;
892
+ align-items: center;
893
+ justify-content: center;
894
+ color: inherit;
895
+ transition: background-color 0.2s;
896
+ }
897
+
898
+ .cm-diff-nav-btn:hover,
899
+ .cm-toolbar-btn:hover {
900
+ background-color: ${g?"#374151":"#f3f4f6"};
901
+ }
902
+
903
+ .cm-diff-nav-btn:disabled {
904
+ opacity: 0.5;
905
+ cursor: not-allowed;
906
+ }
907
+ `}),n.jsx("div",{className:a?"w-full h-full flex flex-col":`fixed inset-0 z-40 md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${h?"md:p-0":""}`,children:n.jsxs("div",{className:a?"bg-background flex flex-col w-full h-full":`bg-background shadow-2xl flex flex-col ${"w-full h-full md:rounded-lg md:shadow-2xl"+(h?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]")}`,children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border flex-shrink-0 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("h3",{className:"font-medium text-gray-900 dark:text-white truncate",children:e.name}),e.diffInfo&&n.jsx("span",{className:"text-xs bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-300 px-2 py-1 rounded whitespace-nowrap",children:"Showing changes"})]}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:e.path})]})}),n.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:J,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download file",children:n.jsx(pi,{className:"w-5 h-5 md:w-4 md:h-4"})}),n.jsx("button",{onClick:de,disabled:u,className:`px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors min-h-[44px] md:min-h-0 ${v?"bg-green-600 hover:bg-green-700":"bg-blue-600 hover:bg-blue-700"}`,children:v?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),n.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(xi,{className:"w-5 h-5 md:w-4 md:h-4"}),n.jsx("span",{className:"hidden sm:inline",children:u?"Saving...":"Save"})]})}),!a&&n.jsx("button",{onClick:X,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:h?"Exit fullscreen":"Fullscreen",children:h?n.jsx(Yu,{className:"w-4 h-4"}):n.jsx(Jl,{className:"w-4 h-4"})}),n.jsx("button",{onClick:t,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:n.jsx(Mt,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),n.jsx("div",{className:"flex-1 overflow-hidden",children:n.jsx(_u,{ref:T,value:o,onChange:l,extensions:[...se(e.name),..._,...e.diffInfo&&S&&e.diffInfo.old_string!==void 0?[v8({original:e.diffInfo.old_string,mergeControls:!1,highlightChanges:!0,syntaxHighlightDeletions:!1,gutter:!0}),...U,...P]:[],...I?[Rr.lineWrapping]:[]],theme:g?qu:void 0,height:"100%",style:{fontSize:`${A}px`,height:"100%"},basicSetup:{lineNumbers:H,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),n.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-border bg-muted flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[n.jsxs("span",{children:["Lines: ",o.split(`
908
+ `).length]}),n.jsxs("span",{children:["Characters: ",o.length]})]}),n.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]})})]})}function q8({file:e,onClose:t}){const r=`/api/projects/${e.projectName}/files/content?path=${encodeURIComponent(e.path)}`,[a,s]=b.useState(null),[i,o]=b.useState(null),[l,c]=b.useState(!0);return b.useEffect(()=>{let d;const u=new AbortController;return(async()=>{try{c(!0),o(null),s(null);const h=await je(r,{signal:u.signal});if(!h.ok)throw new Error(`Request failed with status ${h.status}`);const p=await h.blob();d=URL.createObjectURL(p),s(d)}catch(h){if(h.name==="AbortError")return;console.error("Error loading image:",h),o("Unable to load image")}finally{c(!1)}})(),()=>{u.abort(),d&&URL.revokeObjectURL(d)}},[r]),n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:e.name}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:n.jsx(Mt,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[l&&n.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:n.jsx("p",{children:"Loading image…"})}),!l&&a&&n.jsx("img",{src:a,alt:e.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md"}),!l&&!a&&n.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[n.jsx("p",{children:i||"Unable to load image"}),n.jsx("p",{className:"text-sm mt-2 break-all",children:e.path})]})]}),n.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.path})})]})})}function H8({selectedProject:e}){const[t,r]=b.useState([]),[a,s]=b.useState(!1),[i,o]=b.useState(new Set),[l,c]=b.useState(null),[d,u]=b.useState(null),[m,h]=b.useState("detailed"),[p,g]=b.useState(""),[y,v]=b.useState([]);b.useEffect(()=>{e&&S()},[e]),b.useEffect(()=>{const T=localStorage.getItem("file-tree-view-mode");T&&["simple","detailed","compact"].includes(T)&&h(T)},[]),b.useEffect(()=>{if(!p.trim())v(t);else{const T=w(t,p.toLowerCase());v(T);const U=P=>{P.forEach(_=>{_.type==="directory"&&_.children&&_.children.length>0&&(o(se=>new Set(se.add(_.path))),U(_.children))})};U(T)}},[t,p]);const w=(T,U)=>T.reduce((P,_)=>{const se=_.name.toLowerCase().includes(U);let de=[];return _.type==="directory"&&_.children&&(de=w(_.children,U)),(se||de.length>0)&&P.push({..._,children:de}),P},[]),S=async()=>{s(!0);try{const T=await lt.getFiles(e.name);if(!T.ok){const P=await T.text();console.error("❌ File fetch failed:",T.status,P),r([]);return}const U=await T.json();r(U)}catch(T){console.error("❌ Error fetching files:",T),r([])}finally{s(!1)}},N=T=>{const U=new Set(i);U.has(T)?U.delete(T):U.add(T),o(U)},I=T=>{h(T),localStorage.setItem("file-tree-view-mode",T)},F=T=>{if(!T||T===0)return"0 B";const U=1024,P=["B","KB","MB","GB"],_=Math.floor(Math.log(T)/Math.log(U));return parseFloat((T/Math.pow(U,_)).toFixed(1))+" "+P[_]},E=T=>{if(!T)return"-";const U=new Date,P=new Date(T),_=Math.floor((U-P)/1e3);return _<60?"just now":_<3600?`${Math.floor(_/60)} min ago`:_<86400?`${Math.floor(_/3600)} hours ago`:_<2592e3?`${Math.floor(_/86400)} days ago`:P.toLocaleDateString()},R=(T,U=0)=>T.map(P=>n.jsxs("div",{className:"select-none",children:[n.jsx(qe,{variant:"ghost",className:Ke("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent"),style:{paddingLeft:`${U*16+12}px`},onClick:()=>{P.type==="directory"?N(P.path):H(P.name)?u({name:P.name,path:P.path,projectPath:e.path,projectName:e.name}):c({name:P.name,path:P.path,projectPath:e.path,projectName:e.name})},children:n.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[P.type==="directory"?i.has(P.path)?n.jsx(ia,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):n.jsx(On,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):$(P.name),n.jsx("span",{className:"text-sm truncate text-foreground",children:P.name})]})}),P.type==="directory"&&i.has(P.path)&&P.children&&P.children.length>0&&n.jsx("div",{children:R(P.children,U+1)})]},P.path)),H=T=>{const U=T.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(U)},$=T=>{const U=T.split(".").pop()?.toLowerCase(),P=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],_=["md","txt","doc","pdf"],se=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return P.includes(U)?n.jsx($g,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):_.includes(U)?n.jsx(yr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):se.includes(U)?n.jsx(rc,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}):n.jsx(rc,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})},A=(T,U=0)=>T.map(P=>n.jsxs("div",{className:"select-none",children:[n.jsxs("div",{className:Ke("grid grid-cols-12 gap-2 p-2 hover:bg-accent cursor-pointer items-center"),style:{paddingLeft:`${U*16+12}px`},onClick:()=>{P.type==="directory"?N(P.path):H(P.name)?u({name:P.name,path:P.path,projectPath:e.path,projectName:e.name}):c({name:P.name,path:P.path,projectPath:e.path,projectName:e.name})},children:[n.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[P.type==="directory"?i.has(P.path)?n.jsx(ia,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):n.jsx(On,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):$(P.name),n.jsx("span",{className:"text-sm truncate text-foreground",children:P.name})]}),n.jsx("div",{className:"col-span-2 text-sm text-muted-foreground",children:P.type==="file"?F(P.size):"-"}),n.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:E(P.modified)}),n.jsx("div",{className:"col-span-2 text-sm text-muted-foreground font-mono",children:P.permissionsRwx||"-"})]}),P.type==="directory"&&i.has(P.path)&&P.children&&A(P.children,U+1)]},P.path)),V=(T,U=0)=>T.map(P=>n.jsxs("div",{className:"select-none",children:[n.jsxs("div",{className:Ke("flex items-center justify-between p-2 hover:bg-accent cursor-pointer"),style:{paddingLeft:`${U*16+12}px`},onClick:()=>{P.type==="directory"?N(P.path):H(P.name)?u({name:P.name,path:P.path,projectPath:e.path,projectName:e.name}):c({name:P.name,path:P.path,projectPath:e.path,projectName:e.name})},children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[P.type==="directory"?i.has(P.path)?n.jsx(ia,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):n.jsx(On,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}):$(P.name),n.jsx("span",{className:"text-sm truncate text-foreground",children:P.name})]}),n.jsx("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:P.type==="file"&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:F(P.size)}),n.jsx("span",{className:"font-mono",children:P.permissionsRwx})]})})]}),P.type==="directory"&&i.has(P.path)&&P.children&&V(P.children,U+1)]},P.path));return a?n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading files..."})}):n.jsxs("div",{className:"h-full flex flex-col bg-card",children:[n.jsxs("div",{className:"p-4 border-b border-border space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Files"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(qe,{variant:m==="simple"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>I("simple"),title:"Simple view",children:n.jsx(gi,{className:"w-4 h-4"})}),n.jsx(qe,{variant:m==="compact"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>I("compact"),title:"Compact view",children:n.jsx(ws,{className:"w-4 h-4"})}),n.jsx(qe,{variant:m==="detailed"?"default":"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>I("detailed"),title:"Detailed view",children:n.jsx(Hx,{className:"w-4 h-4"})})]})]}),n.jsxs("div",{className:"relative",children:[n.jsx(Ia,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),n.jsx(Ht,{type:"text",placeholder:"Search files and folders...",value:p,onChange:T=>g(T.target.value),className:"pl-8 pr-8 h-8 text-sm"}),p&&n.jsx(qe,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-accent",onClick:()=>g(""),title:"Clear search",children:n.jsx(Mt,{className:"w-3 h-3"})})]})]}),m==="detailed"&&y.length>0&&n.jsx("div",{className:"px-4 pt-2 pb-1 border-b border-border",children:n.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[n.jsx("div",{className:"col-span-5",children:"Name"}),n.jsx("div",{className:"col-span-2",children:"Size"}),n.jsx("div",{className:"col-span-3",children:"Modified"}),n.jsx("div",{className:"col-span-2",children:"Permissions"})]})}),n.jsx(Ql,{className:"flex-1 p-4",children:t.length===0?n.jsxs("div",{className:"text-center py-8",children:[n.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:n.jsx(On,{className:"w-6 h-6 text-muted-foreground"})}),n.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No files found"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Check if the project path is accessible"})]}):y.length===0&&p?n.jsxs("div",{className:"text-center py-8",children:[n.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:n.jsx(Ia,{className:"w-6 h-6 text-muted-foreground"})}),n.jsx("h4",{className:"font-medium text-foreground mb-1",children:"No matches found"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Try a different search term or clear the search"})]}):n.jsxs("div",{className:m==="detailed"?"":"space-y-1",children:[m==="simple"&&R(y),m==="compact"&&V(y),m==="detailed"&&A(y)]})}),l&&n.jsx(_l,{file:l,onClose:()=>c(null),projectPath:l.projectPath}),d&&n.jsx(q8,{file:d,onClose:()=>u(null)})]})}function ff({project:e,session:t=null,command:r=null,isPlainShell:a=null,autoConnect:s=!0,onComplete:i=null,onClose:o=null,title:l=null,className:c="",showHeader:d=!0,compact:u=!1,minimal:m=!1}){const[h,p]=b.useState(!1),g=a!==null?a:r!==null,y=b.useCallback(v=>{p(!0),i&&i(v)},[i]);return e?n.jsxs("div",{className:`h-full w-full flex flex-col ${c}`,children:[!m&&d&&l&&n.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-200",children:l}),h&&n.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),o&&n.jsx("button",{onClick:o,className:"text-gray-400 hover:text-white",title:"Close",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),n.jsx("div",{className:"flex-1 w-full min-h-0",children:n.jsx(O0,{selectedProject:e,selectedSession:t,initialCommand:r,isPlainShell:g,onProcessComplete:y,minimal:m,autoConnect:m?!0:s})})]}):n.jsx("div",{className:`h-full flex items-center justify-center ${c}`,children:n.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[n.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:n.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),n.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Project Selected"}),n.jsx("p",{children:"A project is required to open a shell"})]})})}function Lu({diff:e,fileName:t,isMobile:r,wrapText:a}){if(!e)return n.jsx("div",{className:"p-4 text-center text-gray-500 dark:text-gray-400 text-sm",children:"No diff available"});const s=(i,o)=>{const l=i.startsWith("+")&&!i.startsWith("+++"),c=i.startsWith("-")&&!i.startsWith("---"),d=i.startsWith("@@");return n.jsx("div",{className:`font-mono text-xs p-2 ${r&&a?"whitespace-pre-wrap break-all":"whitespace-pre overflow-x-auto"} ${l?"bg-green-50 dark:bg-green-950 text-green-700 dark:text-green-300":c?"bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300":d?"bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`,children:i},o)};return n.jsx("div",{className:"diff-viewer",children:e.split(`
909
+ `).map((i,o)=>s(i,o))})}function W8({selectedProject:e,isMobile:t,onFileOpen:r}){const[a,s]=b.useState(null),[i,o]=b.useState({}),[l,c]=b.useState(!1),[d,u]=b.useState(""),[m,h]=b.useState(new Set),[p,g]=b.useState(new Set),[y,v]=b.useState(!1),[w,S]=b.useState(""),[N,I]=b.useState([]),[F,E]=b.useState(!0),[R,H]=b.useState(!1),[$,A]=b.useState(!1),[V,T]=b.useState(!1),[U,P]=b.useState(""),[_,se]=b.useState(!1),[de,J]=b.useState("changes"),[X,j]=b.useState([]),[ne,ue]=b.useState(new Set),[M,ie]=b.useState({}),[Me,Se]=b.useState(!1),[me,_e]=b.useState(null),[ce,ve]=b.useState(!1),[He,Le]=b.useState(!1),[rt,Ye]=b.useState(!1),[yt,mt]=b.useState(!1),[vt,ft]=b.useState(t),[Ue,bt]=b.useState(null),[kt,Vt]=b.useState(!1),Ve=b.useRef(null),we=b.useRef(null),[Ae,q]=b.useState(()=>localStorage.getItem("selected-provider")||"claude");b.useEffect(()=>{const Q=()=>{const le=localStorage.getItem("selected-provider")||"claude";q(le)};return window.addEventListener("storage",Q),()=>window.removeEventListener("storage",Q)},[]),b.useEffect(()=>{e&&(G(),be(),Pe(),de==="history"&&Zt())},[e,de]),b.useEffect(()=>{const Q=le=>{we.current&&!we.current.contains(le.target)&&A(!1)};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[]);const G=async()=>{if(e){c(!0);try{const le=await(await je(`/api/git/status?project=${encodeURIComponent(e.name)}`)).json();if(le.error)console.error("Git status error:",le.error),s({error:le.error,details:le.details});else{s(le),S(le.branch||"main");const Je=new Set([...le.modified||[],...le.added||[],...le.deleted||[],...le.untracked||[]]);g(Je);for(const St of le.modified||[])Ct(St);for(const St of le.added||[])Ct(St);for(const St of le.deleted||[])Ct(St);for(const St of le.untracked||[])Ct(St)}}catch(Q){console.error("Error fetching git status:",Q)}finally{c(!1)}}},be=async()=>{try{const le=await(await je(`/api/git/branches?project=${encodeURIComponent(e.name)}`)).json();!le.error&&le.branches&&I(le.branches)}catch(Q){console.error("Error fetching branches:",Q)}},Pe=async()=>{if(e)try{const le=await(await je(`/api/git/remote-status?project=${encodeURIComponent(e.name)}`)).json();le.error?_e(null):_e(le)}catch(Q){console.error("Error fetching remote status:",Q),_e(null)}},st=async Q=>{try{const Je=await(await je("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:Q})})).json();Je.success?(S(Q),A(!1),G()):console.error("Failed to switch branch:",Je.error)}catch(le){console.error("Error switching branch:",le)}},he=async()=>{if(U.trim()){se(!0);try{const le=await(await je("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:U.trim()})})).json();le.success?(S(U.trim()),T(!1),A(!1),P(""),be(),G()):console.error("Failed to create branch:",le.error)}catch(Q){console.error("Error creating branch:",Q)}finally{se(!1)}}},B=async()=>{ve(!0);try{const le=await(await je("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();le.success?(G(),Pe()):console.error("Fetch failed:",le.error)}catch(Q){console.error("Error fetching from remote:",Q)}finally{ve(!1)}},ee=async()=>{Le(!0);try{const le=await(await je("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();le.success?(G(),Pe()):console.error("Pull failed:",le.error)}catch(Q){console.error("Error pulling from remote:",Q)}finally{Le(!1)}},ge=async()=>{Ye(!0);try{const le=await(await je("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();le.success?(G(),Pe()):console.error("Push failed:",le.error)}catch(Q){console.error("Error pushing to remote:",Q)}finally{Ye(!1)}},Ne=async()=>{mt(!0);try{const le=await(await je("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,branch:w})})).json();le.success?(G(),Pe()):console.error("Publish failed:",le.error)}catch(Q){console.error("Error publishing branch:",Q)}finally{mt(!1)}},Z=async Q=>{try{const Je=await(await je("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:Q})})).json();Je.success?(g(St=>{const Wt=new Set(St);return Wt.delete(Q),Wt}),G()):console.error("Discard failed:",Je.error)}catch(le){console.error("Error discarding changes:",le)}},Ce=async Q=>{try{const Je=await(await je("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,file:Q})})).json();Je.success?(g(St=>{const Wt=new Set(St);return Wt.delete(Q),Wt}),G()):console.error("Delete failed:",Je.error)}catch(le){console.error("Error deleting untracked file:",le)}},Ze=async()=>{if(!Ue)return;const{type:Q,file:le,message:Je}=Ue;bt(null);try{switch(Q){case"discard":await Z(le);break;case"delete":await Ce(le);break;case"commit":await sr();break;case"pull":await ee();break;case"push":await ge();break;case"publish":await Ne();break}}catch(St){console.error(`Error executing ${Q}:`,St)}},Ct=async Q=>{try{const Je=await(await je(`/api/git/diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(Q)}`)).json();!Je.error&&Je.diff&&o(St=>({...St,[Q]:Je.diff}))}catch(le){console.error("Error fetching file diff:",le)}},At=async Q=>{if(r)try{const Je=await(await je(`/api/git/file-with-diff?project=${encodeURIComponent(e.name)}&file=${encodeURIComponent(Q)}`)).json();if(Je.error){console.error("Error fetching file with diff:",Je.error),r(Q);return}const St={old_string:Je.oldContent||"",new_string:Je.currentContent||""};r(Q,St)}catch(le){console.error("Error opening file:",le),r(Q)}},Zt=async()=>{try{const le=await(await je(`/api/git/commits?project=${encodeURIComponent(e.name)}&limit=10`)).json();!le.error&&le.commits&&j(le.commits)}catch(Q){console.error("Error fetching commits:",Q)}},Xr=async Q=>{try{const Je=await(await je(`/api/git/commit-diff?project=${encodeURIComponent(e.name)}&commit=${Q}`)).json();!Je.error&&Je.diff&&ie(St=>({...St,[Q]:Je.diff}))}catch(le){console.error("Error fetching commit diff:",le)}},Qr=async()=>{Se(!0);try{const le=await(await je("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,files:Array.from(p),provider:Ae})})).json();le.message?u(le.message):console.error("Failed to generate commit message:",le.error)}catch(Q){console.error("Error generating commit message:",Q)}finally{Se(!1)}},Dn=Q=>{h(le=>{const Je=new Set(le);return Je.has(Q)?Je.delete(Q):Je.add(Q),Je})},er=Q=>{ue(le=>{const Je=new Set(le);return Je.has(Q)?Je.delete(Q):(Je.add(Q),M[Q]||Xr(Q)),Je})},fr=Q=>{g(le=>{const Je=new Set(le);return Je.has(Q)?Je.delete(Q):Je.add(Q),Je})},sr=async()=>{if(!(!d.trim()||p.size===0)){v(!0);try{const le=await(await je("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name,message:d,files:Array.from(p)})})).json();le.success?(u(""),g(new Set),G(),Pe()):console.error("Commit failed:",le.error)}catch(Q){console.error("Error committing changes:",Q)}finally{v(!1)}}},Pt=async()=>{Vt(!0);try{const le=await(await je("/api/git/initial-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.name})})).json();le.success?(G(),Pe()):(console.error("Initial commit failed:",le.error),alert(le.error||"Failed to create initial commit"))}catch(Q){console.error("Error creating initial commit:",Q),alert("Failed to create initial commit")}finally{Vt(!1)}},qr=Q=>{switch(Q){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return Q}},lr=Q=>{const le=ne.has(Q.hash),Je=M[Q.hash];return n.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[n.jsxs("div",{className:"flex items-start p-3 hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer",onClick:()=>er(Q.hash),children:[n.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",children:le?n.jsx(Pr,{className:"w-3 h-3"}):n.jsx(cn,{className:"w-3 h-3"})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:Q.message}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:[Q.author," • ",Q.date]})]}),n.jsx("span",{className:"text-xs font-mono text-gray-400 dark:text-gray-500 flex-shrink-0",children:Q.hash.substring(0,7)})]})})]}),le&&Je&&n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900",children:n.jsxs("div",{className:"max-h-96 overflow-y-auto p-2",children:[n.jsx("div",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 mb-2",children:Q.stats}),n.jsx(Lu,{diff:Je,fileName:"commit",isMobile:t,wrapText:F})]})})]},Q.hash)},Gt=(Q,le)=>{const Je=m.has(Q),St=p.has(Q),Wt=i[Q];return n.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 last:border-0",children:[n.jsxs("div",{className:`flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 ${t?"px-2 py-1.5":"px-3 py-2"}`,children:[n.jsx("input",{type:"checkbox",checked:St,onChange:()=>fr(Q),onClick:nr=>nr.stopPropagation(),className:`rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600 ${t?"mr-1.5":"mr-2"}`}),n.jsxs("div",{className:"flex items-center flex-1",children:[n.jsx("div",{className:`p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer ${t?"mr-1":"mr-2"}`,onClick:nr=>{nr.stopPropagation(),Dn(Q)},children:n.jsx(cn,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${Je?"rotate-90":"rotate-0"}`})}),n.jsx("span",{className:`flex-1 truncate ${t?"text-xs":"text-sm"} cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 hover:underline`,onClick:nr=>{nr.stopPropagation(),At(Q)},title:"Click to open file",children:Q}),n.jsxs("div",{className:"flex items-center gap-1",children:[(le==="M"||le==="D")&&n.jsxs("button",{onClick:nr=>{nr.stopPropagation(),bt({type:"discard",file:Q,message:`Discard all changes to "${Q}"? This action cannot be undone.`})},className:`${t?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Discard changes",children:[n.jsx(Tr,{className:"w-3 h-3"}),t&&n.jsx("span",{children:"Discard"})]}),le==="U"&&n.jsxs("button",{onClick:nr=>{nr.stopPropagation(),bt({type:"delete",file:Q,message:`Delete untracked file "${Q}"? This action cannot be undone.`})},className:`${t?"px-2 py-1 text-xs":"p-1"} hover:bg-red-100 dark:hover:bg-red-900 rounded text-red-600 dark:text-red-400 font-medium flex items-center gap-1`,title:"Delete untracked file",children:[n.jsx(Tr,{className:"w-3 h-3"}),t&&n.jsx("span",{children:"Delete"})]}),n.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${le==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":le==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":le==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,title:qr(le),children:le})]})]})]}),n.jsxs("div",{className:`bg-gray-50 dark:bg-gray-900 transition-all duration-400 ease-in-out overflow-hidden ${Je&&Wt?"max-h-[600px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-1"}`,children:[n.jsxs("div",{className:"flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-xs font-bold border ${le==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800":le==="A"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 border-green-200 dark:border-green-800":le==="D"?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 border-red-200 dark:border-red-800":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 border-gray-300 dark:border-gray-600"}`,children:le}),n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:qr(le)})]}),t&&n.jsx("button",{onClick:nr=>{nr.stopPropagation(),E(!F)},className:"text-xs text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",title:F?"Switch to horizontal scroll":"Switch to text wrap",children:F?"↔️ Scroll":"↩️ Wrap"})]}),n.jsx("div",{className:"max-h-96 overflow-y-auto",children:Wt&&n.jsx(Lu,{diff:Wt,fileName:Q,isMobile:t,wrapText:F})})]})]},Q)};return e?n.jsxs("div",{className:"h-full flex flex-col bg-background",children:[n.jsxs("div",{className:`flex items-center justify-between border-b border-gray-200 dark:border-gray-700 ${t?"px-3 py-2":"px-4 py-3"}`,children:[n.jsxs("div",{className:"relative",ref:we,children:[n.jsxs("button",{onClick:()=>A(!$),className:`flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition-colors ${t?"space-x-1 px-2 py-1":"space-x-2 px-3 py-1.5"}`,children:[n.jsx(kn,{className:`text-gray-600 dark:text-gray-400 ${t?"w-3 h-3":"w-4 h-4"}`}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:`font-medium ${t?"text-xs":"text-sm"}`,children:w}),me?.hasRemote&&n.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[me.ahead>0&&n.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${me.ahead} commit${me.ahead!==1?"s":""} ahead`,children:["↑",me.ahead]}),me.behind>0&&n.jsxs("span",{className:"text-blue-600 dark:text-blue-400",title:`${me.behind} commit${me.behind!==1?"s":""} behind`,children:["↓",me.behind]}),me.isUpToDate&&n.jsx("span",{className:"text-gray-500 dark:text-gray-400",title:"Up to date with remote",children:"✓"})]})]}),n.jsx(Pr,{className:`w-3 h-3 text-gray-500 transition-transform ${$?"rotate-180":""}`})]}),$&&n.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:[n.jsx("div",{className:"py-1 max-h-64 overflow-y-auto",children:N.map(Q=>n.jsx("button",{onClick:()=>st(Q),className:`w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${Q===w?"bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:n.jsxs("div",{className:"flex items-center space-x-2",children:[Q===w&&n.jsx(dr,{className:"w-3 h-3 text-green-600 dark:text-green-400"}),n.jsx("span",{className:Q===w?"font-medium":"",children:Q})]})},Q))}),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 py-1",children:n.jsxs("button",{onClick:()=>{T(!0),A(!1)},className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center space-x-2",children:[n.jsx(ar,{className:"w-3 h-3"}),n.jsx("span",{children:"Create new branch"})]})})]})]}),n.jsxs("div",{className:`flex items-center ${t?"gap-1":"gap-2"}`,children:[me?.hasRemote&&n.jsxs(n.Fragment,{children:[!me?.hasUpstream&&n.jsxs("button",{onClick:()=>bt({type:"publish",message:`Publish branch "${w}" to ${me.remoteName}?`}),disabled:yt,className:"px-2 py-1 text-xs bg-purple-600 text-white rounded hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1",title:`Publish branch "${w}" to ${me.remoteName}`,children:[n.jsx(qs,{className:`w-3 h-3 ${yt?"animate-pulse":""}`}),n.jsx("span",{children:yt?"Publishing...":"Publish"})]}),me?.hasUpstream&&!me?.isUpToDate&&n.jsxs(n.Fragment,{children:[me.behind>0&&n.jsxs("button",{onClick:()=>bt({type:"pull",message:`Pull ${me.behind} commit${me.behind!==1?"s":""} from ${me.remoteName}?`}),disabled:He,className:"px-2 py-1 text-xs bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center gap-1",title:`Pull ${me.behind} commit${me.behind!==1?"s":""} from ${me.remoteName}`,children:[n.jsx(pi,{className:`w-3 h-3 ${He?"animate-pulse":""}`}),n.jsx("span",{children:He?"Pulling...":`Pull ${me.behind}`})]}),me.ahead>0&&n.jsxs("button",{onClick:()=>bt({type:"push",message:`Push ${me.ahead} commit${me.ahead!==1?"s":""} to ${me.remoteName}?`}),disabled:rt,className:"px-2 py-1 text-xs bg-orange-600 text-white rounded hover:bg-orange-700 disabled:opacity-50 flex items-center gap-1",title:`Push ${me.ahead} commit${me.ahead!==1?"s":""} to ${me.remoteName}`,children:[n.jsx(qs,{className:`w-3 h-3 ${rt?"animate-pulse":""}`}),n.jsx("span",{children:rt?"Pushing...":`Push ${me.ahead}`})]}),(me.ahead>0||me.behind>0&&me.ahead>0)&&n.jsxs("button",{onClick:B,disabled:ce,className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1",title:`Fetch from ${me.remoteName}`,children:[n.jsx(yn,{className:`w-3 h-3 ${ce?"animate-spin":""}`}),n.jsx("span",{children:ce?"Fetching...":"Fetch"})]})]})]}),n.jsx("button",{onClick:()=>{G(),be(),Pe()},disabled:l,className:`hover:bg-gray-100 dark:hover:bg-gray-800 rounded ${t?"p-1":"p-1.5"}`,children:n.jsx(yn,{className:`${l?"animate-spin":""} ${t?"w-3 h-3":"w-4 h-4"}`})})]})]}),a?.error?n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 px-6 py-12",children:[n.jsx(kn,{className:"w-20 h-20 mb-6 opacity-30"}),n.jsx("h3",{className:"text-xl font-medium mb-3 text-center",children:a.error}),a.details&&n.jsx("p",{className:"text-sm text-center leading-relaxed mb-6 max-w-md",children:a.details}),n.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800 max-w-md",children:n.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300 text-center",children:[n.jsx("strong",{children:"Tip:"})," Run ",n.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-2 py-1 rounded font-mono text-xs",children:"git init"})," in your project directory to initialize git source control."]})})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`flex border-b border-gray-200 dark:border-gray-700 transition-all duration-300 ease-in-out ${m.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[n.jsx("button",{onClick:()=>J("changes"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${de==="changes"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:n.jsxs("div",{className:"flex items-center justify-center gap-2",children:[n.jsx(yr,{className:"w-4 h-4"}),n.jsx("span",{children:"Changes"})]})}),n.jsx("button",{onClick:()=>J("history"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${de==="history"?"text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,children:n.jsxs("div",{className:"flex items-center justify-center gap-2",children:[n.jsx(nc,{className:"w-4 h-4"}),n.jsx("span",{children:"History"})]})})]}),de==="changes"&&n.jsx(n.Fragment,{children:n.jsx("div",{className:`transition-all duration-300 ease-in-out ${m.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:t&&vt?n.jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:n.jsxs("button",{onClick:()=>ft(!1),className:"w-full flex items-center justify-center gap-2 px-3 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700",children:[n.jsx(no,{className:"w-4 h-4"}),n.jsxs("span",{children:["Commit ",p.size," file",p.size!==1?"s":""]}),n.jsx(Pr,{className:"w-3 h-3"})]})}):n.jsx(n.Fragment,{children:n.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[t&&n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-sm font-medium",children:"Commit Changes"}),n.jsx("button",{onClick:()=>ft(!0),className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded",children:n.jsx(Pr,{className:"w-4 h-4 rotate-180"})})]}),n.jsxs("div",{className:"relative",children:[n.jsx("textarea",{ref:Ve,value:d,onChange:Q=>u(Q.target.value),placeholder:"Message (Ctrl+Enter to commit)",className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 resize-none pr-20",rows:"3",onKeyDown:Q=>{Q.key==="Enter"&&(Q.ctrlKey||Q.metaKey)&&sr()}}),n.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[n.jsx("button",{onClick:Qr,disabled:p.size===0||Me,className:"p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",title:"Generate commit message",children:Me?n.jsx(yn,{className:"w-4 h-4 animate-spin"}):n.jsx(_n,{className:"w-4 h-4"})}),n.jsx("div",{style:{display:"none"},children:n.jsx(Op,{onTranscript:Q=>u(Q),mode:"default",className:"p-1.5"})})]})]}),n.jsxs("div",{className:"flex items-center justify-between mt-2",children:[n.jsxs("span",{className:"text-xs text-gray-500",children:[p.size," file",p.size!==1?"s":""," selected"]}),n.jsxs("button",{onClick:()=>bt({type:"commit",message:`Commit ${p.size} file${p.size!==1?"s":""} with message: "${d.trim()}"?`}),disabled:!d.trim()||p.size===0||y,className:"px-3 py-1 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",children:[n.jsx(dr,{className:"w-3 h-3"}),n.jsx("span",{children:y?"Committing...":"Commit"})]})]})]})})})}),de==="changes"&&a&&!a.error&&n.jsxs("div",{className:`border-b border-gray-200 dark:border-gray-700 flex items-center justify-between transition-all duration-300 ease-in-out ${t?"px-3 py-1.5":"px-4 py-2"} ${m.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[n.jsxs("span",{className:"text-gray-600 dark:text-gray-400 text-xs",children:[p.size," of ",(a?.modified?.length||0)+(a?.added?.length||0)+(a?.deleted?.length||0)+(a?.untracked?.length||0)," ",t?"":"files"," selected"]}),n.jsxs("div",{className:`flex ${t?"gap-1":"gap-2"}`,children:[n.jsx("button",{onClick:()=>{const Q=new Set([...a?.modified||[],...a?.added||[],...a?.deleted||[],...a?.untracked||[]]);g(Q)},className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:t?"All":"Select All"}),n.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"|"}),n.jsx("button",{onClick:()=>g(new Set),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 text-xs",children:t?"None":"Deselect All"})]})]}),!a?.error&&!t&&n.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("button",{onClick:()=>H(!R),className:"w-full px-4 py-2 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-750 text-xs text-gray-600 dark:text-gray-400 flex items-center justify-center gap-1",children:[n.jsx(ax,{className:"w-3 h-3"}),n.jsx("span",{children:"File Status Guide"}),R?n.jsx(Pr,{className:"w-3 h-3"}):n.jsx(cn,{className:"w-3 h-3"})]}),R&&n.jsx("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-800 text-xs",children:n.jsxs("div",{className:`${t?"grid grid-cols-2 gap-3 justify-items-center":"flex justify-center gap-6"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300 rounded border border-yellow-200 dark:border-yellow-800 font-bold text-xs",children:"M"}),n.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Modified"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300 rounded border border-green-200 dark:border-green-800 font-bold text-xs",children:"A"}),n.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Added"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300 rounded border border-red-200 dark:border-red-800 font-bold text-xs",children:"D"}),n.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Deleted"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300 rounded border border-gray-300 dark:border-gray-600 font-bold text-xs",children:"U"}),n.jsx("span",{className:"text-gray-600 dark:text-gray-400 italic",children:"Untracked"})]})]})})]})]}),de==="changes"&&!a?.error&&n.jsx("div",{className:`flex-1 overflow-y-auto ${t?"pb-mobile-nav":""}`,children:l?n.jsx("div",{className:"flex items-center justify-center h-32",children:n.jsx(yn,{className:"w-6 h-6 animate-spin text-gray-400"})}):a?.hasCommits===!1?n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[n.jsx(kn,{className:"w-16 h-16 mb-4 opacity-30 text-gray-400 dark:text-gray-500"}),n.jsx("h3",{className:"text-lg font-medium mb-2 text-gray-900 dark:text-white",children:"No commits yet"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mb-6 max-w-md",children:"This repository doesn't have any commits yet. Create your first commit to start tracking changes."}),n.jsx("button",{onClick:Pt,disabled:kt,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:kt?n.jsxs(n.Fragment,{children:[n.jsx(yn,{className:"w-4 h-4 animate-spin"}),n.jsx("span",{children:"Creating Initial Commit..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(no,{className:"w-4 h-4"}),n.jsx("span",{children:"Create Initial Commit"})]})})]}):!a||!a.modified?.length&&!a.added?.length&&!a.deleted?.length&&!a.untracked?.length?n.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[n.jsx(no,{className:"w-12 h-12 mb-2 opacity-50"}),n.jsx("p",{className:"text-sm",children:"No changes detected"})]}):n.jsxs("div",{className:t?"pb-4":"",children:[a.modified?.map(Q=>Gt(Q,"M")),a.added?.map(Q=>Gt(Q,"A")),a.deleted?.map(Q=>Gt(Q,"D")),a.untracked?.map(Q=>Gt(Q,"U"))]})}),de==="history"&&!a?.error&&n.jsx("div",{className:`flex-1 overflow-y-auto ${t?"pb-mobile-nav":""}`,children:l?n.jsx("div",{className:"flex items-center justify-center h-32",children:n.jsx(yn,{className:"w-6 h-6 animate-spin text-gray-400"})}):X.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-gray-500 dark:text-gray-400",children:[n.jsx(nc,{className:"w-12 h-12 mb-2 opacity-50"}),n.jsx("p",{className:"text-sm",children:"No commits found"})]}):n.jsx("div",{className:t?"pb-4":"",children:X.map(Q=>lr(Q))})}),V&&n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>T(!1)}),n.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:n.jsxs("div",{className:"p-6",children:[n.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create New Branch"}),n.jsxs("div",{className:"mb-4",children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Branch Name"}),n.jsx("input",{type:"text",value:U,onChange:Q=>P(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&!_&&he()},placeholder:"feature/new-feature",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),n.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-4",children:["This will create a new branch from the current branch (",w,")"]}),n.jsxs("div",{className:"flex justify-end space-x-3",children:[n.jsx("button",{onClick:()=>{T(!1),P("")},className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),n.jsx("button",{onClick:he,disabled:!U.trim()||_,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2",children:_?n.jsxs(n.Fragment,{children:[n.jsx(yn,{className:"w-3 h-3 animate-spin"}),n.jsx("span",{children:"Creating..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(ar,{className:"w-3 h-3"}),n.jsx("span",{children:"Create Branch"})]})})]})]})})]}),Ue&&n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>bt(null)}),n.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full",children:n.jsxs("div",{className:"p-6",children:[n.jsxs("div",{className:"flex items-center mb-4",children:[n.jsx("div",{className:`p-2 rounded-full mr-3 ${Ue.type==="discard"||Ue.type==="delete"?"bg-red-100 dark:bg-red-900":"bg-yellow-100 dark:bg-yellow-900"}`,children:n.jsx(ca,{className:`w-5 h-5 ${Ue.type==="discard"||Ue.type==="delete"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`})}),n.jsx("h3",{className:"text-lg font-semibold",children:Ue.type==="discard"?"Discard Changes":Ue.type==="delete"?"Delete File":Ue.type==="commit"?"Confirm Commit":Ue.type==="pull"?"Confirm Pull":Ue.type==="publish"?"Publish Branch":"Confirm Push"})]}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:Ue.message}),n.jsxs("div",{className:"flex justify-end space-x-3",children:[n.jsx("button",{onClick:()=>bt(null),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md",children:"Cancel"}),n.jsx("button",{onClick:Ze,className:`px-4 py-2 text-sm text-white rounded-md ${Ue.type==="discard"||Ue.type==="delete"?"bg-red-600 hover:bg-red-700":Ue.type==="commit"?"bg-blue-600 hover:bg-blue-700":Ue.type==="pull"?"bg-green-600 hover:bg-green-700":Ue.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:Ue.type==="discard"?n.jsxs(n.Fragment,{children:[n.jsx(Tr,{className:"w-4 h-4"}),n.jsx("span",{children:"Discard"})]}):Ue.type==="delete"?n.jsxs(n.Fragment,{children:[n.jsx(Tr,{className:"w-4 h-4"}),n.jsx("span",{children:"Delete"})]}):Ue.type==="commit"?n.jsxs(n.Fragment,{children:[n.jsx(dr,{className:"w-4 h-4"}),n.jsx("span",{children:"Commit"})]}):Ue.type==="pull"?n.jsxs(n.Fragment,{children:[n.jsx(pi,{className:"w-4 h-4"}),n.jsx("span",{children:"Pull"})]}):Ue.type==="publish"?n.jsxs(n.Fragment,{children:[n.jsx(qs,{className:"w-4 h-4"}),n.jsx("span",{children:"Publish"})]}):n.jsxs(n.Fragment,{children:[n.jsx(qs,{className:"w-4 h-4"}),n.jsx("span",{children:"Push"})]})})]})]})})]})]}):n.jsx("div",{className:"h-full flex items-center justify-center text-gray-500 dark:text-gray-400",children:n.jsx("p",{children:"Select a project to view source control"})})}class U8 extends Kr.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,r){console.error("ErrorBoundary caught an error:",t,r),this.setState({error:t,errorInfo:r})}render(){return this.state.hasError?n.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:n.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[n.jsxs("div",{className:"flex items-center mb-4",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),n.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"Something went wrong"})]}),n.jsxs("div",{className:"text-sm text-red-700",children:[n.jsx("p",{className:"mb-2",children:"An error occurred while loading the chat interface."}),this.props.showDetails&&this.state.error&&n.jsxs("details",{className:"mt-4",children:[n.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"Error Details"}),n.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),n.jsx("div",{className:"mt-4",children:n.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"Try Again"})})]})}):this.props.children}}const vr=({children:e,content:t,position:r="top",className:a="",delay:s=500})=>{const[i,o]=b.useState(!1),[l,c]=b.useState(null),d=()=>{const p=setTimeout(()=>{o(!0)},s);c(p)},u=()=>{l&&(clearTimeout(l),c(null)),o(!1)},m=()=>{switch(r){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},h=()=>{switch(r){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}};return t?n.jsxs("div",{className:"relative inline-block",onMouseEnter:d,onMouseLeave:u,children:[e,i&&n.jsxs("div",{className:Ke("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",m(),a),children:[t,n.jsx("div",{className:Ke("absolute w-0 h-0 border-4 border-transparent",h())})]})]}):e},Pu=({task:e,onClick:t,showParent:r=!1,className:a=""})=>{const i=(l=>{switch(l){case"done":return{icon:ks,bgColor:"bg-green-50 dark:bg-green-950",borderColor:"border-green-200 dark:border-green-800",iconColor:"text-green-600 dark:text-green-400",textColor:"text-green-900 dark:text-green-100",statusText:"Done"};case"in-progress":return{icon:cs,bgColor:"bg-blue-50 dark:bg-blue-950",borderColor:"border-blue-200 dark:border-blue-800",iconColor:"text-blue-600 dark:text-blue-400",textColor:"text-blue-900 dark:text-blue-100",statusText:"In Progress"};case"review":return{icon:Li,bgColor:"bg-amber-50 dark:bg-amber-950",borderColor:"border-amber-200 dark:border-amber-800",iconColor:"text-amber-600 dark:text-amber-400",textColor:"text-amber-900 dark:text-amber-100",statusText:"Review"};case"deferred":return{icon:Xu,bgColor:"bg-gray-50 dark:bg-gray-800",borderColor:"border-gray-200 dark:border-gray-700",iconColor:"text-gray-500 dark:text-gray-400",textColor:"text-gray-700 dark:text-gray-300",statusText:"Deferred"};case"cancelled":return{icon:Mt,bgColor:"bg-red-50 dark:bg-red-950",borderColor:"border-red-200 dark:border-red-800",iconColor:"text-red-600 dark:text-red-400",textColor:"text-red-900 dark:text-red-100",statusText:"Cancelled"};case"pending":default:return{icon:Ca,bgColor:"bg-slate-50 dark:bg-slate-800",borderColor:"border-slate-200 dark:border-slate-700",iconColor:"text-slate-500 dark:text-slate-400",textColor:"text-slate-900 dark:text-slate-100",statusText:"Pending"}}})(e.status);i.icon;const o=l=>{switch(l){case"high":return n.jsx(vr,{content:"High Priority",children:n.jsx("div",{className:"w-4 h-4 bg-red-100 dark:bg-red-900/30 rounded flex items-center justify-center",children:n.jsx(wg,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})});case"medium":return n.jsx(vr,{content:"Medium Priority",children:n.jsx("div",{className:"w-4 h-4 bg-amber-100 dark:bg-amber-900/30 rounded flex items-center justify-center",children:n.jsx(bx,{className:"w-2.5 h-2.5 text-amber-600 dark:text-amber-400"})})});case"low":return n.jsx(vr,{content:"Low Priority",children:n.jsx("div",{className:"w-4 h-4 bg-blue-100 dark:bg-blue-900/30 rounded flex items-center justify-center",children:n.jsx(Ca,{className:"w-1.5 h-1.5 text-blue-600 dark:text-blue-400 fill-current"})})});default:return n.jsx(vr,{content:"No Priority Set",children:n.jsx("div",{className:"w-4 h-4 bg-gray-100 dark:bg-gray-800 rounded flex items-center justify-center",children:n.jsx(Ca,{className:"w-1.5 h-1.5 text-gray-400 dark:text-gray-500"})})})}};return n.jsxs("div",{className:Ke("bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700","hover:shadow-md hover:border-blue-300 dark:hover:border-blue-600 transition-all duration-200 cursor-pointer","p-3 space-y-3",t&&"hover:-translate-y-0.5",a),onClick:t,children:[n.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx(vr,{content:`Task ID: ${e.id}`,children:n.jsx("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded",children:e.id})})}),n.jsx("h3",{className:"font-medium text-sm text-gray-900 dark:text-white line-clamp-2 leading-tight",children:e.title}),r&&e.parentId&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium",children:["Task ",e.parentId]})]}),n.jsx("div",{className:"flex-shrink-0",children:o(e.priority)})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"flex items-center",children:e.dependencies&&Array.isArray(e.dependencies)&&e.dependencies.length>0&&n.jsx(vr,{content:`Depends on: ${e.dependencies.map(l=>`Task ${l}`).join(", ")}`,children:n.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400",children:[n.jsx(Vl,{className:"w-3 h-3"}),n.jsxs("span",{children:["Depends on: ",e.dependencies.join(", ")]})]})})}),n.jsx(vr,{content:`Status: ${i.statusText}`,children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("div",{className:Ke("w-2 h-2 rounded-full",i.iconColor.replace("text-","bg-"))}),n.jsx("span",{className:Ke("text-xs font-medium",i.textColor),children:i.statusText})]})})]}),e.subtasks&&e.subtasks.length>0&&n.jsx("div",{className:"ml-3",children:n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Progress:"}),n.jsx(vr,{content:`${e.subtasks.filter(l=>l.status==="done").length} of ${e.subtasks.length} subtasks completed`,children:n.jsx("div",{className:"flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1.5",children:n.jsx("div",{className:Ke("h-full rounded-full transition-all duration-300",e.status==="done"?"bg-green-500":"bg-blue-500"),style:{width:`${Math.round(e.subtasks.filter(l=>l.status==="done").length/e.subtasks.length*100)}%`}})})}),n.jsx(vr,{content:`${e.subtasks.filter(l=>l.status==="done").length} completed, ${e.subtasks.filter(l=>l.status==="pending").length} pending, ${e.subtasks.filter(l=>l.status==="in-progress").length} in progress`,children:n.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e.subtasks.filter(l=>l.status==="done").length,"/",e.subtasks.length]})})]})})]})},V8=({currentProject:e,onClose:t,onTaskCreated:r})=>n.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:n.jsx(_n,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Create AI-Generated Task"})]}),n.jsx("button",{onClick:t,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:n.jsx(Mt,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"p-6 space-y-6",children:[n.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:n.jsx(_n,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),n.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"You can simply ask Claude Code in the chat to create tasks for you. The AI assistant will automatically generate detailed tasks with research-backed insights."}),n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-blue-200 dark:border-blue-700 p-3 mb-3",children:[n.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Example:"}),n.jsx("p",{className:"text-sm text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),n.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[n.jsx("strong",{children:"This runs:"})," ",n.jsx("code",{className:"bg-blue-100 dark:bg-blue-900/50 px-1 rounded text-xs",children:'task-master add-task --prompt="Implement user profile image uploads using Cloudinary" --research'})]})]})]})}),n.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),n.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),n.jsx("div",{className:"pt-4",children:n.jsx("button",{onClick:t,className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),G8=({tasks:e=[],onTaskClick:t,className:r="",showParentTasks:a=!1,defaultView:s="kanban",currentProject:i,onTaskCreated:o,onShowPRDEditor:l,existingPRDs:c=[],onRefreshPRDs:d})=>{const[u,m]=b.useState(""),[h,p]=b.useState("all"),[g,y]=b.useState("all"),[v,w]=b.useState("id"),[S,N]=b.useState("asc"),[I,F]=b.useState(s),[E,R]=b.useState(!1),[H,$]=b.useState(!1),[A,V]=b.useState(!1),[T,U]=b.useState(!1),[P,_]=b.useState(!1),[se,de]=b.useState(!1),{projectTaskMaster:J,refreshProjects:X,refreshTasks:j,setCurrentProject:ne}=Ss();b.useEffect(()=>{const ce=ve=>{se&&!ve.target.closest(".relative")&&de(!1)};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[se]);const ue=b.useMemo(()=>{const ce=new Set(e.map(ve=>ve.status).filter(Boolean));return Array.from(ce).sort()},[e]),M=b.useMemo(()=>{const ce=new Set(e.map(ve=>ve.priority).filter(Boolean));return Array.from(ce).sort()},[e]),ie=b.useMemo(()=>{let ce=e.filter(ve=>{const He=u.toLowerCase(),Le=!u||ve.title.toLowerCase().includes(He)||ve.description?.toLowerCase().includes(He)||ve.id.toString().includes(He),rt=h==="all"||ve.status===h,Ye=g==="all"||ve.priority===g;return Le&&rt&&Ye});return ce.sort((ve,He)=>{let Le,rt;switch(v){case"title":Le=ve.title.toLowerCase(),rt=He.title.toLowerCase();break;case"status":const Ye={pending:1,"in-progress":2,done:3,blocked:4,deferred:5,cancelled:6};Le=Ye[ve.status]||99,rt=Ye[He.status]||99;break;case"priority":const yt={high:3,medium:2,low:1};Le=yt[ve.priority]||0,rt=yt[He.priority]||0;break;case"updated":Le=new Date(ve.updatedAt||ve.createdAt||0),rt=new Date(He.updatedAt||He.createdAt||0);break;case"id":default:const mt=Ue=>Ue.toString().split(".").map(kt=>parseInt(kt,10)),vt=mt(ve.id),ft=mt(He.id);for(let Ue=0;Ue<Math.max(vt.length,ft.length);Ue++){const bt=vt[Ue]||0,kt=ft[Ue]||0;if(bt!==kt){Le=bt,rt=kt;break}}break}return v==="updated"?S==="asc"?Le-rt:rt-Le:typeof Le=="string"?S==="asc"?Le.localeCompare(rt):rt.localeCompare(Le):S==="asc"?Le-rt:rt-Le}),ce},[e,u,h,g,v,S]),Me=b.useMemo(()=>{const ce=[{id:"pending",title:"📋 To Do",status:"pending",color:"bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-700",headerColor:"bg-slate-100 dark:bg-slate-800 text-slate-800 dark:text-slate-200"},{id:"in-progress",title:"🚀 In Progress",status:"in-progress",color:"bg-blue-50 dark:bg-blue-900/50 border-blue-200 dark:border-blue-700",headerColor:"bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-200"},{id:"done",title:"✅ Done",status:"done",color:"bg-emerald-50 dark:bg-emerald-900/50 border-emerald-200 dark:border-emerald-700",headerColor:"bg-emerald-100 dark:bg-emerald-800 text-emerald-800 dark:text-emerald-200"},{id:"blocked",title:"🚫 Blocked",status:"blocked",color:"bg-red-50 dark:bg-red-900/50 border-red-200 dark:border-red-700",headerColor:"bg-red-100 dark:bg-red-800 text-red-800 dark:text-red-200"},{id:"deferred",title:"⏳ Deferred",status:"deferred",color:"bg-amber-50 dark:bg-amber-900/50 border-amber-200 dark:border-amber-700",headerColor:"bg-amber-100 dark:bg-amber-800 text-amber-800 dark:text-amber-200"},{id:"cancelled",title:"❌ Cancelled",status:"cancelled",color:"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700",headerColor:"bg-gray-100 dark:bg-gray-800 text-gray-800 dark:text-gray-200"}],ve=["pending","in-progress","done"];return ce.filter(Le=>{const rt=ie.some(yt=>yt.status===Le.status),Ye=ve.includes(Le.status);return rt||Ye}).map(Le=>({...Le,tasks:ie.filter(rt=>rt.status===Le.status)}))},[ie]),Se=ce=>{v===ce?N(S==="asc"?"desc":"asc"):(w(ce),N("asc"))},me=()=>{m(""),p("all"),y("all")},_e=ce=>v!==ce?n.jsx(hg,{className:"w-4 h-4"}):S==="asc"?n.jsx(fg,{className:"w-4 h-4"}):n.jsx(Uu,{className:"w-4 h-4"});if(e.length===0){const ce=i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||J?.hasTaskmaster;return n.jsxs("div",{className:Ke("text-center py-12",r),children:[ce?n.jsxs("div",{className:"max-w-4xl mx-auto",children:[n.jsxs("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-xl border border-blue-200 dark:border-blue-800 p-6 mb-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:n.jsx(yr,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"TaskMaster is initialized! Here's what to do next:"})]})]}),n.jsxs("div",{className:"space-y-4 text-left",children:[n.jsxs("div",{className:"grid gap-3",children:[n.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"1"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Create a Product Requirements Document (PRD)"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:"Discuss your project idea and create a PRD that describes what you want to build."}),n.jsxs("button",{onClick:()=>{l?.()},className:"inline-flex items-center gap-1 text-xs bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-2 py-1 rounded hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[n.jsx(yr,{className:"w-3 h-3"}),"Add PRD"]}),c.length>0&&n.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"Existing PRDs:"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(ve=>n.jsxs("button",{onClick:async()=>{try{const He=await lt.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(ve.name)}`);if(He.ok){const Le=await He.json();l?.({name:ve.name,content:Le.content,isExisting:!0})}else console.error("Failed to load PRD:",He.statusText)}catch(He){console.error("Error loading PRD:",He)}},className:"inline-flex items-center gap-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 px-2 py-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",children:[n.jsx(yr,{className:"w-3 h-3"}),ve.name]},ve.name))})]})]})]}),n.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"2"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Generate Tasks from PRD"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."})]})]}),n.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"3"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Analyze & Expand Tasks"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."})]})]}),n.jsxs("div",{className:"flex gap-3 p-3 bg-white dark:bg-gray-800/50 rounded-lg border border-blue-100 dark:border-blue-800/50",children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 bg-blue-600 text-white text-xs font-semibold rounded-full flex items-center justify-center",children:"4"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-1",children:"Start Building"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."})]})]})]}),n.jsx("div",{className:"flex gap-3 pt-4 border-t border-blue-200 dark:border-blue-700",children:n.jsxs("button",{onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),l?.()},className:"flex items-center gap-2 px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-colors cursor-pointer",style:{zIndex:10},children:[n.jsx(yr,{className:"w-4 h-4"}),"Add PRD"]})})]})]}),n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-2",children:["💡 ",n.jsx("strong",{children:"Tip:"})," Start with a PRD to get the most out of TaskMaster's AI-powered task generation"]})})]}):n.jsxs("div",{className:"max-w-md mx-auto",children:[n.jsx("div",{className:"text-blue-600 dark:text-blue-400 mb-4",children:n.jsx(la,{className:"w-12 h-12 mx-auto mb-4"})}),n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"TaskMaster AI is not configured"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:"TaskMaster helps break down complex projects into manageable tasks with AI-powered assistance"}),n.jsxs("div",{className:"mb-6 p-4 bg-blue-50 dark:bg-blue-950 rounded-lg text-left",children:[n.jsx("h4",{className:"text-sm font-medium text-blue-900 dark:text-blue-100 mb-3",children:"🎯 What is TaskMaster?"}),n.jsxs("div",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[n.jsxs("p",{children:["• ",n.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"PRD Templates:"})," Generate tasks from Product Requirements Documents"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"Progress Visualization:"})," Kanban boards and detailed task analytics"]}),n.jsxs("p",{children:["• ",n.jsx("strong",{children:"CLI Integration:"})," Use taskmaster commands for advanced workflows"]})]})]}),n.jsxs("button",{onClick:()=>{_(!1),V(!0)},className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors flex items-center gap-2 mx-auto",children:[n.jsx(qn,{className:"w-4 h-4"}),"Initialize TaskMaster AI"]})]}),A&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center p-4 pt-16 bg-black/50 backdrop-blur-sm",children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl h-[600px] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:n.jsx(qn,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"TaskMaster Setup"}),n.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Interactive CLI for ",i?.displayName]})]})]}),n.jsx("button",{onClick:()=>{V(!1),setTimeout(()=>{X(),i&&ne(i)},1e3)},className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800",children:n.jsx(ar,{className:"w-5 h-5 rotate-45"})})]}),n.jsx("div",{className:"flex-1 p-4",children:n.jsx("div",{className:"h-full bg-black rounded-lg overflow-hidden",onClick:ve=>{const He=ve.currentTarget.querySelector(".xterm-screen");He&&He.focus()},children:n.jsx(O0,{selectedProject:i,selectedSession:null,isActive:!0,initialCommand:"npx task-master init",isPlainShell:!0,onProcessComplete:ve=>{_(!0),ve===0&&setTimeout(()=>{X(),i&&ne(i)},1e3)}})})}),n.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:P?n.jsxs("span",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[n.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),"TaskMaster setup completed! You can now close this window."]}):"TaskMaster initialization will start automatically"}),n.jsx("button",{onClick:()=>{V(!1),_(!1),setTimeout(()=>{X(),i&&ne(i)},1e3)},className:Ke("px-4 py-2 text-sm font-medium rounded-md transition-colors",P?"bg-green-600 hover:bg-green-700 text-white":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600"),children:P?"Close & Continue":"Close"})]})})]})})]})}return n.jsxs("div",{className:Ke("space-y-4",r),children:[n.jsxs("div",{className:"flex flex-col lg:flex-row gap-3 lg:items-center lg:justify-between",children:[n.jsxs("div",{className:"relative flex-1 max-w-md",children:[n.jsx(Ia,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),n.jsx("input",{type:"text",placeholder:"Search tasks...",value:u,onChange:ce=>m(ce.target.value),className:"pl-10 pr-4 py-2 w-full border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("div",{className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[n.jsx("button",{onClick:()=>F("kanban"),className:Ke("p-2 rounded-md transition-colors",I==="kanban"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Kanban view",children:n.jsx(Dg,{className:"w-4 h-4"})}),n.jsx("button",{onClick:()=>F("list"),className:Ke("p-2 rounded-md transition-colors",I==="list"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"List view",children:n.jsx(gi,{className:"w-4 h-4"})}),n.jsx("button",{onClick:()=>F("grid"),className:Ke("p-2 rounded-md transition-colors",I==="grid"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),title:"Grid view",children:n.jsx(tx,{className:"w-4 h-4"})})]}),n.jsxs("button",{onClick:()=>R(!E),className:Ke("flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",E?"bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700 text-blue-700 dark:text-blue-300":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"),children:[n.jsx(Kg,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Filters"}),n.jsx(Pr,{className:Ke("w-4 h-4 transition-transform",E&&"rotate-180")})]}),i&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>U(!0),className:"p-2 text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors border border-gray-300 dark:border-gray-600",title:"TaskMaster Getting Started Guide",children:n.jsx(Ag,{className:"w-4 h-4"})}),n.jsx("div",{className:"relative",children:c.length>0?n.jsxs("div",{className:"relative",children:[n.jsxs("button",{onClick:()=>de(!se),className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:`${c.length} PRD${c.length>1?"s":""} available`,children:[n.jsx(yr,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"PRDs"}),n.jsx("span",{className:"px-1.5 py-0.5 text-xs bg-purple-500 rounded-full min-w-[1.25rem] text-center",children:c.length}),n.jsx(Pr,{className:Ke("w-3 h-3 transition-transform hidden sm:block",se&&"rotate-180")})]}),se&&n.jsx("div",{className:"absolute right-0 top-full mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-xl z-30",children:n.jsxs("div",{className:"p-2",children:[n.jsxs("button",{onClick:()=>{l?.(),de(!1)},className:"w-full text-left px-3 py-2 text-sm font-medium text-purple-700 dark:text-purple-300 hover:bg-purple-50 dark:hover:bg-purple-900/30 rounded flex items-center gap-2",children:[n.jsx(ar,{className:"w-4 h-4"}),"Create New PRD"]}),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 my-1"}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 px-3 py-1 font-medium",children:"Existing PRDs:"}),c.map(ce=>n.jsxs("button",{onClick:async()=>{try{const ve=await lt.get(`/taskmaster/prd/${encodeURIComponent(i.name)}/${encodeURIComponent(ce.name)}`);if(ve.ok){const He=await ve.json();l?.({name:ce.name,content:He.content,isExisting:!0}),de(!1)}}catch(ve){console.error("Error loading PRD:",ve)}},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded flex items-center gap-2",title:`Modified: ${new Date(ce.modified).toLocaleDateString()}`,children:[n.jsx(yr,{className:"w-4 h-4"}),n.jsx("span",{className:"truncate",children:ce.name})]},ce.name))]})})]}):n.jsxs("button",{onClick:()=>{l?.()},className:"flex items-center gap-2 px-3 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors font-medium",title:"Create Product Requirements Document",children:[n.jsx(yr,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Add PRD"})]})}),(i?.taskMasterConfigured||i?.taskmaster?.hasTaskmaster||J?.hasTaskmaster||e.length>0)&&n.jsxs("button",{onClick:()=>$(!0),className:"flex items-center gap-2 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium",title:"Add a new task",children:[n.jsx(ar,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden sm:inline",children:"Add Task"})]})]})]})]}),E&&n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-4 space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),n.jsxs("select",{value:h,onChange:ce=>p(ce.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[n.jsx("option",{value:"all",children:"All Statuses"}),ue.map(ce=>n.jsx("option",{value:ce,children:ce.charAt(0).toUpperCase()+ce.slice(1).replace("-"," ")},ce))]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Priority"}),n.jsxs("select",{value:g,onChange:ce=>y(ce.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[n.jsx("option",{value:"all",children:"All Priorities"}),M.map(ce=>n.jsx("option",{value:ce,children:ce.charAt(0).toUpperCase()+ce.slice(1)},ce))]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Sort By"}),n.jsxs("select",{value:`${v}-${S}`,onChange:ce=>{const[ve,He]=ce.target.value.split("-");w(ve),N(He)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500",children:[n.jsx("option",{value:"id-asc",children:"ID (Ascending)"}),n.jsx("option",{value:"id-desc",children:"ID (Descending)"}),n.jsx("option",{value:"title-asc",children:"Title (A-Z)"}),n.jsx("option",{value:"title-desc",children:"Title (Z-A)"}),n.jsx("option",{value:"status-asc",children:"Status (Pending First)"}),n.jsx("option",{value:"status-desc",children:"Status (Done First)"}),n.jsx("option",{value:"priority-asc",children:"Priority (High First)"}),n.jsx("option",{value:"priority-desc",children:"Priority (Low First)"})]})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Showing ",ie.length," of ",e.length," tasks"]}),n.jsx("button",{onClick:me,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:"Clear Filters"})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs("button",{onClick:()=>Se("id"),className:Ke("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",v==="id"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["ID ",_e("id")]}),n.jsxs("button",{onClick:()=>Se("status"),className:Ke("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",v==="status"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Status ",_e("status")]}),n.jsxs("button",{onClick:()=>Se("priority"),className:Ke("flex items-center gap-1 px-3 py-1.5 rounded-md text-sm transition-colors",v==="priority"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700"),children:["Priority ",_e("priority")]})]}),ie.length===0?n.jsx("div",{className:"text-center py-12",children:n.jsxs("div",{className:"text-gray-500 dark:text-gray-400",children:[n.jsx(Ia,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),n.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tasks match your filters"}),n.jsx("p",{className:"text-sm",children:"Try adjusting your search or filter criteria."})]})}):I==="kanban"?n.jsx("div",{className:Ke("grid gap-6",Me.length===1&&"grid-cols-1 max-w-md mx-auto",Me.length===2&&"grid-cols-1 md:grid-cols-2",Me.length===3&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",Me.length===4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-4",Me.length===5&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",Me.length>=6&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"),children:Me.map(ce=>n.jsxs("div",{className:Ke("rounded-xl border shadow-sm transition-shadow hover:shadow-md",ce.color),children:[n.jsx("div",{className:Ke("px-4 py-3 rounded-t-xl border-b",ce.headerColor),children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"font-semibold text-sm",children:ce.title}),n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("span",{className:"text-xs font-medium px-2 py-1 bg-white/60 dark:bg-black/20 rounded-full",children:ce.tasks.length})})]})}),n.jsx("div",{className:"p-3 space-y-3 min-h-[200px] max-h-[calc(100vh-300px)] overflow-y-auto",children:ce.tasks.length===0?n.jsxs("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500",children:[n.jsx("div",{className:"w-8 h-8 mx-auto mb-2 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:n.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-300 dark:bg-gray-600"})}),n.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"No tasks yet"}),n.jsx("div",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:ce.status==="pending"?"Tasks will appear here":ce.status==="in-progress"?"Move tasks here when started":ce.status==="done"?"Completed tasks appear here":"Tasks with this status will appear here"})]}):ce.tasks.map(ve=>n.jsx("div",{className:"transform transition-transform hover:scale-[1.02]",children:n.jsx(Pu,{task:ve,onClick:()=>t?.(ve),showParent:a,className:"w-full shadow-sm hover:shadow-md transition-shadow cursor-pointer"})},ve.id))})]},ce.id))}):n.jsx("div",{className:Ke("gap-4",I==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3":"space-y-4"),children:ie.map(ce=>n.jsx(Pu,{task:ce,onClick:()=>t?.(ce),showParent:a,className:I==="grid"?"h-full":""},ce.id))}),H&&n.jsx(V8,{currentProject:i,onClose:()=>$(!1),onTaskCreated:()=>{$(!1),o&&o()}}),T&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:n.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-4xl max-h-[90vh] overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:n.jsx(yr,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Getting Started with TaskMaster"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Your guide to productive task management"})]})]}),n.jsx("button",{onClick:()=>U(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:n.jsx(Mt,{className:"w-5 h-5"})})]}),n.jsx("div",{className:"p-6 overflow-y-auto max-h-[calc(90vh-120px)]",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950/50 dark:to-indigo-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[n.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-blue-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"1"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Create a Product Requirements Document (PRD)"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Discuss your project idea and create a PRD that describes what you want to build."}),n.jsxs("button",{onClick:()=>{l?.(),U(!1)},className:"inline-flex items-center gap-2 text-sm bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-3 py-1.5 rounded-lg hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors",children:[n.jsx(yr,{className:"w-4 h-4"}),"Add PRD"]})]})]}),n.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/50 dark:to-emerald-950/50 rounded-lg border border-green-200 dark:border-green-800",children:[n.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-green-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"2"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Generate Tasks from PRD"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Once you have a PRD, ask your AI assistant to parse it and TaskMaster will automatically break it down into manageable tasks with implementation details."}),n.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-green-200 dark:border-green-700/50 p-3 mb-2",children:[n.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),n.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt. Can you help me parse it and set up the initial tasks?"`})]})]})]}),n.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-amber-50 to-orange-50 dark:from-amber-950/50 dark:to-orange-950/50 rounded-lg border border-amber-200 dark:border-amber-800",children:[n.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-amber-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"3"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Analyze & Expand Tasks"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to analyze task complexity and expand them into detailed subtasks for easier implementation."}),n.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-amber-200 dark:border-amber-700/50 p-3 mb-2",children:[n.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),n.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Task 5 seems complex. Can you break it down into subtasks?"'})]})]})]}),n.jsxs("div",{className:"flex gap-4 p-4 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-950/50 dark:to-pink-950/50 rounded-lg border border-purple-200 dark:border-purple-800",children:[n.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-purple-600 text-white text-sm font-semibold rounded-full flex items-center justify-center",children:"4"}),n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Start Building"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Ask your AI assistant to begin working on tasks, update their status, and add new tasks as your project evolves."}),n.jsxs("div",{className:"bg-white dark:bg-gray-800/50 rounded border border-purple-200 dark:border-purple-700/50 p-3 mb-3",children:[n.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),n.jsx("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:'"Please add a new task to implement user profile image uploads using Cloudinary, research the best approach."'})]}),n.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"View more examples and usage patterns →"})]})]}),n.jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700",children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-white mb-3",children:"💡 Pro Tips"}),n.jsxs("ul",{className:"space-y-2 text-sm text-gray-600 dark:text-gray-400",children:[n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full mt-2 flex-shrink-0"}),"Use the search bar to quickly find specific tasks"]}),n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 bg-green-500 rounded-full mt-2 flex-shrink-0"}),"Switch between Kanban, List, and Grid views using the view toggles"]}),n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 bg-purple-500 rounded-full mt-2 flex-shrink-0"}),"Use filters to focus on specific task statuses or priorities"]}),n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 bg-orange-500 rounded-full mt-2 flex-shrink-0"}),"Click on any task to view detailed information and manage subtasks"]})]})]}),n.jsxs("div",{className:"mt-6 p-4 bg-blue-50 dark:bg-blue-950/50 rounded-lg border border-blue-200 dark:border-blue-800",children:[n.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-3",children:"📚 Learn More"}),n.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-3",children:"TaskMaster AI is an advanced task management system built for developers. Get documentation, examples, and contribute to the project."}),n.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded-lg font-medium transition-colors",children:[n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})})]})})]})},K8=({file:e,onClose:t,projectPath:r,project:a,initialContent:s="",isNewFile:i=!1,onSave:o})=>{const[l,c]=b.useState(s),[d,u]=b.useState(!i),[m,h]=b.useState(!1),[p,g]=b.useState(!1),[y,v]=b.useState(!0),[w,S]=b.useState(!1),[N,I]=b.useState(!1),[F,E]=b.useState(!0),[R,H]=b.useState(""),[$,A]=b.useState(!1),[V,T]=b.useState(!1),[U,P]=b.useState([]),_=b.useRef(null),se=`# Product Requirements Document - Example Project
910
+
911
+ ## 1. Overview
912
+ **Product Name:** AI-Powered Task Manager
913
+ **Version:** 1.0
914
+ **Date:** 2024-12-27
915
+ **Author:** Development Team
916
+
917
+ This document outlines the requirements for building an AI-powered task management application that integrates with development workflows and provides intelligent task breakdown and prioritization.
918
+
919
+ ## 2. Objectives
920
+ - Create an intuitive task management system that works seamlessly with developer tools
921
+ - Provide AI-powered task generation from high-level requirements
922
+ - Enable real-time collaboration and progress tracking
923
+ - Integrate with popular development environments (VS Code, Cursor, etc.)
924
+
925
+ ### Success Metrics
926
+ - User adoption rate > 80% within development teams
927
+ - Task completion rate improvement of 25%
928
+ - Time-to-delivery reduction of 15%
929
+
930
+ ## 3. User Stories
931
+
932
+ ### Core Functionality
933
+ - As a project manager, I want to create PRDs that automatically generate detailed tasks so I can save time on project planning
934
+ - As a developer, I want to see my next task clearly highlighted so I can maintain focus
935
+ - As a team lead, I want to track progress across multiple projects so I can provide accurate status updates
936
+ - As a developer, I want tasks to be broken down into implementable subtasks so I can work more efficiently
937
+
938
+ ### AI Integration
939
+ - As a user, I want to describe a feature in natural language and get detailed implementation tasks so I can start working immediately
940
+ - As a project manager, I want the AI to analyze task complexity and suggest appropriate time estimates
941
+ - As a developer, I want intelligent task prioritization based on dependencies and deadlines
942
+
943
+ ### Collaboration
944
+ - As a team member, I want to see real-time updates when tasks are completed so I can coordinate my work
945
+ - As a stakeholder, I want to view project progress through intuitive dashboards
946
+ - As a developer, I want to add implementation notes to tasks for future reference
947
+
948
+ ## 4. Functional Requirements
949
+
950
+ ### Task Management
951
+ - Create, edit, and delete tasks with rich metadata (priority, status, dependencies, estimates)
952
+ - Hierarchical task structure with subtasks and sub-subtasks
953
+ - Real-time status updates and progress tracking
954
+ - Dependency management with circular dependency detection
955
+ - Bulk operations (move, update status, assign)
956
+
957
+ ### AI Features
958
+ - Natural language PRD parsing to generate structured tasks
959
+ - Intelligent task breakdown with complexity analysis
960
+ - Automated subtask generation with implementation details
961
+ - Smart dependency suggestion
962
+ - Progress prediction based on historical data
963
+
964
+ ### Integration Features
965
+ - VS Code/Cursor extension for in-editor task management
966
+ - Git integration for linking commits to tasks
967
+ - API for third-party tool integration
968
+ - Webhook support for external notifications
969
+ - CLI tool for command-line task management
970
+
971
+ ### User Interface
972
+ - Responsive web application (desktop and mobile)
973
+ - Multiple view modes (Kanban, list, calendar)
974
+ - Dark/light theme support
975
+ - Drag-and-drop task organization
976
+ - Advanced filtering and search capabilities
977
+ - Keyboard shortcuts for power users
978
+
979
+ ## 5. Technical Requirements
980
+
981
+ ### Frontend
982
+ - React.js with TypeScript for type safety
983
+ - Modern UI framework (Tailwind CSS)
984
+ - State management (Context API or Redux)
985
+ - Real-time updates via WebSockets
986
+ - Progressive Web App (PWA) support
987
+ - Accessibility compliance (WCAG 2.1 AA)
988
+
989
+ ### Backend
990
+ - Node.js with Express.js framework
991
+ - RESTful API design with OpenAPI documentation
992
+ - Real-time communication via Socket.io
993
+ - Background job processing
994
+ - Rate limiting and security middleware
995
+
996
+ ### AI Integration
997
+ - Integration with multiple AI providers (OpenAI, Anthropic, etc.)
998
+ - Fallback model support
999
+ - Context-aware prompt engineering
1000
+ - Token usage optimization
1001
+ - Model response caching
1002
+
1003
+ ### Database
1004
+ - Primary: PostgreSQL for relational data
1005
+ - Cache: Redis for session management and real-time features
1006
+ - Full-text search capabilities
1007
+ - Database migrations and seeding
1008
+ - Backup and recovery procedures
1009
+
1010
+ ### Infrastructure
1011
+ - Docker containerization
1012
+ - Cloud deployment (AWS/GCP/Azure)
1013
+ - Auto-scaling capabilities
1014
+ - Monitoring and logging (structured logging)
1015
+ - CI/CD pipeline with automated testing
1016
+
1017
+ ## 6. Non-Functional Requirements
1018
+
1019
+ ### Performance
1020
+ - Page load time < 2 seconds
1021
+ - API response time < 500ms for 95% of requests
1022
+ - Support for 1000+ concurrent users
1023
+ - Efficient handling of large task lists (10,000+ tasks)
1024
+
1025
+ ### Security
1026
+ - JWT-based authentication with refresh tokens
1027
+ - Role-based access control (RBAC)
1028
+ - Data encryption at rest and in transit
1029
+ - Regular security audits and penetration testing
1030
+ - GDPR and privacy compliance
1031
+
1032
+ ### Reliability
1033
+ - 99.9% uptime SLA
1034
+ - Graceful error handling and recovery
1035
+ - Data backup every 6 hours with point-in-time recovery
1036
+ - Disaster recovery plan with RTO < 4 hours
1037
+
1038
+ ### Scalability
1039
+ - Horizontal scaling for both frontend and backend
1040
+ - Database read replicas for query optimization
1041
+ - CDN for static asset delivery
1042
+ - Microservices architecture for future expansion
1043
+
1044
+ ## 7. User Experience Design
1045
+
1046
+ ### Information Architecture
1047
+ - Intuitive navigation with breadcrumbs
1048
+ - Context-aware menus and actions
1049
+ - Progressive disclosure of complex features
1050
+ - Consistent design patterns throughout
1051
+
1052
+ ### Interaction Design
1053
+ - Smooth animations and transitions
1054
+ - Immediate feedback for user actions
1055
+ - Undo/redo functionality for critical operations
1056
+ - Smart defaults and auto-save features
1057
+
1058
+ ### Visual Design
1059
+ - Modern, clean interface with plenty of whitespace
1060
+ - Consistent color scheme and typography
1061
+ - Clear visual hierarchy with proper contrast ratios
1062
+ - Iconography that supports comprehension
1063
+
1064
+ ## 8. Integration Requirements
1065
+
1066
+ ### Development Tools
1067
+ - VS Code extension with task panel and quick actions
1068
+ - Cursor IDE integration with AI task suggestions
1069
+ - Terminal CLI for command-line workflow
1070
+ - Browser extension for web-based tools
1071
+
1072
+ ### Third-Party Services
1073
+ - GitHub/GitLab integration for issue sync
1074
+ - Slack/Discord notifications
1075
+ - Calendar integration (Google Calendar, Outlook)
1076
+ - Time tracking tools (Toggl, Harvest)
1077
+
1078
+ ### APIs and Webhooks
1079
+ - RESTful API with comprehensive documentation
1080
+ - GraphQL endpoint for complex queries
1081
+ - Webhook system for external integrations
1082
+ - SDK development for major programming languages
1083
+
1084
+ ## 9. Implementation Phases
1085
+
1086
+ ### Phase 1: Core MVP (8-10 weeks)
1087
+ - Basic task management (CRUD operations)
1088
+ - Simple AI task generation
1089
+ - Web interface with essential features
1090
+ - User authentication and basic permissions
1091
+
1092
+ ### Phase 2: Enhanced Features (6-8 weeks)
1093
+ - Advanced AI features (complexity analysis, subtask generation)
1094
+ - Real-time collaboration
1095
+ - Mobile-responsive design
1096
+ - Integration with one development tool (VS Code)
1097
+
1098
+ ### Phase 3: Enterprise Features (4-6 weeks)
1099
+ - Advanced user management and permissions
1100
+ - API and webhook system
1101
+ - Performance optimization
1102
+ - Comprehensive testing and security audit
1103
+
1104
+ ### Phase 4: Ecosystem Expansion (4-6 weeks)
1105
+ - Additional tool integrations
1106
+ - Mobile app development
1107
+ - Advanced analytics and reporting
1108
+ - Third-party marketplace preparation
1109
+
1110
+ ## 10. Risk Assessment
1111
+
1112
+ ### Technical Risks
1113
+ - AI model reliability and cost management
1114
+ - Real-time synchronization complexity
1115
+ - Database performance with large datasets
1116
+ - Integration complexity with multiple tools
1117
+
1118
+ ### Business Risks
1119
+ - User adoption in competitive market
1120
+ - AI provider dependency
1121
+ - Data privacy and security concerns
1122
+ - Feature scope creep and timeline delays
1123
+
1124
+ ### Mitigation Strategies
1125
+ - Implement robust error handling and fallback systems
1126
+ - Develop comprehensive testing strategy
1127
+ - Create detailed documentation and user guides
1128
+ - Establish clear project scope and change management process
1129
+
1130
+ ## 11. Success Criteria
1131
+
1132
+ ### Development Milestones
1133
+ - Alpha version with core features completed
1134
+ - Beta version with selected user group feedback
1135
+ - Production-ready version with full feature set
1136
+ - Post-launch iterations based on user feedback
1137
+
1138
+ ### Business Metrics
1139
+ - User engagement and retention rates
1140
+ - Task completion and productivity metrics
1141
+ - Customer satisfaction scores (NPS > 50)
1142
+ - Revenue targets and subscription growth
1143
+
1144
+ ## 12. Appendices
1145
+
1146
+ ### Glossary
1147
+ - **PRD**: Product Requirements Document
1148
+ - **AI**: Artificial Intelligence
1149
+ - **CRUD**: Create, Read, Update, Delete
1150
+ - **API**: Application Programming Interface
1151
+ - **CI/CD**: Continuous Integration/Continuous Deployment
1152
+
1153
+ ### References
1154
+ - Industry best practices for task management
1155
+ - AI integration patterns and examples
1156
+ - Security and compliance requirements
1157
+ - Performance benchmarking data
1158
+
1159
+ ---
1160
+
1161
+ **Document Control:**
1162
+ - Version: 1.0
1163
+ - Last Updated: December 27, 2024
1164
+ - Next Review: January 15, 2025
1165
+ - Approved By: Product Owner, Technical Lead`;b.useEffect(()=>{(async()=>{if(e?.name)H(e.name.replace(/\.(txt|md)$/,""));else if(i){const Me=new Date().toISOString().split("T")[0];H(`prd-${Me}`)}if(i){c(se),u(!1);return}if(e.content){c(e.content),u(!1);return}try{u(!0);const ie=await lt.readFile(e.projectName,e.path);if(!ie.ok)throw new Error(`Failed to load file: ${ie.status} ${ie.statusText}`);const Me=await ie.json();c(Me.content||se)}catch(ie){console.error("Error loading PRD file:",ie),c(`# Error Loading PRD
1166
+
1167
+ Error: ${ie.message}
1168
+
1169
+ File: ${e?.name||"New PRD"}
1170
+ Path: ${e?.path||"Not saved yet"}
1171
+
1172
+ ${se}`)}finally{u(!1)}})()},[e,r,i]),b.useEffect(()=>{(async()=>{if(!a?.name){console.log("No project name available:",a);return}try{console.log("Fetching PRDs for project:",a.name);const ie=await lt.get(`/taskmaster/prd/${encodeURIComponent(a.name)}`);if(ie.ok){const Me=await ie.json();console.log("Fetched existing PRDs:",Me.prds),P(Me.prds||[])}else console.log("Failed to fetch PRDs:",ie.status,ie.statusText)}catch(ie){console.error("Error fetching existing PRDs:",ie)}})()},[a?.name]);const de=async()=>{if(!l.trim()){alert("Please add content before saving.");return}if(!R.trim()){alert("Please provide a filename for the PRD.");return}const M=R.endsWith(".txt")||R.endsWith(".md")?R:`${R}.txt`,ie=U.find(Me=>Me.name===M);if(console.log("Save check:",{fullFileName:M,existingPRDs:U,existingFile:ie,isExisting:e?.isExisting,fileObject:e,shouldShowModal:ie&&!e?.isExisting}),ie&&!e?.isExisting){console.log("Showing overwrite confirmation modal"),T(!0);return}await J()},J=async()=>{h(!0);try{const M=R.endsWith(".txt")||R.endsWith(".md")?R:`${R}.txt`,ie=await je(`/api/taskmaster/prd/${encodeURIComponent(a?.name)}`,{method:"POST",body:JSON.stringify({fileName:M,content:l})});if(!ie.ok){const Se=await ie.json();throw new Error(Se.message||`Save failed: ${ie.status}`)}S(!0),setTimeout(()=>S(!1),2e3);const Me=await lt.get(`/taskmaster/prd/${encodeURIComponent(a.name)}`);if(Me.ok){const Se=await Me.json();P(Se.prds||[])}o&&await o()}catch(M){console.error("Error saving PRD:",M),alert(`Error saving PRD: ${M.message}`)}finally{h(!1)}},X=()=>{const M=new Blob([l],{type:"text/markdown"}),ie=URL.createObjectURL(M),Me=document.createElement("a");Me.href=ie;const Se=R?`${R}.txt`:"prd.txt";Me.download=Se,document.body.appendChild(Me),Me.click(),document.body.removeChild(Me),URL.revokeObjectURL(ie)},j=async()=>{if(!l.trim()){alert("Please add content to the PRD before generating tasks.");return}A(!0)},ne=()=>{g(!p)};b.useEffect(()=>{const M=ie=>{(ie.ctrlKey||ie.metaKey)&&(ie.key==="s"?(ie.preventDefault(),de()):ie.key==="Escape"&&(ie.preventDefault(),t()))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[l]);const ue=M=>M.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/^\- (.*$)/gim,"<li>$1</li>").replace(/(<li>.*<\/li>)/gims,"<ul>$1</ul>").replace(/\n\n/gim,"</p><p>").replace(/^(?!<[h|u|l])(.*$)/gim,"<p>$1</p>").replace(/<\/ul>\s*<ul>/gim,"");return d?n.jsx("div",{className:"fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center",children:n.jsx("div",{className:"w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center bg-white dark:bg-gray-900",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),n.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading PRD..."})]})})}):n.jsxs("div",{className:`fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${p?"md:p-0":""}`,children:[n.jsxs("div",{className:Ke("bg-white dark:bg-gray-900 shadow-2xl flex flex-col","w-full h-full md:rounded-lg md:shadow-2xl",p?"md:w-full md:h-full md:rounded-none":"md:w-full md:max-w-6xl md:h-[85vh] md:max-h-[85vh]"),children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[n.jsx("div",{className:"w-8 h-8 bg-purple-600 rounded flex items-center justify-center flex-shrink-0",children:n.jsx(yr,{className:"w-4 h-4 text-white"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center min-w-0 flex-1 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md px-3 py-2 focus-within:ring-2 focus-within:ring-purple-500 focus-within:border-purple-500 dark:focus-within:ring-purple-400 dark:focus-within:border-purple-400",children:[n.jsx("input",{type:"text",value:R,onChange:M=>{const ie=M.target.value.replace(/[<>:"/\\|?*]/g,"");H(ie)},className:"font-medium text-gray-900 dark:text-white bg-transparent border-none outline-none min-w-0 flex-1 text-base sm:text-sm placeholder-gray-400 dark:placeholder-gray-500",placeholder:"Enter PRD filename",maxLength:100}),n.jsx("span",{className:"text-sm sm:text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap ml-1",children:".txt"})]}),n.jsx("button",{onClick:()=>document.querySelector('input[placeholder="Enter PRD filename"]')?.focus(),className:"p-1 text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:"Click to edit filename",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("span",{className:"text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-1 rounded whitespace-nowrap",children:"📋 PRD"}),i&&n.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300 px-2 py-1 rounded whitespace-nowrap",children:"✨ New"})]})]}),n.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:"Product Requirements Document"})]})]}),n.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>I(!N),className:Ke("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",N?"text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:N?"Switch to edit mode":"Preview markdown",children:n.jsx(ws,{className:"w-5 h-5 md:w-4 md:h-4"})}),n.jsx("button",{onClick:()=>E(!F),className:Ke("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",F?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:F?"Disable word wrap":"Enable word wrap",children:n.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"↵"})}),n.jsx("button",{onClick:()=>v(!y),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:n.jsx("span",{className:"text-lg md:text-base",children:y?"☀️":"🌙"})}),n.jsx("button",{onClick:X,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download PRD",children:n.jsx(pi,{className:"w-5 h-5 md:w-4 md:h-4"})}),n.jsxs("button",{onClick:j,disabled:!l.trim(),className:Ke("px-3 py-2 rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors text-sm font-medium","bg-purple-600 hover:bg-purple-700 text-white","min-h-[44px] md:min-h-0"),title:"Generate tasks from PRD content",children:[n.jsx(_n,{className:"w-4 h-4"}),n.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),n.jsx("button",{onClick:de,disabled:m,className:Ke("px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors","min-h-[44px] md:min-h-0",w?"bg-green-600 hover:bg-green-700":"bg-purple-600 hover:bg-purple-700"),children:w?n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),n.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):n.jsxs(n.Fragment,{children:[n.jsx(xi,{className:"w-5 h-5 md:w-4 md:h-4"}),n.jsx("span",{className:"hidden sm:inline",children:m?"Saving...":"Save PRD"})]})}),n.jsx("button",{onClick:ne,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:p?"Exit fullscreen":"Fullscreen",children:p?n.jsx(Yu,{className:"w-4 h-4"}):n.jsx(Jl,{className:"w-4 h-4"})}),n.jsx("button",{onClick:t,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:n.jsx(Mt,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),n.jsx("div",{className:"flex-1 overflow-hidden",children:N?n.jsx("div",{className:"h-full overflow-y-auto p-6 prose prose-gray dark:prose-invert max-w-none",children:n.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:ue(l)}})}):n.jsx(_u,{ref:_,value:l,onChange:c,extensions:[Hu(),...F?[Rr.lineWrapping]:[]],theme:y?qu:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),n.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[n.jsxs("span",{children:["Lines: ",l.split(`
1173
+ `).length]}),n.jsxs("span",{children:["Characters: ",l.length]}),n.jsxs("span",{children:["Words: ",l.split(/\s+/).filter(M=>M.length>0).length]}),n.jsx("span",{children:"Format: Markdown"})]}),n.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),$&&n.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:n.jsx(_n,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),n.jsx("button",{onClick:()=>A(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:n.jsx(Mt,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"p-6 space-y-4",children:[n.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:n.jsx(_n,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Claude Code Directly!"}),n.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask Claude Code in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[n.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),n.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,R.endsWith(".txt")||R.endsWith(".md")?R:`${R}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),n.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[n.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),n.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[n.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),n.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),n.jsx("div",{className:"pt-4",children:n.jsx("button",{onClick:()=>A(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask Claude Code directly"})})]})]})}),V&&n.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>T(!1)}),n.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:n.jsxs("div",{className:"p-6",children:[n.jsxs("div",{className:"flex items-center mb-4",children:[n.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:n.jsx(ca,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),n.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',R.endsWith(".txt")||R.endsWith(".md")?R:`${R}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),n.jsxs("div",{className:"flex justify-end space-x-3",children:[n.jsx("button",{onClick:()=>T(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),n.jsxs("button",{onClick:async()=>{T(!1),await J()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[n.jsx(xi,{className:"w-4 h-4"}),n.jsx("span",{children:"Overwrite"})]})]})]})})]})]})};function J8({selectedProject:e,selectedSession:t,activeTab:r,setActiveTab:a,ws:s,sendMessage:i,messages:o,isMobile:l,isPWA:c,onMenuClick:d,isLoading:u,onInputFocusChange:m,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:y,processingSessions:v,onReplaceTemporarySession:w,onNavigateToSession:S,onShowSettings:N,autoExpandTools:I,showRawParameters:F,showThinking:E,autoScrollToBottom:R,sendByCtrlEnter:H,externalMessageUpdate:$}){const[A,V]=b.useState(null),[T,U]=b.useState(null),[P,_]=b.useState(!1),[se,de]=b.useState(600),[J,X]=b.useState(!1),[j,ne]=b.useState(!1),ue=b.useRef(null),[M,ie]=b.useState(!1),[Me,Se]=b.useState(null),[me,_e]=b.useState([]),[ce,ve]=b.useState(null),{tasks:He,currentProject:Le,refreshTasks:rt,setCurrentProject:Ye}=Ss(),{tasksEnabled:yt,isTaskMasterInstalled:mt,isTaskMasterReady:vt}=Cs(),ft=yt&&mt;b.useEffect(()=>{e&&e!==Le&&Ye(e)},[e,Le,Ye]),b.useEffect(()=>{!ft&&r==="tasks"&&a("chat")},[ft,r,a]),b.useEffect(()=>{(async()=>{if(!Le?.name){_e([]);return}try{const G=await lt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`);if(G.ok){const be=await G.json();_e(be.prdFiles||[])}else _e([])}catch(G){console.error("Failed to load existing PRDs:",G),_e([])}})()},[Le?.name]);const Ue=(q,G=null)=>{const be={name:q.split("/").pop(),path:q,projectName:e?.name,diffInfo:G};V(be)},bt=()=>{V(null),ne(!1)},kt=()=>{ne(!j)},Vt=q=>{if(typeof q=="object"&&q.id&&!q.title){const G=He?.find(be=>be.id===q.id);G&&(U(G),_(!0))}else U(q),_(!0)},Ve=()=>{_(!1),U(null)},we=(q,G)=>{console.log("Update task status:",q,G),rt?.()},Ae=q=>{l||(X(!0),q.preventDefault())};return b.useEffect(()=>{const q=be=>{if(!J)return;const Pe=ue.current?.parentElement;if(!Pe)return;const st=Pe.getBoundingClientRect(),he=st.right-be.clientX,B=300,ee=st.width*.8;he>=B&&he<=ee&&de(he)},G=()=>{X(!1)};return J&&(document.addEventListener("mousemove",q),document.addEventListener("mouseup",G),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",G),document.body.style.cursor="",document.body.style.userSelect=""}},[J]),u?n.jsxs("div",{className:"h-full flex flex-col",children:[l&&n.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:n.jsx("button",{onClick:d,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[n.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:n.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),n.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Loading Claude Code UI"}),n.jsx("p",{children:"Setting up your workspace..."})]})})]}):e?n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:n.jsxs("div",{className:"flex items-center justify-between relative",children:[n.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[l&&n.jsx("button",{onClick:d,onTouchStart:q=>{q.preventDefault(),d()},className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),n.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-1 overflow-x-auto scrollbar-hide",children:[r==="chat"&&t&&n.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:t.__provider==="cursor"?n.jsx(Gr,{className:"w-4 h-4"}):n.jsx(Fr,{className:"w-4 h-4"})}),n.jsx("div",{className:"min-w-0 flex-1",children:r==="chat"&&t?n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white whitespace-nowrap overflow-x-auto scrollbar-hide",children:t.__provider==="cursor"?t.name||"Untitled Session":t.summary||"New Session"}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):r==="chat"&&!t?n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:"New Session"}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]}):n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:r==="files"?"Project Files":r==="git"?"Source Control":r==="tasks"&&ft?"TaskMaster":"Project"}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.displayName})]})})]})]}),n.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:n.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[n.jsx(vr,{content:"Chat",position:"bottom",children:n.jsx("button",{onClick:()=>a("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${r==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:n.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[n.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),n.jsx("span",{className:"hidden md:hidden lg:inline",children:"Chat"})]})})}),n.jsx(vr,{content:"Shell",position:"bottom",children:n.jsx("button",{onClick:()=>a("shell"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:n.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[n.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})}),n.jsx("span",{className:"hidden md:hidden lg:inline",children:"Shell"})]})})}),n.jsx(vr,{content:"Files",position:"bottom",children:n.jsx("button",{onClick:()=>a("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:n.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[n.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),n.jsx("span",{className:"hidden md:hidden lg:inline",children:"Files"})]})})}),n.jsx(vr,{content:"Source Control",position:"bottom",children:n.jsx("button",{onClick:()=>a("git"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="git"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:n.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[n.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),n.jsx("span",{className:"hidden md:hidden lg:inline",children:"Source Control"})]})})}),ft&&n.jsx(vr,{content:"Tasks",position:"bottom",children:n.jsx("button",{onClick:()=>a("tasks"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${r==="tasks"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:n.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[n.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),n.jsx("span",{className:"hidden md:hidden lg:inline",children:"Tasks"})]})})})]})})]})}),n.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[n.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${A?"mr-0":""} ${j?"hidden":""}`,children:[n.jsx("div",{className:`h-full ${r==="chat"?"block":"hidden"}`,children:n.jsx(U8,{showDetails:!0,children:n.jsx(Z7,{selectedProject:e,selectedSession:t,ws:s,sendMessage:i,messages:o,onFileOpen:Ue,onInputFocusChange:m,onSessionActive:h,onSessionInactive:p,onSessionProcessing:g,onSessionNotProcessing:y,processingSessions:v,onReplaceTemporarySession:w,onNavigateToSession:S,onShowSettings:N,autoExpandTools:I,showRawParameters:F,showThinking:E,autoScrollToBottom:R,sendByCtrlEnter:H,externalMessageUpdate:$,onShowAllTasks:yt?()=>a("tasks"):null})})}),r==="files"&&n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(H8,{selectedProject:e})}),r==="shell"&&n.jsx("div",{className:"h-full w-full overflow-hidden",children:n.jsx(ff,{project:e,session:t,showHeader:!1})}),r==="git"&&n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(W8,{selectedProject:e,isMobile:l,onFileOpen:Ue})}),ft&&n.jsx("div",{className:`h-full ${r==="tasks"?"block":"hidden"}`,children:n.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:n.jsx(G8,{tasks:He||[],onTaskClick:Vt,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:Le,onTaskCreated:rt,onShowPRDEditor:(q=null)=>{Se(q),ie(!0)},existingPRDs:me,onRefreshPRDs:(q=!1)=>{Le?.name&&lt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`).then(G=>G.ok?G.json():Promise.reject()).then(G=>{_e(G.prdFiles||[]),q&&(ve("PRD saved successfully!"),setTimeout(()=>ve(null),3e3))}).catch(G=>console.error("Failed to refresh PRDs:",G))}})})}),n.jsx("div",{className:`h-full overflow-hidden ${r==="preview"?"block":"hidden"}`})]}),A&&!l&&n.jsxs(n.Fragment,{children:[!j&&n.jsx("div",{ref:ue,onMouseDown:Ae,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:n.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),n.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${j?"flex-1":""}`,style:j?{}:{width:`${se}px`},children:n.jsx(_l,{file:A,onClose:bt,projectPath:e?.path,isSidebar:!0,isExpanded:j,onToggleExpand:kt})})]})]}),A&&l&&n.jsx(_l,{file:A,onClose:bt,projectPath:e?.path,isSidebar:!1}),ft&&P&&T&&n.jsx(Bp,{task:T,isOpen:P,onClose:Ve,onStatusChange:we,onTaskClick:Vt}),M&&n.jsx(K8,{project:Le,projectPath:Le?.fullPath||Le?.path,onClose:()=>{ie(!1),Se(null)},isNewFile:!Me?.isExisting,file:{name:Me?.name||"prd.txt",content:Me?.content||""},onSave:async()=>{ie(!1),Se(null);try{const q=await lt.get(`/taskmaster/prd/${encodeURIComponent(Le.name)}`);if(q.ok){const G=await q.json();_e(G.prdFiles||[]),ve("PRD saved successfully!"),setTimeout(()=>ve(null),3e3)}}catch(q){console.error("Failed to refresh PRDs:",q)}rt?.()}}),ce&&n.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:n.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),n.jsx("span",{className:"font-medium",children:ce})]})})]}):n.jsxs("div",{className:"h-full flex flex-col",children:[l&&n.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:n.jsx("button",{onClick:d,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[n.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:n.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),n.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:"Choose Your Project"}),n.jsx("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:"Select a project from the sidebar to start coding with Claude. Each project contains your chat sessions and file history."}),n.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:n.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",n.jsx("strong",{children:"Tip:"})," ",l?"Tap the menu button above to access projects":"Create a new project by clicking the folder icon in the sidebar"]})})]})})]})}const Y8=Kr.memo(J8);function X8({activeTab:e,setActiveTab:t,isInputFocused:r}){const{tasksEnabled:a}=Cs(),s=[{id:"chat",icon:us,onClick:()=>t("chat")},{id:"shell",icon:qn,onClick:()=>t("shell")},{id:"files",icon:On,onClick:()=>t("files")},{id:"git",icon:kn,onClick:()=>t("git")},...a?[{id:"tasks",icon:Fx,onClick:()=>t("tasks")}]:[]];return n.jsx("div",{className:`fixed bottom-0 left-0 right-0 bg-background border-t border-border z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${r?"translate-y-full":"translate-y-0"}`,children:n.jsx("div",{className:"flex items-center justify-around py-1",children:s.map(i=>{const o=i.icon,l=e===i.id;return n.jsxs("button",{onClick:i.onClick,onTouchStart:c=>{c.preventDefault(),i.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${l?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":i.id,children:[n.jsx(o,{className:"w-5 h-5"}),l&&n.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},i.id)})})})}const ql="1.12.0",gf=(e,t)=>{const[r,a]=b.useState(!1),[s,i]=b.useState(null),[o,l]=b.useState(null);return b.useEffect(()=>{const c=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(m.tag_name){const h=m.tag_name.replace(/^v/,"");i(h),a(ql!==h),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:m.published_at})}else a(!1),i(null),l(null)}catch(u){console.error("Version check failed:",u),a(!1),i(null),l(null)}};c();const d=setInterval(c,300*1e3);return()=>clearInterval(d)},[e,t]),{updateAvailable:r,latestVersion:s,currentVersion:ql,releaseInfo:o}};function Q8(){const[e,t]=b.useState([]),[r,a]=b.useState([]),[s,i]=b.useState(!0),[o,l]=b.useState(!1),[c,d]=b.useState(!1),[u,m]=b.useState(""),[h,p]=b.useState(""),[g,y]=b.useState(""),[v,w]=b.useState(""),[S,N]=b.useState({}),[I,F]=b.useState(null),[E,R]=b.useState(null),{updateAvailable:H,latestVersion:$,releaseInfo:A}=gf("siteboon","claudecodeui");b.useEffect(()=>{V()},[]);const V=async()=>{try{i(!0);const j=await(await je("/api/settings/api-keys")).json();t(j.apiKeys||[]);const ue=await(await je("/api/settings/credentials?type=github_token")).json();a(ue.credentials||[])}catch(X){console.error("Error fetching settings:",X)}finally{i(!1)}},T=async()=>{if(u.trim())try{const j=await(await je("/api/settings/api-keys",{method:"POST",body:JSON.stringify({keyName:u})})).json();j.success&&(R(j.apiKey),m(""),l(!1),V())}catch(X){console.error("Error creating API key:",X)}},U=async X=>{if(confirm("Are you sure you want to delete this API key?"))try{await je(`/api/settings/api-keys/${X}`,{method:"DELETE"}),V()}catch(j){console.error("Error deleting API key:",j)}},P=async(X,j)=>{try{await je(`/api/settings/api-keys/${X}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!j})}),V()}catch(ne){console.error("Error toggling API key:",ne)}},_=async()=>{if(!(!h.trim()||!g.trim()))try{(await(await je("/api/settings/credentials",{method:"POST",body:JSON.stringify({credentialName:h,credentialType:"github_token",credentialValue:g,description:v})})).json()).success&&(p(""),y(""),w(""),d(!1),V())}catch(X){console.error("Error creating GitHub credential:",X)}},se=async X=>{if(confirm("Are you sure you want to delete this GitHub token?"))try{await je(`/api/settings/credentials/${X}`,{method:"DELETE"}),V()}catch(j){console.error("Error deleting GitHub credential:",j)}},de=async(X,j)=>{try{await je(`/api/settings/credentials/${X}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!j})}),V()}catch(ne){console.error("Error toggling GitHub credential:",ne)}},J=(X,j)=>{navigator.clipboard.writeText(X),F(j),setTimeout(()=>F(null),2e3)};return s?n.jsx("div",{className:"text-muted-foreground",children:"Loading..."}):n.jsxs("div",{className:"space-y-8",children:[E&&n.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[n.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:"⚠️ Save Your API Key"}),n.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"This is the only time you'll see this key. Store it securely."}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:E.apiKey}),n.jsx(qe,{size:"sm",variant:"outline",onClick:()=>J(E.apiKey,"new"),children:I==="new"?n.jsx(dr,{className:"h-4 w-4"}):n.jsx(Gu,{className:"h-4 w-4"})})]}),n.jsx(qe,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>R(null),children:"I've saved it"})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Kl,{className:"h-5 w-5"}),n.jsx("h3",{className:"text-lg font-semibold",children:"API Keys"})]}),n.jsxs(qe,{size:"sm",onClick:()=>l(!o),children:[n.jsx(ar,{className:"h-4 w-4 mr-1"}),"New API Key"]})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Generate API keys to access the external API from other applications."}),n.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:["API Documentation",n.jsx(tc,{className:"h-3 w-3"})]})]}),o&&n.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[n.jsx(Ht,{placeholder:"API Key Name (e.g., Production Server)",value:u,onChange:X=>m(X.target.value),className:"mb-2"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(qe,{onClick:T,children:"Create"}),n.jsx(qe,{variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]}),n.jsx("div",{className:"space-y-2",children:e.length===0?n.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No API keys created yet."}):e.map(X=>n.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-medium",children:X.key_name}),n.jsx("code",{className:"text-xs text-muted-foreground",children:X.api_key}),n.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Created: ",new Date(X.created_at).toLocaleDateString(),X.last_used&&` • Last used: ${new Date(X.last_used).toLocaleDateString()}`]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{size:"sm",variant:X.is_active?"outline":"secondary",onClick:()=>P(X.id,X.is_active),children:X.is_active?"Active":"Inactive"}),n.jsx(qe,{size:"sm",variant:"ghost",onClick:()=>U(X.id),children:n.jsx(Tr,{className:"h-4 w-4"})})]})]},X.id))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qg,{className:"h-5 w-5"}),n.jsx("h3",{className:"text-lg font-semibold",children:"GitHub Credentials"})]}),n.jsxs(qe,{size:"sm",onClick:()=>d(!c),children:[n.jsx(ar,{className:"h-4 w-4 mr-1"}),"Add Token"]})]}),n.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add GitHub Personal Access Tokens to clone private repositories. You can also pass tokens directly in API requests without storing them."}),c&&n.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[n.jsx(Ht,{placeholder:"Token Name (e.g., Personal Repos)",value:h,onChange:X=>p(X.target.value)}),n.jsxs("div",{className:"relative",children:[n.jsx(Ht,{type:S.new?"text":"password",placeholder:"GitHub Personal Access Token (ghp_...)",value:g,onChange:X=>y(X.target.value),className:"pr-10"}),n.jsx("button",{type:"button",onClick:()=>N({...S,new:!S.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:S.new?n.jsx(Bg,{className:"h-4 w-4"}):n.jsx(ws,{className:"h-4 w-4"})})]}),n.jsx(Ht,{placeholder:"Description (optional)",value:v,onChange:X=>w(X.target.value)}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(qe,{onClick:_,children:"Add Token"}),n.jsx(qe,{variant:"outline",onClick:()=>{d(!1),p(""),y(""),w("")},children:"Cancel"})]}),n.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:"How to create a GitHub Personal Access Token →"})]}),n.jsx("div",{className:"space-y-2",children:r.length===0?n.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No GitHub tokens added yet."}):r.map(X=>n.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-medium",children:X.credential_name}),X.description&&n.jsx("div",{className:"text-xs text-muted-foreground",children:X.description}),n.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Added: ",new Date(X.created_at).toLocaleDateString()]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{size:"sm",variant:X.is_active?"outline":"secondary",onClick:()=>de(X.id,X.is_active),children:X.is_active?"Active":"Inactive"}),n.jsx(qe,{size:"sm",variant:"ghost",onClick:()=>se(X.id),children:n.jsx(Tr,{className:"h-4 w-4"})})]})]},X.id))})]}),n.jsx("div",{className:"pt-6 border-t border-border/50",children:n.jsxs("div",{className:"flex items-center justify-between text-xs italic text-muted-foreground/60",children:[n.jsxs("a",{href:A?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-muted-foreground transition-colors",children:["v",ql]}),H&&$&&n.jsxs("a",{href:A?.htmlUrl||"https://github.com/siteboon/claudecodeui/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400 rounded-full hover:bg-green-500/20 transition-colors not-italic font-medium",children:[n.jsxs("span",{className:"text-[10px]",children:["Update available: v",$]}),n.jsx(tc,{className:"h-2.5 w-2.5"})]})]})})]})}function Z8(){const[e,t]=b.useState(""),[r,a]=b.useState(""),[s,i]=b.useState(!1),[o,l]=b.useState(!1),[c,d]=b.useState(null);b.useEffect(()=>{u()},[]);const u=async()=>{try{i(!0);const h=await je("/api/user/git-config");if(h.ok){const p=await h.json();t(p.gitName||""),a(p.gitEmail||"")}}catch(h){console.error("Error loading git config:",h)}finally{i(!1)}},m=async()=>{try{l(!0);const h=await je("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:e,gitEmail:r})});if(h.ok)d("success"),setTimeout(()=>d(null),3e3);else{const p=await h.json();d("error"),console.error("Failed to save git config:",p.error)}}catch(h){console.error("Error saving git config:",h),d("error")}finally{l(!1)}};return n.jsx("div",{className:"space-y-8",children:n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx(kn,{className:"h-5 w-5"}),n.jsx("h3",{className:"text-lg font-semibold",children:"Git Configuration"})]}),n.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Configure your git identity for commits. These settings will be applied globally via ",n.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-xs",children:"git config --global"})]}),n.jsxs("div",{className:"p-4 border rounded-lg bg-card space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:"settings-git-name",className:"block text-sm font-medium text-foreground mb-2",children:"Git Name"}),n.jsx(Ht,{id:"settings-git-name",type:"text",value:e,onChange:h=>t(h.target.value),placeholder:"John Doe",disabled:s,className:"w-full"}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Your name for git commits"})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"settings-git-email",className:"block text-sm font-medium text-foreground mb-2",children:"Git Email"}),n.jsx(Ht,{id:"settings-git-email",type:"email",value:r,onChange:h=>a(h.target.value),placeholder:"john@example.com",disabled:s,className:"w-full"}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Your email for git commits"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(qe,{onClick:m,disabled:o||!e||!r,children:o?"Saving...":"Save Configuration"}),c==="success"&&n.jsxs("div",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[n.jsx(dr,{className:"w-4 h-4"}),"Saved successfully"]})]})]})]})})}function e9(){const{tasksEnabled:e,setTasksEnabled:t,isTaskMasterInstalled:r,isCheckingInstallation:a}=Cs();return n.jsx("div",{className:"space-y-8",children:a?n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking TaskMaster installation..."})]})}):n.jsxs(n.Fragment,{children:[!r&&n.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:n.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:"TaskMaster AI CLI Not Installed"}),n.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[n.jsx("p",{children:"TaskMaster CLI is required to use task management features. Install it to get started:"}),n.jsx("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:n.jsx("code",{children:"npm install -g task-master-ai"})}),n.jsx("div",{children:n.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium text-sm",children:[n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"font-medium",children:"After installation:"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[n.jsx("li",{children:"Restart this application"}),n.jsx("li",{children:"TaskMaster features will automatically become available"}),n.jsxs("li",{children:["Use ",n.jsx("code",{className:"bg-orange-100 dark:bg-orange-800 px-1 rounded",children:"task-master init"})," in your project directory"]})]})]})]})]})]})}),r&&n.jsx("div",{className:"space-y-4",children:n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Enable TaskMaster Integration"}),n.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"})]}),n.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:e,onChange:s=>t(s.target.checked),className:"sr-only peer"}),n.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]})})})]})})}function xf({isOpen:e,onClose:t,provider:r="claude",project:a,onComplete:s,customCommand:i}){if(!e)return null;const o=()=>{if(i)return i;switch(r){case"claude":return"claude setup-token --dangerously-skip-permissions";case"cursor":return"cursor-agent login";case"codex":return"codex login";default:return"claude setup-token --dangerously-skip-permissions"}},l=()=>{switch(r){case"claude":return"Claude CLI Login";case"cursor":return"Cursor CLI Login";case"codex":return"Codex CLI Login";default:return"CLI Login"}},c=d=>{s&&s(d),d===0&&t()};return n.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] max-md:items-stretch max-md:justify-stretch",children:n.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[n.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l()}),n.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close login modal",children:n.jsx(Mt,{className:"w-6 h-6"})})]}),n.jsx("div",{className:"flex-1 overflow-hidden",children:n.jsx(ff,{project:a,command:o(),onComplete:c,minimal:!0})})]})})}const t9={claude:{name:"Claude",color:"blue",Logo:Fr},cursor:{name:"Cursor",color:"purple",Logo:Gr},codex:{name:"Codex",color:"gray",Logo:an}},r9={blue:{border:"border-l-blue-500 md:border-l-blue-500",borderBottom:"border-b-blue-500",bg:"bg-blue-50 dark:bg-blue-900/20",dot:"bg-blue-500"},purple:{border:"border-l-purple-500 md:border-l-purple-500",borderBottom:"border-b-purple-500",bg:"bg-purple-50 dark:bg-purple-900/20",dot:"bg-purple-500"},gray:{border:"border-l-gray-700 dark:border-l-gray-300",borderBottom:"border-b-gray-700 dark:border-b-gray-300",bg:"bg-gray-100 dark:bg-gray-800/50",dot:"bg-gray-700 dark:bg-gray-300"}};function ja({agentId:e,authStatus:t,isSelected:r,onClick:a,isMobile:s=!1}){const i=t9[e],o=r9[i.color],{Logo:l}=i;return s?n.jsx("button",{onClick:a,className:`flex-1 text-center py-3 px-2 border-b-2 transition-colors ${r?`${o.borderBottom} ${o.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:n.jsxs("div",{className:"flex flex-col items-center gap-1",children:[n.jsx(l,{className:"w-5 h-5"}),n.jsx("span",{className:"text-xs font-medium text-foreground",children:i.name}),t?.authenticated&&n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${o.dot}`})]})}):n.jsxs("button",{onClick:a,className:`w-full text-left p-3 border-l-4 transition-colors ${r?`${o.border} ${o.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx(l,{className:"w-4 h-4"}),n.jsx("span",{className:"font-medium text-foreground",children:i.name})]}),n.jsx("div",{className:"text-xs text-muted-foreground pl-6",children:t?.loading?n.jsx("span",{className:"text-gray-400",children:"Checking..."}):t?.authenticated?n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${o.dot}`}),n.jsx("span",{className:"truncate max-w-[120px]",title:t.email,children:t.email||"Connected"})]}):n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),n.jsx("span",{children:"Not connected"})]})})]})}const n9={claude:{name:"Claude",description:"Anthropic Claude AI assistant",Logo:Fr,bgClass:"bg-blue-50 dark:bg-blue-900/20",borderClass:"border-blue-200 dark:border-blue-800",textClass:"text-blue-900 dark:text-blue-100",subtextClass:"text-blue-700 dark:text-blue-300",buttonClass:"bg-blue-600 hover:bg-blue-700"},cursor:{name:"Cursor",description:"Cursor AI-powered code editor",Logo:Gr,bgClass:"bg-purple-50 dark:bg-purple-900/20",borderClass:"border-purple-200 dark:border-purple-800",textClass:"text-purple-900 dark:text-purple-100",subtextClass:"text-purple-700 dark:text-purple-300",buttonClass:"bg-purple-600 hover:bg-purple-700"},codex:{name:"Codex",description:"OpenAI Codex AI assistant",Logo:an,bgClass:"bg-gray-100 dark:bg-gray-800/50",borderClass:"border-gray-300 dark:border-gray-600",textClass:"text-gray-900 dark:text-gray-100",subtextClass:"text-gray-700 dark:text-gray-300",buttonClass:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"}};function a9({agent:e,authStatus:t,onLogin:r}){const a=n9[e],{Logo:s}=a;return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx(s,{className:"w-6 h-6"}),n.jsxs("div",{children:[n.jsxs("h3",{className:"text-lg font-medium text-foreground",children:[a.name," Account"]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]})]}),n.jsx("div",{className:`${a.bgClass} border ${a.borderClass} rounded-lg p-4`,children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:`font-medium ${a.textClass}`,children:"Connection Status"}),n.jsx("div",{className:`text-sm ${a.subtextClass}`,children:t?.loading?"Checking authentication status...":t?.authenticated?`Logged in as ${t.email||"authenticated user"}`:"Not connected"})]}),n.jsx("div",{children:t?.loading?n.jsx(Jr,{variant:"secondary",className:"bg-gray-100 dark:bg-gray-800",children:"Checking..."}):t?.authenticated?n.jsx(Jr,{variant:"success",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",children:"Connected"}):n.jsx(Jr,{variant:"secondary",className:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",children:"Disconnected"})})]}),n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:`font-medium ${a.textClass}`,children:t?.authenticated?"Re-authenticate":"Login"}),n.jsx("div",{className:`text-sm ${a.subtextClass}`,children:t?.authenticated?"Sign in with a different account or refresh credentials":`Sign in to your ${a.name} account to enable AI features`})]}),n.jsxs(qe,{onClick:r,className:`${a.buttonClass} text-white`,size:"sm",children:[n.jsx(Ju,{className:"w-4 h-4 mr-2"}),t?.authenticated?"Re-login":"Login"]})]})}),t?.error&&n.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:n.jsxs("div",{className:"text-sm text-red-600 dark:text-red-400",children:["Error: ",t.error]})})]})})]})}const s9=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],i9=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"];function o9({skipPermissions:e,setSkipPermissions:t,allowedTools:r,setAllowedTools:a,disallowedTools:s,setDisallowedTools:i,newAllowedTool:o,setNewAllowedTool:l,newDisallowedTool:c,setNewDisallowedTool:d}){const u=g=>{g&&!r.includes(g)&&(a([...r,g]),l(""))},m=g=>{a(r.filter(y=>y!==g))},h=g=>{g&&!s.includes(g)&&(i([...s,g]),d(""))},p=g=>{i(s.filter(y=>y!==g))};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ca,{className:"w-5 h-5 text-orange-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Permission Settings"})]}),n.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:n.jsxs("label",{className:"flex items-center gap-3",children:[n.jsx("input",{type:"checkbox",checked:e,onChange:g=>t(g.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),n.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to --dangerously-skip-permissions flag"})]})]})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Yl,{className:"w-5 h-5 text-green-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Tools"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically allowed without prompting for permission"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx(Ht,{value:o,onChange:g=>l(g.target.value),placeholder:'e.g., "Bash(git log:*)" or "Write"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),u(o))},className:"flex-1 h-10"}),n.jsxs(qe,{onClick:()=>u(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[n.jsx(ar,{className:"w-4 h-4 mr-2 sm:mr-0"}),n.jsx("span",{className:"sm:hidden",children:"Add"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common tools:"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:s9.map(g=>n.jsx(qe,{variant:"outline",size:"sm",onClick:()=>u(g),disabled:r.includes(g),className:"text-xs h-8",children:g},g))})]}),n.jsxs("div",{className:"space-y-2",children:[r.map(g=>n.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[n.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:g}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>m(g),className:"text-green-600 hover:text-green-700",children:n.jsx(Mt,{className:"w-4 h-4"})})]},g)),r.length===0&&n.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"No allowed tools configured"})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ca,{className:"w-5 h-5 text-red-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Blocked Tools"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Tools that are automatically blocked without prompting for permission"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx(Ht,{value:c,onChange:g=>d(g.target.value),placeholder:'e.g., "Bash(rm:*)"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),h(c))},className:"flex-1 h-10"}),n.jsxs(qe,{onClick:()=>h(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[n.jsx(ar,{className:"w-4 h-4 mr-2 sm:mr-0"}),n.jsx("span",{className:"sm:hidden",children:"Add"})]})]}),n.jsxs("div",{className:"space-y-2",children:[s.map(g=>n.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[n.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:g}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>p(g),className:"text-red-600 hover:text-red-700",children:n.jsx(Mt,{className:"w-4 h-4"})})]},g)),s.length===0&&n.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"No blocked tools configured"})]})]}),n.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[n.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Tool Pattern Examples:"}),n.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[n.jsxs("li",{children:[n.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," - Allow all git log commands"]}),n.jsxs("li",{children:[n.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," - Allow all git diff commands"]}),n.jsxs("li",{children:[n.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," - Allow all Write tool usage"]}),n.jsxs("li",{children:[n.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," - Block all rm commands (dangerous)"]})]})]})]})}function l9({skipPermissions:e,setSkipPermissions:t,allowedCommands:r,setAllowedCommands:a,disallowedCommands:s,setDisallowedCommands:i,newAllowedCommand:o,setNewAllowedCommand:l,newDisallowedCommand:c,setNewDisallowedCommand:d}){const u=g=>{g&&!r.includes(g)&&(a([...r,g]),l(""))},m=g=>{a(r.filter(y=>y!==g))},h=g=>{g&&!s.includes(g)&&(i([...s,g]),d(""))},p=g=>{i(s.filter(y=>y!==g))};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ca,{className:"w-5 h-5 text-orange-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Permission Settings"})]}),n.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:n.jsxs("label",{className:"flex items-center gap-3",children:[n.jsx("input",{type:"checkbox",checked:e,onChange:g=>t(g.target.checked),className:"w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),n.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to -f flag in Cursor CLI"})]})]})})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Yl,{className:"w-5 h-5 text-green-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Shell Commands"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that are automatically allowed without prompting"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx(Ht,{value:o,onChange:g=>l(g.target.value),placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),u(o))},className:"flex-1 h-10"}),n.jsxs(qe,{onClick:()=>u(o),disabled:!o,size:"sm",className:"h-10 px-4",children:[n.jsx(ar,{className:"w-4 h-4 mr-2 sm:mr-0"}),n.jsx("span",{className:"sm:hidden",children:"Add"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common commands:"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:i9.map(g=>n.jsx(qe,{variant:"outline",size:"sm",onClick:()=>u(g),disabled:r.includes(g),className:"text-xs h-8",children:g},g))})]}),n.jsxs("div",{className:"space-y-2",children:[r.map(g=>n.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[n.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:g}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>m(g),className:"text-green-600 hover:text-green-700",children:n.jsx(Mt,{className:"w-4 h-4"})})]},g)),r.length===0&&n.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"No allowed commands configured"})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ca,{className:"w-5 h-5 text-red-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Blocked Shell Commands"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that are automatically blocked"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[n.jsx(Ht,{value:c,onChange:g=>d(g.target.value),placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),h(c))},className:"flex-1 h-10"}),n.jsxs(qe,{onClick:()=>h(c),disabled:!c,size:"sm",className:"h-10 px-4",children:[n.jsx(ar,{className:"w-4 h-4 mr-2 sm:mr-0"}),n.jsx("span",{className:"sm:hidden",children:"Add"})]})]}),n.jsxs("div",{className:"space-y-2",children:[s.map(g=>n.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[n.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:g}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>p(g),className:"text-red-600 hover:text-red-700",children:n.jsx(Mt,{className:"w-4 h-4"})})]},g)),s.length===0&&n.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"No blocked commands configured"})]})]}),n.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[n.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:"Shell Command Examples:"}),n.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[n.jsxs("li",{children:[n.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," - Allow ls command"]}),n.jsxs("li",{children:[n.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," - Allow git status"]}),n.jsxs("li",{children:[n.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(npm install)"'})," - Allow npm install"]}),n.jsxs("li",{children:[n.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(rm -rf)"'})," - Block recursive delete"]})]})]})]})}function c9({permissionMode:e,setPermissionMode:t}){return n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Yl,{className:"w-5 h-5 text-green-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Permission Mode"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Controls how Codex handles file modifications and command execution"}),n.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("default"),children:n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="default",onChange:()=>t("default"),className:"mt-1 w-4 h-4 text-green-600"}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Default"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Only trusted commands (ls, cat, grep, git status, etc.) run automatically. Other commands are skipped. Can write to workspace."})]})]})}),n.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("acceptEdits"),children:n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="acceptEdits",onChange:()=>t("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:"Accept Edits"}),n.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:"All commands run automatically within the workspace. Full auto mode with sandboxed execution."})]})]})}),n.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${e==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>t("bypassPermissions"),children:n.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[n.jsx("input",{type:"radio",name:"codexPermissionMode",checked:e==="bypassPermissions",onChange:()=>t("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),n.jsxs("div",{children:[n.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:["Bypass Permissions",n.jsx(ca,{className:"w-4 h-4"})]}),n.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Full system access with no restrictions. All commands run automatically with full disk and network access. Use with caution."})]})]})}),n.jsxs("details",{className:"text-sm",children:[n.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Technical details"}),n.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Default:"})," sandboxMode=workspace-write, approvalPolicy=untrusted. Trusted commands: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (without -exec), etc."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Accept Edits:"})," sandboxMode=workspace-write, approvalPolicy=never. All commands auto-execute within project directory."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Bypass Permissions:"})," sandboxMode=danger-full-access, approvalPolicy=never. Full system access, use only in trusted environments."]}),n.jsx("p",{className:"text-xs opacity-75",children:"You can override this per-session using the mode button in the chat interface."})]})]})]})})}function Xo({agent:e,...t}){return e==="claude"?n.jsx(o9,{...t}):e==="cursor"?n.jsx(l9,{...t}):e==="codex"?n.jsx(c9,{...t}):null}const d9=e=>{switch(e){case"stdio":return n.jsx(qn,{className:"w-4 h-4"});case"sse":return n.jsx(Qu,{className:"w-4 h-4"});case"http":return n.jsx(el,{className:"w-4 h-4"});default:return n.jsx(Pi,{className:"w-4 h-4"})}};function u9({servers:e,onAdd:t,onEdit:r,onDelete:a,onTest:s,onDiscoverTools:i,testResults:o,serverTools:l,toolsLoading:c}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Pi,{className:"w-5 h-5 text-purple-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP Servers"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Model Context Protocol servers provide additional tools and data sources to Claude"}),n.jsx("div",{className:"flex justify-between items-center",children:n.jsxs(qe,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[n.jsx(ar,{className:"w-4 h-4 mr-2"}),"Add MCP Server"]})}),n.jsxs("div",{className:"space-y-2",children:[e.map(d=>n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d9(d.type),n.jsx("span",{className:"font-medium text-foreground",children:d.name}),n.jsx(Jr,{variant:"outline",className:"text-xs",children:d.type}),n.jsx(Jr,{variant:"outline",className:"text-xs",children:d.scope==="local"?"local":d.scope==="user"?"user":d.scope})]}),n.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[d.type==="stdio"&&d.config?.command&&n.jsxs("div",{children:["Command: ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.command})]}),(d.type==="sse"||d.type==="http")&&d.config?.url&&n.jsxs("div",{children:["URL: ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.url})]}),d.config?.args&&d.config.args.length>0&&n.jsxs("div",{children:["Args: ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:d.config.args.join(" ")})]})]}),o?.[d.id]&&n.jsx("div",{className:`mt-2 p-2 rounded text-xs ${o[d.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:n.jsx("div",{className:"font-medium",children:o[d.id].message})}),l?.[d.id]&&l[d.id].tools?.length>0&&n.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[n.jsxs("div",{className:"font-medium",children:["Tools (",l[d.id].tools.length,"):"]}),n.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[l[d.id].tools.slice(0,5).map((u,m)=>n.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:u.name},m)),l[d.id].tools.length>5&&n.jsxs("span",{className:"text-xs opacity-75",children:["+",l[d.id].tools.length-5," more"]})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[n.jsx(qe,{onClick:()=>r(d),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:"Edit server",children:n.jsx(ms,{className:"w-4 h-4"})}),n.jsx(qe,{onClick:()=>a(d.id,d.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:"Delete server",children:n.jsx(Tr,{className:"w-4 h-4"})})]})]})},d.id)),e.length===0&&n.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No MCP servers configured"})]})]})}function m9({servers:e,onAdd:t,onEdit:r,onDelete:a}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Pi,{className:"w-5 h-5 text-purple-500"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP Servers"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Model Context Protocol servers provide additional tools and data sources to Cursor"}),n.jsx("div",{className:"flex justify-between items-center",children:n.jsxs(qe,{onClick:t,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[n.jsx(ar,{className:"w-4 h-4 mr-2"}),"Add MCP Server"]})}),n.jsxs("div",{className:"space-y-2",children:[e.map(s=>n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(qn,{className:"w-4 h-4"}),n.jsx("span",{className:"font-medium text-foreground",children:s.name}),n.jsx(Jr,{variant:"outline",className:"text-xs",children:"stdio"})]}),n.jsx("div",{className:"text-sm text-muted-foreground",children:s.config?.command&&n.jsxs("div",{children:["Command: ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]})})]}),n.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[n.jsx(qe,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",children:n.jsx(ms,{className:"w-4 h-4"})}),n.jsx(qe,{onClick:()=>a(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",children:n.jsx(Tr,{className:"w-4 h-4"})})]})]})},s.name||s.id)),e.length===0&&n.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No MCP servers configured"})]})]})}function h9({servers:e,onAdd:t,onEdit:r,onDelete:a}){return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Pi,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}),n.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP Servers"})]}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Model Context Protocol servers provide additional tools and data sources to Codex"}),n.jsx("div",{className:"flex justify-between items-center",children:n.jsxs(qe,{onClick:t,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white",size:"sm",children:[n.jsx(ar,{className:"w-4 h-4 mr-2"}),"Add MCP Server"]})}),n.jsxs("div",{className:"space-y-2",children:[e.map(s=>n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(qn,{className:"w-4 h-4"}),n.jsx("span",{className:"font-medium text-foreground",children:s.name}),n.jsx(Jr,{variant:"outline",className:"text-xs",children:"stdio"})]}),n.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[s.config?.command&&n.jsxs("div",{children:["Command: ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]}),s.config?.args&&s.config.args.length>0&&n.jsxs("div",{children:["Args: ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.args.join(" ")})]}),s.config?.env&&Object.keys(s.config.env).length>0&&n.jsxs("div",{children:["Environment: ",n.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(s.config.env).map(([i,o])=>`${i}=${o}`).join(", ")})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[n.jsx(qe,{onClick:()=>r(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:"Edit server",children:n.jsx(ms,{className:"w-4 h-4"})}),n.jsx(qe,{onClick:()=>a(s.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:"Delete server",children:n.jsx(Tr,{className:"w-4 h-4"})})]})]})},s.name)),e.length===0&&n.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No MCP servers configured"})]}),n.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:[n.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2",children:"About Codex MCP"}),n.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Codex supports stdio-based MCP servers. You can add servers that extend Codex's capabilities with additional tools and resources."})]})]})}function Qo({agent:e,...t}){return e==="claude"?n.jsx(u9,{...t}):e==="cursor"?n.jsx(m9,{...t}):e==="codex"?n.jsx(h9,{...t}):null}function p9({isOpen:e,onClose:t,projects:r=[],initialTab:a="agents"}){const{isDarkMode:s,toggleDarkMode:i}=js(),[o,l]=b.useState([]),[c,d]=b.useState([]),[u,m]=b.useState(""),[h,p]=b.useState(""),[g,y]=b.useState(!1),[v,w]=b.useState(!1),[S,N]=b.useState(null),[I,F]=b.useState("name"),[E,R]=b.useState([]),[H,$]=b.useState(!1),[A,V]=b.useState(null),[T,U]=b.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[P,_]=b.useState(!1),[se,de]=b.useState({}),[J,X]=b.useState({}),[j,ne]=b.useState({}),[ue,M]=b.useState(a),[ie,Me]=b.useState(""),[Se,me]=b.useState("claude"),[_e,ce]=b.useState("account"),[ve,He]=b.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[Le,rt]=b.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[Ye,yt]=b.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[mt,vt]=b.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[ft,Ue]=b.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[bt,kt]=b.useState([]),[Vt,Ve]=b.useState([]),[we,Ae]=b.useState(!1),[q,G]=b.useState(""),[be,Pe]=b.useState(""),[st,he]=b.useState([]),[B,ee]=b.useState([]),[ge,Ne]=b.useState("default"),[Z,Ce]=b.useState(!1),[Ze,Ct]=b.useState({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),[At,Zt]=b.useState(null),[Xr,Qr]=b.useState(!1),[Dn,er]=b.useState(!1),[fr,sr]=b.useState(""),[Pt,qr]=b.useState(null),[lr,Gt]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[Q,le]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[Je,St]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),Wt=async()=>{try{const W=await je("/api/cursor/mcp");if(W.ok){const ae=await W.json();he(ae.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(W){console.error("Error fetching Cursor MCP servers:",W)}},nr=async()=>{try{const W=await je("/api/codex/mcp/config/read");if(W.ok){const Ee=await W.json();if(Ee.success&&Ee.servers){ee(Ee.servers);return}}const ae=await je("/api/codex/mcp/cli/list");if(ae.ok){const Ee=await ae.json();if(Ee.success&&Ee.servers){const it=Ee.servers.map(tr=>({id:tr.name,name:tr.name,type:tr.type||"stdio",scope:"user",config:{command:tr.command||"",args:tr.args||[],env:tr.env||{}}}));ee(it)}}}catch(W){console.error("Error fetching Codex MCP servers:",W)}},Nr=async()=>{try{const W=await je("/api/mcp/config/read");if(W.ok){const it=await W.json();if(it.success&&it.servers){R(it.servers);return}}const ae=await je("/api/mcp/cli/list");if(ae.ok){const it=await ae.json();if(it.success&&it.servers){const tr=it.servers.map(rr=>({id:rr.name,name:rr.name,type:rr.type,scope:"user",config:{command:rr.command||"",args:rr.args||[],env:rr.env||{},url:rr.url||"",headers:rr.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));R(tr);return}}const Ee=await je("/api/mcp/servers?scope=user");if(Ee.ok){const it=await Ee.json();R(it.servers||[])}else console.error("Failed to fetch MCP servers")}catch(W){console.error("Error fetching MCP servers:",W)}},ga=async W=>{try{A&&await pn(A.id,"user");const ae=await je("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:W.name,type:W.type,scope:W.scope,projectPath:W.projectPath,command:W.config?.command,args:W.config?.args||[],url:W.config?.url,headers:W.config?.headers||{},env:W.config?.env||{}})});if(ae.ok){const Ee=await ae.json();if(Ee.success)return await Nr(),!0;throw new Error(Ee.error||"Failed to save server via Claude CLI")}else{const Ee=await ae.json();throw new Error(Ee.error||"Failed to save server")}}catch(ae){throw console.error("Error saving MCP server:",ae),ae}},pn=async(W,ae="user")=>{try{const Ee=await je(`/api/mcp/cli/remove/${W}?scope=${ae}`,{method:"DELETE"});if(Ee.ok){const it=await Ee.json();if(it.success)return await Nr(),!0;throw new Error(it.error||"Failed to delete server via Claude CLI")}else{const it=await Ee.json();throw new Error(it.error||"Failed to delete server")}}catch(Ee){throw console.error("Error deleting MCP server:",Ee),Ee}},Ua=async(W,ae="user")=>{try{const Ee=await je(`/api/mcp/servers/${W}/test?scope=${ae}`,{method:"POST"});if(Ee.ok)return(await Ee.json()).testResult;{const it=await Ee.json();throw new Error(it.error||"Failed to test server")}}catch(Ee){throw console.error("Error testing MCP server:",Ee),Ee}},Hr=async(W,ae="user")=>{try{const Ee=await je(`/api/mcp/servers/${W}/tools?scope=${ae}`,{method:"POST"});if(Ee.ok)return(await Ee.json()).toolsResult;{const it=await Ee.json();throw new Error(it.error||"Failed to discover tools")}}catch(Ee){throw console.error("Error discovering MCP tools:",Ee),Ee}},Ls=async W=>{try{At&&await zr(At.id);const ae=await je("/api/codex/mcp/cli/add",{method:"POST",body:JSON.stringify({name:W.name,command:W.config?.command,args:W.config?.args||[],env:W.config?.env||{}})});if(ae.ok){const Ee=await ae.json();if(Ee.success)return await nr(),!0;throw new Error(Ee.error||"Failed to save Codex MCP server")}else{const Ee=await ae.json();throw new Error(Ee.error||"Failed to save server")}}catch(ae){throw console.error("Error saving Codex MCP server:",ae),ae}},zr=async W=>{try{const ae=await je(`/api/codex/mcp/cli/remove/${W}`,{method:"DELETE"});if(ae.ok){const Ee=await ae.json();if(Ee.success)return await nr(),!0;throw new Error(Ee.error||"Failed to delete Codex MCP server")}else{const Ee=await ae.json();throw new Error(Ee.error||"Failed to delete server")}}catch(ae){throw console.error("Error deleting Codex MCP server:",ae),ae}},Zr=()=>{Ct({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),Zt(null),Ce(!1)},Ps=(W=null)=>{W?(Zt(W),Ct({name:W.name,type:W.type||"stdio",config:{command:W.config?.command||"",args:W.config?.args||[],env:W.config?.env||{}}})):Zr(),Ce(!0)},Ji=async W=>{W.preventDefault(),Qr(!0);try{At&&await zr(At.name),await Ls(Ze),Zr(),N("success")}catch(ae){alert(`Error: ${ae.message}`),N("error")}finally{Qr(!1)}},fn=async W=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await zr(W),N("success")}catch(ae){alert(`Error: ${ae.message}`),N("error")}};b.useEffect(()=>{e&&(wt(),Jn(),gn(),Va(),M(a))},[e,a]),b.useEffect(()=>{localStorage.setItem("codeEditorTheme",ve),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ve]),b.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",Le.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Le]),b.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",Ye.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[Ye]),b.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",mt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[mt]),b.useEffect(()=>{localStorage.setItem("codeEditorFontSize",ft),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ft]);const wt=async()=>{try{const W=localStorage.getItem("claude-settings");if(W){const it=JSON.parse(W);l(it.allowedTools||[]),d(it.disallowedTools||[]),y(it.skipPermissions||!1),F(it.projectSortOrder||"name")}else l([]),d([]),y(!1),F("name");const ae=localStorage.getItem("cursor-tools-settings");if(ae){const it=JSON.parse(ae);kt(it.allowedCommands||[]),Ve(it.disallowedCommands||[]),Ae(it.skipPermissions||!1)}else kt([]),Ve([]),Ae(!1);const Ee=localStorage.getItem("codex-settings");if(Ee){const it=JSON.parse(Ee);Ne(it.permissionMode||"default")}else Ne("default");await Nr(),await Wt(),await nr()}catch(W){console.error("Error loading tool settings:",W),l([]),d([]),y(!1),F("name")}},Jn=async()=>{try{const W=await je("/api/cli/claude/status");if(W.ok){const ae=await W.json();Gt({authenticated:ae.authenticated,email:ae.email,loading:!1,error:ae.error||null})}else Gt({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(W){console.error("Error checking Claude auth status:",W),Gt({authenticated:!1,email:null,loading:!1,error:W.message})}},gn=async()=>{try{const W=await je("/api/cli/cursor/status");if(W.ok){const ae=await W.json();le({authenticated:ae.authenticated,email:ae.email,loading:!1,error:ae.error||null})}else le({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(W){console.error("Error checking Cursor auth status:",W),le({authenticated:!1,email:null,loading:!1,error:W.message})}},Va=async()=>{try{const W=await je("/api/cli/codex/status");if(W.ok){const ae=await W.json();St({authenticated:ae.authenticated,email:ae.email,loading:!1,error:ae.error||null})}else St({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(W){console.error("Error checking Codex auth status:",W),St({authenticated:!1,email:null,loading:!1,error:W.message})}},Yn=()=>{sr("claude"),qr(r?.[0]||{name:"default",fullPath:process.cwd()}),er(!0)},Yi=()=>{sr("cursor"),qr(r?.[0]||{name:"default",fullPath:process.cwd()}),er(!0)},xa=()=>{sr("codex"),qr(r?.[0]||{name:"default",fullPath:process.cwd()}),er(!0)},Xi=W=>{W===0&&(N("success"),fr==="claude"?Jn():fr==="cursor"?gn():fr==="codex"&&Va())},Ga=()=>{w(!0),N(null);try{const W={allowedTools:o,disallowedTools:c,skipPermissions:g,projectSortOrder:I,lastUpdated:new Date().toISOString()},ae={allowedCommands:bt,disallowedCommands:Vt,skipPermissions:we,lastUpdated:new Date().toISOString()},Ee={permissionMode:ge,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(W)),localStorage.setItem("cursor-tools-settings",JSON.stringify(ae)),localStorage.setItem("codex-settings",JSON.stringify(Ee)),N("success"),setTimeout(()=>{t()},1e3)}catch(W){console.error("Error saving tool settings:",W),N("error")}finally{w(!1)}},Xn=()=>{U({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),V(null),$(!1),Me("")},Rs=(W=null)=>{W?(V(W),U({name:W.name,type:W.type,scope:W.scope,projectPath:W.projectPath||"",config:{...W.config},raw:W.raw,importMode:"form",jsonInput:""})):Xn(),$(!0)},Qi=async W=>{W.preventDefault(),_(!0);try{if(T.importMode==="json"){const ae=await je("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:T.name,jsonConfig:T.jsonInput,scope:T.scope,projectPath:T.projectPath})});if(ae.ok){const Ee=await ae.json();if(Ee.success)await Nr(),Xn(),N("success");else throw new Error(Ee.error||"Failed to add server via JSON")}else{const Ee=await ae.json();throw new Error(Ee.error||"Failed to add server")}}else await ga(T),Xn(),N("success")}catch(ae){alert(`Error: ${ae.message}`),N("error")}finally{_(!1)}},Ka=async(W,ae)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await pn(W,ae),N("success")}catch(Ee){alert(`Error: ${Ee.message}`),N("error")}},Zi=async(W,ae)=>{try{de({...se,[W]:{loading:!0}});const Ee=await Ua(W,ae);de({...se,[W]:Ee})}catch(Ee){de({...se,[W]:{success:!1,message:Ee.message,details:[]}})}},Fs=async(W,ae)=>{try{ne({...j,[W]:!0});const Ee=await Hr(W,ae);X({...J,[W]:Ee})}catch{X({...J,[W]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{ne({...j,[W]:!1})}},Qn=(W,ae)=>{U(Ee=>({...Ee,config:{...Ee.config,[W]:ae}}))};return e?n.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[n.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(la,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),n.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"Settings"})]}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:t,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:n.jsx(Mt,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n.jsx("div",{className:"border-b border-border",children:n.jsxs("div",{className:"flex px-4 md:px-6",children:[n.jsx("button",{onClick:()=>M("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ue==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Agents"}),n.jsx("button",{onClick:()=>M("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ue==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Appearance"}),n.jsxs("button",{onClick:()=>M("git"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ue==="git"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[n.jsx(kn,{className:"w-4 h-4 inline mr-2"}),"Git"]}),n.jsxs("button",{onClick:()=>M("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ue==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[n.jsx(Kl,{className:"w-4 h-4 inline mr-2"}),"API & Tokens"]}),n.jsx("button",{onClick:()=>M("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${ue==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Tasks"})]})}),n.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[ue==="appearance"&&n.jsx("div",{className:"space-y-6 md:space-y-8",children:ue==="appearance"&&n.jsxs("div",{className:"space-y-6 md:space-y-8",children:[n.jsx("div",{className:"space-y-4",children:n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Dark Mode"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Toggle between light and dark themes"})]}),n.jsxs("button",{onClick:i,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":s,"aria-label":"Toggle dark mode",children:[n.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),n.jsx("span",{className:`${s?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:s?n.jsx(tl,{className:"w-3.5 h-3.5 text-gray-700"}):n.jsx(rl,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),n.jsx("div",{className:"space-y-4",children:n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Project Sorting"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"How projects are ordered in the sidebar"})]}),n.jsxs("select",{value:I,onChange:W=>F(W.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[n.jsx("option",{value:"name",children:"Alphabetical"}),n.jsx("option",{value:"date",children:"Recent Activity"})]})]})})}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Code Editor"}),n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Editor Theme"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Default theme for the code editor"})]}),n.jsxs("button",{onClick:()=>He(ve==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":ve==="dark","aria-label":"Toggle editor theme",children:[n.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),n.jsx("span",{className:`${ve==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:ve==="dark"?n.jsx(tl,{className:"w-3.5 h-3.5 text-gray-700"}):n.jsx(rl,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Word Wrap"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Enable word wrapping by default in the editor"})]}),n.jsxs("button",{onClick:()=>rt(!Le),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Le,"aria-label":"Toggle word wrap",children:[n.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),n.jsx("span",{className:`${Le?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Show Minimap"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Display a minimap for easier navigation in diff view"})]}),n.jsxs("button",{onClick:()=>yt(!Ye),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":Ye,"aria-label":"Toggle minimap",children:[n.jsx("span",{className:"sr-only",children:"Toggle minimap"}),n.jsx("span",{className:`${Ye?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Show Line Numbers"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Display line numbers in the editor"})]}),n.jsxs("button",{onClick:()=>vt(!mt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":mt,"aria-label":"Toggle line numbers",children:[n.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),n.jsx("span",{className:`${mt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),n.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-foreground",children:"Font Size"}),n.jsx("div",{className:"text-sm text-muted-foreground",children:"Editor font size in pixels"})]}),n.jsxs("select",{value:ft,onChange:W=>Ue(W.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[n.jsx("option",{value:"10",children:"10px"}),n.jsx("option",{value:"11",children:"11px"}),n.jsx("option",{value:"12",children:"12px"}),n.jsx("option",{value:"13",children:"13px"}),n.jsx("option",{value:"14",children:"14px"}),n.jsx("option",{value:"15",children:"15px"}),n.jsx("option",{value:"16",children:"16px"}),n.jsx("option",{value:"18",children:"18px"}),n.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),ue==="git"&&n.jsx(Z8,{}),ue==="agents"&&n.jsxs("div",{className:"flex flex-col md:flex-row h-full min-h-[400px] md:min-h-[500px]",children:[n.jsx("div",{className:"md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:n.jsxs("div",{className:"flex",children:[n.jsx(ja,{agentId:"claude",authStatus:lr,isSelected:Se==="claude",onClick:()=>me("claude"),isMobile:!0}),n.jsx(ja,{agentId:"cursor",authStatus:Q,isSelected:Se==="cursor",onClick:()=>me("cursor"),isMobile:!0}),n.jsx(ja,{agentId:"codex",authStatus:Je,isSelected:Se==="codex",onClick:()=>me("codex"),isMobile:!0})]})}),n.jsx("div",{className:"hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0",children:n.jsxs("div",{className:"p-2",children:[n.jsx(ja,{agentId:"claude",authStatus:lr,isSelected:Se==="claude",onClick:()=>me("claude")}),n.jsx(ja,{agentId:"cursor",authStatus:Q,isSelected:Se==="cursor",onClick:()=>me("cursor")}),n.jsx(ja,{agentId:"codex",authStatus:Je,isSelected:Se==="codex",onClick:()=>me("codex")})]})}),n.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[n.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:n.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[n.jsx("button",{onClick:()=>ce("account"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${_e==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Account"}),n.jsx("button",{onClick:()=>ce("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${_e==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Permissions"}),n.jsx("button",{onClick:()=>ce("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${_e==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"MCP Servers"})]})}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[_e==="account"&&n.jsx(a9,{agent:Se,authStatus:Se==="claude"?lr:Se==="cursor"?Q:Je,onLogin:Se==="claude"?Yn:Se==="cursor"?Yi:xa}),_e==="permissions"&&Se==="claude"&&n.jsx(Xo,{agent:"claude",skipPermissions:g,setSkipPermissions:y,allowedTools:o,setAllowedTools:l,disallowedTools:c,setDisallowedTools:d,newAllowedTool:u,setNewAllowedTool:m,newDisallowedTool:h,setNewDisallowedTool:p}),_e==="permissions"&&Se==="cursor"&&n.jsx(Xo,{agent:"cursor",skipPermissions:we,setSkipPermissions:Ae,allowedCommands:bt,setAllowedCommands:kt,disallowedCommands:Vt,setDisallowedCommands:Ve,newAllowedCommand:q,setNewAllowedCommand:G,newDisallowedCommand:be,setNewDisallowedCommand:Pe}),_e==="permissions"&&Se==="codex"&&n.jsx(Xo,{agent:"codex",permissionMode:ge,setPermissionMode:Ne}),_e==="mcp"&&Se==="claude"&&n.jsx(Qo,{agent:"claude",servers:E,onAdd:()=>Rs(),onEdit:W=>Rs(W),onDelete:(W,ae)=>Ka(W,ae),onTest:(W,ae)=>Zi(W,ae),onDiscoverTools:(W,ae)=>Fs(W,ae),testResults:se,serverTools:J,toolsLoading:j}),_e==="mcp"&&Se==="cursor"&&n.jsx(Qo,{agent:"cursor",servers:st,onAdd:()=>{},onEdit:W=>{},onDelete:W=>{}}),_e==="mcp"&&Se==="codex"&&n.jsx(Qo,{agent:"codex",servers:B,onAdd:()=>Ps(),onEdit:W=>Ps(W),onDelete:W=>fn(W)})]})]})]}),H&&n.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:n.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[n.jsx("h3",{className:"text-lg font-medium text-foreground",children:A?"Edit MCP Server":"Add MCP Server"}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:Xn,children:n.jsx(Mt,{className:"w-4 h-4"})})]}),n.jsxs("form",{onSubmit:Qi,className:"p-4 space-y-4",children:[!A&&n.jsxs("div",{className:"flex gap-2 mb-4",children:[n.jsx("button",{type:"button",onClick:()=>U(W=>({...W,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${T.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"Form Input"}),n.jsx("button",{type:"button",onClick:()=>U(W=>({...W,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${T.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"JSON Import"})]}),T.importMode==="form"&&A&&n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope"}),n.jsxs("div",{className:"flex items-center gap-2",children:[T.scope==="user"?n.jsx(el,{className:"w-4 h-4"}):n.jsx(ia,{className:"w-4 h-4"}),n.jsx("span",{className:"text-sm",children:T.scope==="user"?"User (Global)":"Project (Local)"}),T.scope==="local"&&T.projectPath&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",T.projectPath]})]}),n.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Scope cannot be changed when editing an existing server"})]}),T.importMode==="form"&&!A&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Scope *"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{type:"button",onClick:()=>U(W=>({...W,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${T.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:n.jsxs("div",{className:"flex items-center justify-center gap-2",children:[n.jsx(el,{className:"w-4 h-4"}),n.jsx("span",{children:"User (Global)"})]})}),n.jsx("button",{type:"button",onClick:()=>U(W=>({...W,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${T.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:n.jsxs("div",{className:"flex items-center justify-center gap-2",children:[n.jsx(ia,{className:"w-4 h-4"}),n.jsx("span",{children:"Project (Local)"})]})})]}),n.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:T.scope==="user"?"User scope: Available across all projects on your machine":"Local scope: Only available in the selected project"})]}),T.scope==="local"&&!A&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Project *"}),n.jsxs("select",{value:T.projectPath,onChange:W=>U(ae=>({...ae,projectPath:W.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:T.scope==="local",children:[n.jsx("option",{value:"",children:"Select a project..."}),r.map(W=>n.jsx("option",{value:W.path||W.fullPath,children:W.displayName||W.name},W.name))]}),T.projectPath&&n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Path: ",T.projectPath]})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{className:T.importMode==="json"?"md:col-span-2":"",children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Server Name *"}),n.jsx(Ht,{value:T.name,onChange:W=>{U(ae=>({...ae,name:W.target.value}))},placeholder:"my-server",required:!0})]}),T.importMode==="form"&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Transport Type *"}),n.jsxs("select",{value:T.type,onChange:W=>{U(ae=>({...ae,type:W.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[n.jsx("option",{value:"stdio",children:"stdio"}),n.jsx("option",{value:"sse",children:"SSE"}),n.jsx("option",{value:"http",children:"HTTP"})]})]})]}),A&&T.raw&&T.importMode==="form"&&n.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[n.jsxs("h4",{className:"text-sm font-medium text-foreground mb-2",children:["Configuration Details (from ",A.scope==="global"?"~/.claude.json":"project config",")"]}),n.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(T.raw,null,2)})]}),T.importMode==="json"&&n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"JSON Configuration *"}),n.jsx("textarea",{value:T.jsonInput,onChange:W=>{U(ae=>({...ae,jsonInput:W.target.value}));try{if(W.target.value.trim()){const ae=JSON.parse(W.target.value);ae.type?ae.type==="stdio"&&!ae.command?Me("stdio type requires a command field"):(ae.type==="http"||ae.type==="sse")&&!ae.url?Me(`${ae.type} type requires a url field`):Me(""):Me("Missing required field: type")}}catch{W.target.value.trim()?Me("Invalid JSON format"):Me("")}},className:`w-full px-3 py-2 border ${ie?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
1174
+ "type": "stdio",
1175
+ "command": "/path/to/server",
1176
+ "args": ["--api-key", "abc123"],
1177
+ "env": {
1178
+ "CACHE_DIR": "/tmp"
1179
+ }
1180
+ }`,required:!0}),ie&&n.jsx("p",{className:"text-xs text-red-500 mt-1",children:ie}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Paste your MCP server configuration in JSON format. Example formats:",n.jsx("br",{}),"• stdio: ",'{"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',n.jsx("br",{}),"• http/sse: ",'{"type":"http","url":"https://api.example.com/mcp"}']})]})}),T.importMode==="form"&&T.type==="stdio"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Command *"}),n.jsx(Ht,{value:T.config.command,onChange:W=>Qn("command",W.target.value),placeholder:"/path/to/mcp-server",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Arguments (one per line)"}),n.jsx("textarea",{value:Array.isArray(T.config.args)?T.config.args.join(`
1181
+ `):"",onChange:W=>Qn("args",W.target.value.split(`
1182
+ `).filter(ae=>ae.trim())),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`--api-key
1183
+ abc123`})]})]}),T.importMode==="form"&&(T.type==="sse"||T.type==="http")&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"URL *"}),n.jsx(Ht,{value:T.config.url,onChange:W=>Qn("url",W.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),T.importMode==="form"&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Environment Variables (KEY=value, one per line)"}),n.jsx("textarea",{value:Object.entries(T.config.env||{}).map(([W,ae])=>`${W}=${ae}`).join(`
1184
+ `),onChange:W=>{const ae={};W.target.value.split(`
1185
+ `).forEach(Ee=>{const[it,...tr]=Ee.split("=");it&&it.trim()&&(ae[it.trim()]=tr.join("=").trim())}),Qn("env",ae)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`API_KEY=your-key
1186
+ DEBUG=true`})]}),T.importMode==="form"&&(T.type==="sse"||T.type==="http")&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Headers (KEY=value, one per line)"}),n.jsx("textarea",{value:Object.entries(T.config.headers||{}).map(([W,ae])=>`${W}=${ae}`).join(`
1187
+ `),onChange:W=>{const ae={};W.target.value.split(`
1188
+ `).forEach(Ee=>{const[it,...tr]=Ee.split("=");it&&it.trim()&&(ae[it.trim()]=tr.join("=").trim())}),Qn("headers",ae)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
1189
+ X-API-Key=your-key`})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[n.jsx(qe,{type:"button",variant:"outline",onClick:Xn,children:"Cancel"}),n.jsx(qe,{type:"submit",disabled:P,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:P?"Saving...":A?"Update Server":"Add Server"})]})]})]})}),Z&&n.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:n.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[n.jsx("h3",{className:"text-lg font-medium text-foreground",children:At?"Edit MCP Server":"Add MCP Server"}),n.jsx(qe,{variant:"ghost",size:"sm",onClick:Zr,children:n.jsx(Mt,{className:"w-4 h-4"})})]}),n.jsxs("form",{onSubmit:Ji,className:"p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Server Name *"}),n.jsx(Ht,{value:Ze.name,onChange:W=>Ct(ae=>({...ae,name:W.target.value})),placeholder:"my-mcp-server",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Command *"}),n.jsx(Ht,{value:Ze.config?.command||"",onChange:W=>Ct(ae=>({...ae,config:{...ae.config,command:W.target.value}})),placeholder:"npx @my-org/mcp-server",required:!0})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Arguments (one per line)"}),n.jsx("textarea",{value:(Ze.config?.args||[]).join(`
1190
+ `),onChange:W=>Ct(ae=>({...ae,config:{...ae.config,args:W.target.value.split(`
1191
+ `).filter(Ee=>Ee.trim())}})),placeholder:`--port
1192
+ 3000`,rows:3,className:"w-full px-3 py-2 text-sm bg-background border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Environment Variables (KEY=VALUE, one per line)"}),n.jsx("textarea",{value:Object.entries(Ze.config?.env||{}).map(([W,ae])=>`${W}=${ae}`).join(`
1193
+ `),onChange:W=>{const ae={};W.target.value.split(`
1194
+ `).forEach(Ee=>{const[it,...tr]=Ee.split("=");it&&tr.length>0&&(ae[it.trim()]=tr.join("=").trim())}),Ct(Ee=>({...Ee,config:{...Ee.config,env:ae}}))},placeholder:`API_KEY=xxx
1195
+ DEBUG=true`,rows:3,className:"w-full px-3 py-2 text-sm bg-background border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[n.jsx(qe,{type:"button",variant:"outline",onClick:Zr,children:"Cancel"}),n.jsx(qe,{type:"submit",disabled:Xr||!Ze.name||!Ze.config?.command,className:"bg-green-600 hover:bg-green-700 text-white",children:Xr?"Saving...":At?"Update Server":"Add Server"})]})]})]})}),ue==="tasks"&&n.jsx("div",{className:"space-y-6 md:space-y-8",children:n.jsx(e9,{})}),ue==="api"&&n.jsx("div",{className:"space-y-6 md:space-y-8",children:n.jsx(Q8,{})})]})]}),n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[n.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[S==="success"&&n.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Settings saved successfully!"]}),S==="error"&&n.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:n.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"Failed to save settings"]})]}),n.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[n.jsx(qe,{variant:"outline",onClick:t,disabled:v,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"Cancel"}),n.jsx(qe,{onClick:Ga,disabled:v,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:v?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"Saving..."]}):"Save Settings"})]})]})]}),n.jsx(xf,{isOpen:Dn,onClose:()=>er(!1),provider:fr,project:Pt,onComplete:Xi},fr)]}):null}function f9(){const{isDarkMode:e,toggleDarkMode:t}=js();return n.jsxs("button",{onClick:t,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":e,"aria-label":"Toggle dark mode",children:[n.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),n.jsx("span",{className:`${e?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:e?n.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):n.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const g9=({isOpen:e,onToggle:t,autoExpandTools:r,onAutoExpandChange:a,showRawParameters:s,onShowRawParametersChange:i,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:c,onAutoScrollChange:d,sendByCtrlEnter:u,onSendByCtrlEnterChange:m,isMobile:h})=>{const[p,g]=b.useState(e),[y,v]=b.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:w}=js();b.useEffect(()=>{g(e)},[e]);const S=()=>{const N=!p;g(N),t(N)};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:`fixed ${h?"bottom-44":"top-1/2 -translate-y-1/2"} ${p?"right-64":"right-0"} z-50 transition-all duration-150 ease-out`,children:n.jsx("button",{onClick:S,className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg","aria-label":p?"Close settings panel":"Open settings panel",children:p?n.jsx(cn,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):n.jsx(Gl,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}),n.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-background border-l border-border shadow-xl transform transition-transform duration-150 ease-out z-40 ${p?"translate-x-0":"translate-x-full"} ${h?"h-screen":""}`,children:n.jsxs("div",{className:"h-full flex flex-col",children:[n.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:n.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[n.jsx(zx,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),"Quick Settings"]})}),n.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-background ${h?"pb-mobile-nav":""}`,children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Appearance"}),n.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[w?n.jsx(tl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):n.jsx(rl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Dark Mode"]}),n.jsx(f9,{})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Tool Display"}),n.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[n.jsx(Jl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-expand tools"]}),n.jsx("input",{type:"checkbox",checked:r,onChange:N=>a(N.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),n.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[n.jsx(ws,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show raw parameters"]}),n.jsx("input",{type:"checkbox",checked:s,onChange:N=>i(N.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),n.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[n.jsx(Vu,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show thinking"]}),n.jsx("input",{type:"checkbox",checked:o,onChange:N=>l(N.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"View Options"}),n.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[n.jsx(Uu,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-scroll to bottom"]}),n.jsx("input",{type:"checkbox",checked:c,onChange:N=>d(N.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Input Settings"}),n.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[n.jsx(ox,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Send by Ctrl+Enter"]}),n.jsx("input",{type:"checkbox",checked:u,onChange:N=>m(N.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends."})]}),n.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[n.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Whisper Dictation"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:y==="default",onChange:()=>{v("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),n.jsxs("div",{className:"ml-3 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[n.jsx(ci,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Default Mode"]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Direct transcription of your speech"})]})]}),n.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:y==="prompt",onChange:()=>{v("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),n.jsxs("div",{className:"ml-3 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[n.jsx(_n,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Prompt Enhancement"]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Transform rough ideas into clear, detailed AI prompts"})]})]}),n.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[n.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:y==="vibe"||y==="instructions"||y==="architect",onChange:()=>{v("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),n.jsxs("div",{className:"ml-3 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[n.jsx(yr,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Vibe Mode"]}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Format ideas as clear agent instructions with details"})]})]})]})]})]})]})}),p&&n.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:S})]})},x9=()=>{const[e,t]=b.useState(""),[r,a]=b.useState(""),[s,i]=b.useState(""),[o,l]=b.useState(!1),[c,d]=b.useState(""),{register:u}=Ns(),m=async h=>{if(h.preventDefault(),d(""),r!==s){d("Passwords do not match");return}if(e.length<3){d("Username must be at least 3 characters long");return}if(r.length<6){d("Password must be at least 6 characters long");return}l(!0);const p=await u(e,r);p.success||d(p.error),l(!1)};return n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:n.jsx("div",{className:"w-full max-w-md",children:n.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"flex justify-center mb-4",children:n.jsx(Fr,{size:64})}),n.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),n.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),n.jsxs("form",{onSubmit:m,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),n.jsx("input",{type:"text",id:"username",value:e,onChange:h=>t(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),n.jsx("input",{type:"password",id:"password",value:r,onChange:h=>a(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),n.jsx("input",{type:"password",id:"confirmPassword",value:s,onChange:h=>i(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),c&&n.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:n.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),n.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),n.jsx("div",{className:"text-center",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},b9=()=>{const[e,t]=b.useState(""),[r,a]=b.useState(""),[s,i]=b.useState(!1),[o,l]=b.useState(""),{login:c}=Ns(),d=async u=>{if(u.preventDefault(),l(""),!e||!r){l("Please enter both username and password");return}i(!0);const m=await c(e,r);m.success||l(m.error),i(!1)};return n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:n.jsx("div",{className:"w-full max-w-md",children:n.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"flex justify-center mb-4",children:n.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:n.jsx(us,{className:"w-8 h-8 text-primary-foreground"})})}),n.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome Back"}),n.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign in to your Claude Code UI account"})]}),n.jsxs("form",{onSubmit:d,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),n.jsx("input",{type:"text",id:"username",value:e,onChange:u=>t(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:s})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),n.jsx("input",{type:"password",id:"password",value:r,onChange:u=>a(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:s})]}),o&&n.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:n.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),n.jsx("button",{type:"submit",disabled:s,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:s?"Signing in...":"Sign In"})]}),n.jsx("div",{className:"text-center",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},y9=({onComplete:e})=>{const[t,r]=b.useState(0),[a,s]=b.useState(""),[i,o]=b.useState(""),[l,c]=b.useState(!1),[d,u]=b.useState(""),[m,h]=b.useState(null),[p]=b.useState({name:"default",fullPath:""}),[g,y]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[v,w]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),[S,N]=b.useState({authenticated:!1,email:null,loading:!0,error:null}),{user:I}=Ns(),F=b.useRef(void 0);b.useEffect(()=>{E()},[]);const E=async()=>{try{const j=await je("/api/user/git-config");if(j.ok){const ne=await j.json();ne.gitName&&s(ne.gitName),ne.gitEmail&&o(ne.gitEmail)}}catch(j){console.error("Error loading git config:",j)}};b.useEffect(()=>{const j=F.current;F.current=m,(j===void 0||j!==null&&m===null)&&(R(),H(),$())},[m]);const R=async()=>{try{const j=await je("/api/cli/claude/status");if(j.ok){const ne=await j.json();y({authenticated:ne.authenticated,email:ne.email,loading:!1,error:ne.error||null})}else y({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(j){console.error("Error checking Claude auth status:",j),y({authenticated:!1,email:null,loading:!1,error:j.message})}},H=async()=>{try{const j=await je("/api/cli/cursor/status");if(j.ok){const ne=await j.json();w({authenticated:ne.authenticated,email:ne.email,loading:!1,error:ne.error||null})}else w({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(j){console.error("Error checking Cursor auth status:",j),w({authenticated:!1,email:null,loading:!1,error:j.message})}},$=async()=>{try{const j=await je("/api/cli/codex/status");if(j.ok){const ne=await j.json();N({authenticated:ne.authenticated,email:ne.email,loading:!1,error:ne.error||null})}else N({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(j){console.error("Error checking Codex auth status:",j),N({authenticated:!1,email:null,loading:!1,error:j.message})}},A=()=>h("claude"),V=()=>h("cursor"),T=()=>h("codex"),U=j=>{j===0&&(m==="claude"?R():m==="cursor"?H():m==="codex"&&$())},P=async()=>{if(u(""),t===0){if(!a.trim()||!i.trim()){u("Both git name and email are required");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)){u("Please enter a valid email address");return}c(!0);try{const ne=await je("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:a,gitEmail:i})});if(!ne.ok){const ue=await ne.json();throw new Error(ue.error||"Failed to save git configuration")}r(t+1)}catch(ne){u(ne.message)}finally{c(!1)}return}r(t+1)},_=()=>{u(""),r(t-1)},se=async()=>{c(!0),u("");try{const j=await je("/api/user/complete-onboarding",{method:"POST"});if(!j.ok){const ne=await j.json();throw new Error(ne.error||"Failed to complete onboarding")}e&&e()}catch(j){u(j.message)}finally{c(!1)}},de=[{title:"Git Configuration",description:"Set up your git identity for commits",icon:kn,required:!0},{title:"Connect Agents",description:"Connect your AI coding assistants",icon:Ju,required:!1}],J=()=>{switch(t){case 0:return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"w-16 h-16 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mx-auto mb-4",children:n.jsx(kn,{className:"w-8 h-8 text-blue-600 dark:text-blue-400"})}),n.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Git Configuration"}),n.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for your commits"})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsxs("label",{htmlFor:"gitName",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[n.jsx(Xx,{className:"w-4 h-4"}),"Git Name ",n.jsx("span",{className:"text-red-500",children:"*"})]}),n.jsx("input",{type:"text",id:"gitName",value:a,onChange:j=>s(j.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"John Doe",required:!0,disabled:l}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.name"})]}),n.jsxs("div",{children:[n.jsxs("label",{htmlFor:"gitEmail",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[n.jsx(mx,{className:"w-4 h-4"}),"Git Email ",n.jsx("span",{className:"text-red-500",children:"*"})]}),n.jsx("input",{type:"email",id:"gitEmail",value:i,onChange:j=>o(j.target.value),className:"w-full px-4 py-3 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"john@example.com",required:!0,disabled:l}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This will be used as: git config --global user.email"})]})]})]});case 1:return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Connect Your AI Agents"}),n.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:`border rounded-lg p-4 transition-colors ${g.authenticated?"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800":"border-border bg-card"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center",children:n.jsx(Fr,{size:20})}),n.jsxs("div",{children:[n.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Claude Code",g.authenticated&&n.jsx(dr,{className:"w-4 h-4 text-green-500"})]}),n.jsx("div",{className:"text-xs text-muted-foreground",children:g.loading?"Checking...":g.authenticated?g.email||"Connected":"Not connected"})]})]}),!g.authenticated&&!g.loading&&n.jsx("button",{onClick:A,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),n.jsx("div",{className:`border rounded-lg p-4 transition-colors ${v.authenticated?"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800":"border-border bg-card"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/30 rounded-full flex items-center justify-center",children:n.jsx(Gr,{size:20})}),n.jsxs("div",{children:[n.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["Cursor",v.authenticated&&n.jsx(dr,{className:"w-4 h-4 text-green-500"})]}),n.jsx("div",{className:"text-xs text-muted-foreground",children:v.loading?"Checking...":v.authenticated?v.email||"Connected":"Not connected"})]})]}),!v.authenticated&&!v.loading&&n.jsx("button",{onClick:V,className:"bg-purple-600 hover:bg-purple-700 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})}),n.jsx("div",{className:`border rounded-lg p-4 transition-colors ${S.authenticated?"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600":"border-border bg-card"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:n.jsx(an,{className:"w-5 h-5"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:["OpenAI Codex",S.authenticated&&n.jsx(dr,{className:"w-4 h-4 text-green-500"})]}),n.jsx("div",{className:"text-xs text-muted-foreground",children:S.loading?"Checking...":S.authenticated?S.email||"Connected":"Not connected"})]})]}),!S.authenticated&&!S.loading&&n.jsx("button",{onClick:T,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white text-sm font-medium py-2 px-4 rounded-lg transition-colors",children:"Login"})]})})]}),n.jsx("div",{className:"text-center text-sm text-muted-foreground pt-2",children:n.jsx("p",{children:"You can configure these later in Settings."})})]});default:return null}},X=()=>{switch(t){case 0:return a.trim()&&i.trim()&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i);case 1:return!0;default:return!1}};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-2xl",children:[n.jsx("div",{className:"mb-8",children:n.jsx("div",{className:"flex items-center justify-between",children:de.map((j,ne)=>n.jsxs(Kr.Fragment,{children:[n.jsxs("div",{className:"flex flex-col items-center flex-1",children:[n.jsx("div",{className:`w-12 h-12 rounded-full flex items-center justify-center border-2 transition-colors duration-200 ${ne<t?"bg-green-500 border-green-500 text-white":ne===t?"bg-blue-600 border-blue-600 text-white":"bg-background border-border text-muted-foreground"}`,children:ne<t?n.jsx(dr,{className:"w-6 h-6"}):typeof j.icon=="function"?n.jsx(j.icon,{}):n.jsx(j.icon,{className:"w-6 h-6"})}),n.jsxs("div",{className:"mt-2 text-center",children:[n.jsx("p",{className:`text-sm font-medium ${ne===t?"text-foreground":"text-muted-foreground"}`,children:j.title}),j.required&&n.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),ne<de.length-1&&n.jsx("div",{className:`flex-1 h-0.5 mx-2 transition-colors duration-200 ${ne<t?"bg-green-500":"bg-border"}`})]},ne))})}),n.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8",children:[J(),d&&n.jsx("div",{className:"mt-6 p-4 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-lg",children:n.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),n.jsxs("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-border",children:[n.jsxs("button",{onClick:_,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200",children:[n.jsx(Gl,{className:"w-4 h-4"}),"Previous"]}),n.jsx("div",{className:"flex items-center gap-3",children:t<de.length-1?n.jsx("button",{onClick:P,disabled:!X()||l,className:"flex items-center gap-2 px-6 py-3 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:l?n.jsxs(n.Fragment,{children:[n.jsx(ds,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):n.jsxs(n.Fragment,{children:["Next",n.jsx(cn,{className:"w-4 h-4"})]})}):n.jsx("button",{onClick:se,disabled:l,className:"flex items-center gap-2 px-6 py-3 bg-green-600 hover:bg-green-700 disabled:bg-green-400 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors duration-200",children:l?n.jsxs(n.Fragment,{children:[n.jsx(ds,{className:"w-4 h-4 animate-spin"}),"Completing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(dr,{className:"w-4 h-4"}),"Complete Setup"]})})})]})]})]})}),m&&n.jsx(xf,{isOpen:!!m,onClose:()=>h(null),provider:m,project:p,onComplete:U})]})},v9=()=>n.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"flex justify-center mb-4",children:n.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:n.jsx(us,{className:"w-8 h-8 text-primary-foreground"})})}),n.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),n.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[n.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),n.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),n.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),n.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),k9=({children:e})=>{const{user:t,isLoading:r,needsSetup:a,hasCompletedOnboarding:s,refreshOnboardingStatus:i}=Ns();return r?n.jsx(v9,{}):a?n.jsx(x9,{}):t?s?e:n.jsx(y9,{onComplete:i}):n.jsx(b9,{})};function Na(e,t){const[r,a]=b.useState(()=>{if(typeof window>"u")return t;try{const i=window.localStorage.getItem(e);return i?JSON.parse(i):t}catch(i){return console.log(i),t}});return[r,i=>{if(!(typeof window>"u"))try{const o=i instanceof Function?i(r):i;window.localStorage.setItem(e,JSON.stringify(o)),a(o)}catch(o){console.log(o)}}]}function Ru(){const e=Xf(),{sessionId:t}=Qf(),{updateAvailable:r,latestVersion:a,currentVersion:s,releaseInfo:i}=gf("siteboon","claudecodeui"),[o,l]=b.useState(!1),[c,d]=b.useState([]),[u,m]=b.useState(null),[h,p]=b.useState(null),[g,y]=b.useState("chat"),[v,w]=b.useState(!1),[S,N]=b.useState(!1),[I,F]=b.useState(!0),[E,R]=b.useState(!1),[H,$]=b.useState(!1),[A,V]=b.useState("agents"),[T,U]=b.useState(!1),[P,_]=Na("autoExpandTools",!1),[se,de]=Na("showRawParameters",!1),[J,X]=Na("showThinking",!0),[j,ne]=Na("autoScrollToBottom",!0),[ue,M]=Na("sendByCtrlEnter",!1),[ie,Me]=Na("sidebarVisible",!0),[Se,me]=b.useState(new Set),[_e,ce]=b.useState(new Set),[ve,He]=b.useState(0),{ws:Le,sendMessage:rt,messages:Ye}=fm(),[yt,mt]=b.useState(!1);b.useEffect(()=>{const he=()=>{const B=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");mt(B),document.addEventListener("touchstart",{}),B?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return he(),window.matchMedia("(display-mode: standalone)").addEventListener("change",he),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",he)}},[]),b.useEffect(()=>{const he=()=>{w(window.innerWidth<768)};return he(),window.addEventListener("resize",he),()=>window.removeEventListener("resize",he)},[]),b.useEffect(()=>{ft()},[]);const vt=(he,B,ee,ge)=>{if(!ee||!ge)return!0;const Ne=he?.find(At=>At.name===ee.name),Z=B?.find(At=>At.name===ee.name);if(!Ne||!Z)return!1;const Ce=Ne.sessions?.find(At=>At.id===ge.id),Ze=Z.sessions?.find(At=>At.id===ge.id);return!Ce||!Ze?!1:Ce.id===Ze.id&&Ce.title===Ze.title&&Ce.created_at===Ze.created_at&&Ce.updated_at===Ze.updated_at};b.useEffect(()=>{if(Ye.length>0){const he=Ye[Ye.length-1];if(he.type==="projects_updated"){if(he.changedFile&&h&&u){const ge=he.changedFile.split("/");ge.length>=2&&ge[ge.length-1].replace(".jsonl","")===h.id&&(Se.has(h.id)||He(Ze=>Ze+1))}if(h&&Se.has(h.id)||Se.size>0&&Array.from(Se).some(ge=>ge.startsWith("new-session-"))){const ge=he.projects;if(!vt(c,ge,u,h))return}const ee=he.projects;if(d(ee),u){const ge=ee.find(Ne=>Ne.name===u.name);ge&&(JSON.stringify(ge)!==JSON.stringify(u)&&m(ge),h&&([...ge.sessions||[],...ge.codexSessions||[],...ge.cursorSessions||[]].find(Ce=>Ce.id===h.id)||p(null)))}}}},[Ye,u,h,Se]);const ft=async()=>{try{F(!0);const B=await(await lt.projects()).json();for(let ee of B)try{const ge=`/api/cursor/sessions?projectPath=${encodeURIComponent(ee.fullPath||ee.path)}`,Ne=await je(ge);if(Ne.ok){const Z=await Ne.json();Z.success&&Z.sessions?ee.cursorSessions=Z.sessions:ee.cursorSessions=[]}else ee.cursorSessions=[]}catch(ge){console.error(`Error fetching Cursor sessions for project ${ee.name}:`,ge),ee.cursorSessions=[]}d(ee=>ee.length===0||B.some((Ne,Z)=>{const Ce=ee[Z];return Ce?Ne.name!==Ce.name||Ne.displayName!==Ce.displayName||Ne.fullPath!==Ce.fullPath||JSON.stringify(Ne.sessionMeta)!==JSON.stringify(Ce.sessionMeta)||JSON.stringify(Ne.sessions)!==JSON.stringify(Ce.sessions)||JSON.stringify(Ne.cursorSessions)!==JSON.stringify(Ce.cursorSessions):!0})||B.length!==ee.length?B:ee)}catch(he){console.error("Error fetching projects:",he)}finally{F(!1)}};window.refreshProjects=ft,window.openSettings=b.useCallback((he="tools")=>{V(he),$(!0)},[]),b.useEffect(()=>{if(t&&c.length>0){const he=!h||h.id!==t;for(const B of c){let ee=B.sessions?.find(Ne=>Ne.id===t);if(ee){m(B),p({...ee,__provider:"claude"}),he&&y("chat");return}const ge=B.cursorSessions?.find(Ne=>Ne.id===t);if(ge){m(B),p({...ge,__provider:"cursor"}),he&&y("chat");return}}}},[t,c,e]);const Ue=he=>{m(he),p(null),e("/"),v&&N(!1)},bt=he=>{if(p(he),g!=="git"&&g!=="preview"&&y("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",he.id),v){const ee=he.__projectName,ge=u?.name;ee!==ge&&N(!1)}e(`/session/${he.id}`)},kt=he=>{m(he),p(null),y("chat"),e("/"),v&&N(!1)},Vt=he=>{h?.id===he&&(p(null),e("/")),d(B=>B.map(ee=>({...ee,sessions:ee.sessions?.filter(ge=>ge.id!==he)||[],sessionMeta:{...ee.sessionMeta,total:Math.max(0,(ee.sessionMeta?.total||0)-1)}})))},Ve=async()=>{try{const B=await(await lt.projects()).json();if(d(ee=>B.some((Ne,Z)=>{const Ce=ee[Z];return Ce?Ne.name!==Ce.name||Ne.displayName!==Ce.displayName||Ne.fullPath!==Ce.fullPath||JSON.stringify(Ne.sessionMeta)!==JSON.stringify(Ce.sessionMeta)||JSON.stringify(Ne.sessions)!==JSON.stringify(Ce.sessions):!0})||B.length!==ee.length?B:ee),u){const ee=B.find(ge=>ge.name===u.name);if(ee&&(JSON.stringify(ee)!==JSON.stringify(u)&&m(ee),h)){const ge=ee.sessions?.find(Ne=>Ne.id===h.id);ge&&JSON.stringify(ge)!==JSON.stringify(h)&&p(ge)}}}catch(he){console.error("Error refreshing sidebar:",he)}},we=he=>{u?.name===he&&(m(null),p(null),e("/")),d(B=>B.filter(ee=>ee.name!==he))},Ae=b.useCallback(he=>{he&&me(B=>new Set([...B,he]))},[]),q=b.useCallback(he=>{he&&me(B=>{const ee=new Set(B);return ee.delete(he),ee})},[]),G=b.useCallback(he=>{he&&ce(B=>new Set([...B,he]))},[]),be=b.useCallback(he=>{he&&ce(B=>{const ee=new Set(B);return ee.delete(he),ee})},[]),Pe=b.useCallback(he=>{he&&me(B=>{const ee=new Set;for(const ge of B)ge.startsWith("new-session-")||ee.add(ge);return ee.add(he),ee})},[]),st=()=>{const[he,B]=b.useState(!1),[ee,ge]=b.useState(""),[Ne,Z]=b.useState("");if(!o)return null;const Ce=Ct=>Ct?Ct.replace(/\b[0-9a-f]{40}\b/gi,"").replace(/(?:^|\s|-)([0-9a-f]{7,10})\b/gi,"").replace(/\*\*Full Changelog\*\*:.*$/gim,"").replace(/https?:\/\/github\.com\/[^\/]+\/[^\/]+\/compare\/[^\s)]+/gi,"").replace(/\n\s*\n\s*\n/g,`
1196
+
1197
+ `).trim():"",Ze=async()=>{B(!0),ge(`Starting update...
1198
+ `),Z("");try{const Ct=await je("/api/system/update",{method:"POST"}),At=await Ct.json();Ct.ok?(ge(Zt=>Zt+At.output+`
1199
+ `),ge(Zt=>Zt+`
1200
+ ✅ Update completed successfully!
1201
+ `),ge(Zt=>Zt+`Please restart the server to apply changes.
1202
+ `)):(Z(At.error||"Update failed"),ge(Zt=>Zt+`
1203
+ ❌ Update failed: `+(At.error||"Unknown error")+`
1204
+ `))}catch(Ct){Z(Ct.message),ge(At=>At+`
1205
+ ❌ Update failed: `+Ct.message+`
1206
+ `)}finally{B(!1)}};return n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[n.jsx("button",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>l(!1),"aria-label":"Close version upgrade modal"}),n.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 w-full max-w-2xl mx-4 p-6 space-y-4 max-h-[90vh] overflow-y-auto",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center",children:n.jsx("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 19l3 3m0 0l3-3m-3 3V10"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Update Available"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:i?.title||"A new version is ready"})]})]}),n.jsx("button",{onClick:()=>l(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg",children:[n.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Current Version"}),n.jsx("span",{className:"text-sm text-gray-900 dark:text-white font-mono",children:s})]}),n.jsxs("div",{className:"flex justify-between items-center p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-700",children:[n.jsx("span",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:"Latest Version"}),n.jsx("span",{className:"text-sm text-blue-900 dark:text-blue-100 font-mono",children:a})]})]}),i?.body&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"What's New:"}),i?.htmlUrl&&n.jsxs("a",{href:i.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:underline flex items-center gap-1",children:["View full release",n.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),n.jsx("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600 max-h-64 overflow-y-auto",children:n.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap prose prose-sm dark:prose-invert max-w-none",children:Ce(i.body)})})]}),ee&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Update Progress:"}),n.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-lg p-4 border border-gray-700 max-h-48 overflow-y-auto",children:n.jsx("pre",{className:"text-xs text-green-400 font-mono whitespace-pre-wrap",children:ee})})]}),!he&&!ee&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Manual upgrade:"}),n.jsx("div",{className:"bg-gray-100 dark:bg-gray-800 rounded-lg p-3 border",children:n.jsx("code",{className:"text-sm text-gray-800 dark:text-gray-200 font-mono",children:"git checkout main && git pull && npm install"})}),n.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:'Or click "Update Now" to run the update automatically.'})]}),n.jsxs("div",{className:"flex gap-2 pt-2",children:[n.jsx("button",{onClick:()=>l(!1),className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:ee?"Close":"Later"}),!ee&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>{navigator.clipboard.writeText("git checkout main && git pull && npm install")},className:"flex-1 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors",children:"Copy Command"}),n.jsx("button",{onClick:Ze,disabled:he,className:"flex-1 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 disabled:cursor-not-allowed rounded-md transition-colors flex items-center justify-center gap-2",children:he?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Updating..."]}):"Update Now"})]})]})]})]})};return n.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!v&&n.jsx("div",{className:`h-full flex-shrink-0 border-r border-border bg-card transition-all duration-300 ${ie?"w-80":"w-14"}`,children:n.jsx("div",{className:"h-full overflow-hidden",children:ie?n.jsx(mc,{projects:c,selectedProject:u,selectedSession:h,onProjectSelect:Ue,onSessionSelect:bt,onNewSession:kt,onSessionDelete:Vt,onProjectDelete:we,isLoading:I,onRefresh:Ve,onShowSettings:()=>$(!0),updateAvailable:r,latestVersion:a,currentVersion:s,releaseInfo:i,onShowVersionModal:()=>l(!0),isPWA:yt,isMobile:v,onToggleSidebar:()=>Me(!1)}):n.jsxs("div",{className:"h-full flex flex-col items-center py-4 gap-4",children:[n.jsx("button",{onClick:()=>Me(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200 group","aria-label":"Show sidebar",title:"Show sidebar",children:n.jsx("svg",{className:"w-5 h-5 text-foreground group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}),n.jsx("button",{onClick:()=>$(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Settings",title:"Settings",children:n.jsx(la,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})}),r&&n.jsxs("button",{onClick:()=>l(!0),className:"relative p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Update available",title:"Update available",children:[n.jsx(_n,{className:"w-5 h-5 text-blue-500"}),n.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 bg-blue-500 rounded-full animate-pulse"})]})]})})}),v&&n.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${S?"opacity-100 visible":"opacity-0 invisible"}`,children:[n.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:he=>{he.stopPropagation(),N(!1)},onTouchStart:he=>{he.preventDefault(),he.stopPropagation(),N(!1)},"aria-label":"Close sidebar"}),n.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 h-full bg-card border-r border-border transform transition-transform duration-150 ease-out ${S?"translate-x-0":"-translate-x-full"}`,onClick:he=>he.stopPropagation(),onTouchStart:he=>he.stopPropagation(),children:n.jsx(mc,{projects:c,selectedProject:u,selectedSession:h,onProjectSelect:Ue,onSessionSelect:bt,onNewSession:kt,onSessionDelete:Vt,onProjectDelete:we,isLoading:I,onRefresh:Ve,onShowSettings:()=>$(!0),updateAvailable:r,latestVersion:a,currentVersion:s,releaseInfo:i,onShowVersionModal:()=>l(!0),isPWA:yt,isMobile:v,onToggleSidebar:()=>Me(!1)})})]}),n.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${v&&!E?"pb-mobile-nav":""}`,children:n.jsx(Y8,{selectedProject:u,selectedSession:h,activeTab:g,setActiveTab:y,ws:Le,sendMessage:rt,messages:Ye,isMobile:v,isPWA:yt,onMenuClick:()=>N(!0),isLoading:I,onInputFocusChange:R,onSessionActive:Ae,onSessionInactive:q,onSessionProcessing:G,onSessionNotProcessing:be,processingSessions:_e,onReplaceTemporarySession:Pe,onNavigateToSession:he=>e(`/session/${he}`),onShowSettings:()=>$(!0),autoExpandTools:P,showRawParameters:se,showThinking:J,autoScrollToBottom:j,sendByCtrlEnter:ue,externalMessageUpdate:ve})}),v&&n.jsx(X8,{activeTab:g,setActiveTab:y,isInputFocused:E}),g==="chat"&&n.jsx(g9,{isOpen:T,onToggle:U,autoExpandTools:P,onAutoExpandChange:_,showRawParameters:se,onShowRawParametersChange:de,showThinking:J,onShowThinkingChange:X,autoScrollToBottom:j,onAutoScrollChange:ne,sendByCtrlEnter:ue,onSendByCtrlEnterChange:M,isMobile:v}),n.jsx(p9,{isOpen:H,onClose:()=>$(!1),projects:c,initialTab:A}),n.jsx(st,{})]})}function w9(){return n.jsx(R1,{children:n.jsx(O1,{children:n.jsx(_1,{children:n.jsx(H1,{children:n.jsx(q1,{children:n.jsx(k9,{children:n.jsx(Jf,{children:n.jsxs(Yf,{children:[n.jsx(Q0,{path:"/",element:n.jsx(Ru,{})}),n.jsx(Q0,{path:"/session/:sessionId",element:n.jsx(Ru,{})})]})})})})})})})})}"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(e=>{e.forEach(t=>{t.unregister()})}).catch(e=>{console.warn("Failed to unregister service workers:",e)});ag.createRoot(document.getElementById("root")).render(n.jsx(Kr.StrictMode,{children:n.jsx(w9,{})}));